author | Mike Kinghan <mikek@symbian.org> |
Thu, 25 Nov 2010 14:35:45 +0000 | |
branch | GCC_SURGE |
changeset 305 | 1ba12ef4ef89 |
parent 109 | b3a1d9898418 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 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: |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
14 |
// f32test\filesystem\fat\t_scn32dr2.cpp |
0 | 15 |
// |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
16 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
17 |
#define __E32TEST_EXTENSION__ |
0 | 18 |
|
19 |
#include <f32file.h> |
|
20 |
#include <e32test.h> |
|
21 |
#include "t_server.h" |
|
22 |
||
23 |
#include "fat_utils.h" |
|
24 |
using namespace Fat_Test_Utils; |
|
25 |
||
26 |
||
27 |
||
28 |
/* Tests rugged fat file system. Power failure is simulated by failure of write |
|
29 |
operation in TDriver class. See t_tscan.cpp for fuller description. |
|
30 |
Tests drive set in the default path for epoc platforms and x: for WINS.*/ |
|
31 |
||
32 |
GLDEF_D RTest test(_L("T_SCN32DR2")); |
|
33 |
GLDEF_D TFileName TheDrive=_L("?:\\"); |
|
34 |
||
35 |
GLREF_D TInt TheFunctionNumber; |
|
36 |
GLREF_D TInt TheOpNumber; |
|
37 |
GLREF_D TInt TheFailCount; |
|
38 |
GLREF_D TBool IsReset; |
|
39 |
GLREF_D RFs TheFs; |
|
40 |
GLREF_D TFileName TestExeName; |
|
41 |
GLREF_D TFileName StartupExeName; |
|
42 |
GLREF_D TFileName LogFileName; |
|
43 |
||
44 |
#ifdef _DEBUG |
|
45 |
const TInt KControlIoRuggedOn=2; |
|
46 |
const TInt KControlIoRuggedOff=3; |
|
47 |
const TInt KControlIoIsRugged=4; |
|
48 |
#endif |
|
49 |
GLREF_D TInt WriteFailValue; |
|
50 |
||
51 |
GLREF_C void ReadLogFile(); |
|
52 |
GLREF_C void DoTests(); |
|
53 |
||
54 |
GLDEF_C void CallTestsL() |
|
55 |
// |
|
56 |
// Do all tests |
|
57 |
// |
|
58 |
{ |
|
59 |
if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)) |
|
60 |
StartupExeName=_L("?:\\SYS\\BIN\\ESHELL.EXE"); |
|
61 |
else |
|
62 |
StartupExeName=_L("?:\\SYSTEM\\BIN\\ESHELL.EXE"); |
|
63 |
||
64 |
||
65 |
#ifndef _DEBUG |
|
66 |
test.Printf(_L("Error: Only debug builds supported\n")); |
|
67 |
return; |
|
68 |
#else |
|
69 |
||
70 |
const TInt KWriteFailStd=-100; // error -100 returned from write fail |
|
71 |
||
72 |
TInt gDriveNumber; |
|
73 |
||
74 |
TInt r = TheFs.CharToDrive( gSessionPath[0], gDriveNumber ); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
test_KErrNone(r); |
0 | 76 |
|
77 |
//-- set up console output |
|
78 |
Fat_Test_Utils::SetConsole(test.Console()); |
|
79 |
||
80 |
//-- print drive information |
|
81 |
PrintDrvInfo(TheFs, gDriveNumber); |
|
82 |
||
83 |
if (!Is_Fat(TheFs, gDriveNumber)) |
|
84 |
{ |
|
85 |
test.Printf(_L("CallTestsL: Skipped: test requires FAT filesystem\n")); |
|
86 |
return; |
|
87 |
} |
|
88 |
||
89 |
TheFunctionNumber=0; |
|
90 |
TheOpNumber=0; |
|
91 |
TheFailCount=0; |
|
92 |
IsReset=EFalse; |
|
93 |
WriteFailValue=KWriteFailStd; |
|
94 |
||
95 |
// ensure that fat filing system is rugged |
|
96 |
TUint8 oldFsys; |
|
97 |
TPtr8 pRugged(&oldFsys,1,1); |
|
98 |
r=TheFs.ControlIo(gDriveNumber,KControlIoIsRugged,pRugged); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
test_KErrNone(r); |
0 | 100 |
if(oldFsys==0) |
101 |
{ |
|
102 |
r=TheFs.ControlIo(gDriveNumber,KControlIoRuggedOn); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
test_KErrNone(r); |
0 | 104 |
} |
105 |
DoTests(); |
|
106 |
// if nec, set filing system back to !rugged |
|
107 |
if(oldFsys==0) |
|
108 |
{ |
|
109 |
r=TheFs.ControlIo(gDriveNumber,KControlIoRuggedOff); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
test_KErrNone(r); |
0 | 111 |
} |
112 |
||
113 |
return; |
|
114 |
#endif |
|
115 |
} |
|
116 |
||
117 |
||
118 |