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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\scndrv\t_scn32dr2.cpp
22 #include "fat_utils.h"
23 using namespace Fat_Test_Utils;
27 /* Tests rugged fat file system. Power failure is simulated by failure of write
28 operation in TDriver class. See t_tscan.cpp for fuller description.
29 Tests drive set in the default path for epoc platforms and x: for WINS.*/
31 GLDEF_D RTest test(_L("T_SCN32DR2"));
32 GLDEF_D TFileName TheDrive=_L("?:\\");
34 GLREF_D TInt TheFunctionNumber;
35 GLREF_D TInt TheOpNumber;
36 GLREF_D TInt TheFailCount;
37 GLREF_D TBool IsReset;
39 GLREF_D TFileName TestExeName;
40 GLREF_D TFileName StartupExeName;
41 GLREF_D TFileName LogFileName;
44 const TInt KControlIoRuggedOn=2;
45 const TInt KControlIoRuggedOff=3;
46 const TInt KControlIoIsRugged=4;
48 GLREF_D TInt WriteFailValue;
50 GLREF_C void ReadLogFile();
51 GLREF_C void DoTests();
53 GLDEF_C void CallTestsL()
58 if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
59 StartupExeName=_L("?:\\SYS\\BIN\\ESHELL.EXE");
61 StartupExeName=_L("?:\\SYSTEM\\BIN\\ESHELL.EXE");
65 test.Printf(_L("Error: Only debug builds supported\n"));
69 const TInt KWriteFailStd=-100; // error -100 returned from write fail
73 TInt r = TheFs.CharToDrive( gSessionPath[0], gDriveNumber );
74 test( KErrNone == r );
76 //-- set up console output
77 Fat_Test_Utils::SetConsole(test.Console());
79 //-- print drive information
80 PrintDrvInfo(TheFs, gDriveNumber);
82 if (!Is_Fat(TheFs, gDriveNumber))
84 test.Printf(_L("CallTestsL: Skipped: test requires FAT filesystem\n"));
92 WriteFailValue=KWriteFailStd;
94 // ensure that fat filing system is rugged
96 TPtr8 pRugged(&oldFsys,1,1);
97 r=TheFs.ControlIo(gDriveNumber,KControlIoIsRugged,pRugged);
101 r=TheFs.ControlIo(gDriveNumber,KControlIoRuggedOn);
105 // if nec, set filing system back to !rugged
108 r=TheFs.ControlIo(gDriveNumber,KControlIoRuggedOff);