os/kernelhwsrv/kerneltest/f32test/server/t_mvdr.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32test\server\t_mvdr.cpp
sl@0
    15
// Manual test creates a set of directories and moves them from one to another
sl@0
    16
// Checks rename operation on directories.  Removable media should be checked
sl@0
    17
// afterwards with disk verification utility.
sl@0
    18
// 
sl@0
    19
//
sl@0
    20
sl@0
    21
sl@0
    22
#include <e32test.h>
sl@0
    23
#include <f32file.h>
sl@0
    24
sl@0
    25
// -------- local test data --------
sl@0
    26
sl@0
    27
RTest test(_L("t_mvdr"));
sl@0
    28
sl@0
    29
RFs TheFs;
sl@0
    30
RFile TheFile;
sl@0
    31
sl@0
    32
#ifdef __WINS__
sl@0
    33
_LIT(KSessionPath, "X:\\");
sl@0
    34
#else
sl@0
    35
_LIT(KSessionPath, "D:\\");
sl@0
    36
#endif
sl@0
    37
sl@0
    38
GLDEF_C TInt E32Main()
sl@0
    39
    {
sl@0
    40
	CTrapCleanup* cleanup;
sl@0
    41
	cleanup = CTrapCleanup::New();
sl@0
    42
 	__UHEAP_MARK;
sl@0
    43
sl@0
    44
	test.Title();
sl@0
    45
	test.Start(_L("Starting T_MVDR"));
sl@0
    46
sl@0
    47
	test(TheFs.Connect() == KErrNone);
sl@0
    48
sl@0
    49
	test(TheFs.SetSessionPath(KSessionPath) == KErrNone);
sl@0
    50
sl@0
    51
	CFileMan *fm = 0;
sl@0
    52
	TRAPD(r, fm = CFileMan::NewL(TheFs));
sl@0
    53
	test(r == KErrNone);
sl@0
    54
sl@0
    55
	const TInt KMaxDirs = 32;
sl@0
    56
sl@0
    57
	TInt i;
sl@0
    58
	for (i = 0; i < KMaxDirs; ++i)
sl@0
    59
		{
sl@0
    60
		TBuf<16> dirName(KSessionPath);
sl@0
    61
		dirName.AppendFormat(_L("testdir.%03x\\"), i);
sl@0
    62
		test(TheFs.MkDir(dirName) == KErrNone);
sl@0
    63
		}
sl@0
    64
sl@0
    65
	TInt ctr = 0x0ff;
sl@0
    66
	for (i = 0; i < KMaxDirs; ++i)
sl@0
    67
		{
sl@0
    68
		test.Printf(_L("moving directories from testdir.%03x\r"), i);
sl@0
    69
sl@0
    70
		TInt j;
sl@0
    71
		for (j = 0; j < KMaxDirs; ++j)
sl@0
    72
			{
sl@0
    73
			TBuf<32> srcDirName(KSessionPath);
sl@0
    74
			srcDirName.AppendFormat(_L("testdir.%03x\\movedir.%03x\\"), i, ++ctr);
sl@0
    75
			test(TheFs.MkDir(srcDirName) == KErrNone);
sl@0
    76
			
sl@0
    77
			TBuf<32> dstDirName(KSessionPath);
sl@0
    78
			dstDirName.AppendFormat(_L("testdir.%03x\\movedir.%03x\\"), j, ++ctr);
sl@0
    79
			srcDirName.SetLength(srcDirName.Length() - 1);
sl@0
    80
			dstDirName.SetLength(dstDirName.Length() - 1);
sl@0
    81
			r = fm->Move(srcDirName, dstDirName);
sl@0
    82
			test(r == KErrNone);
sl@0
    83
			}
sl@0
    84
		}
sl@0
    85
sl@0
    86
	delete fm;
sl@0
    87
sl@0
    88
	TheFs.Close();
sl@0
    89
	test.End();
sl@0
    90
	test.Close();
sl@0
    91
sl@0
    92
	__UHEAP_MARKEND;
sl@0
    93
	delete cleanup;
sl@0
    94
sl@0
    95
	return KErrNone;
sl@0
    96
    }
sl@0
    97