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