|
1 // Copyright (c) 2000-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 // Main entry point for the tests |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <e32std_private.h> |
|
20 #include <f32file.h> |
|
21 #include <e32test.h> |
|
22 |
|
23 |
|
24 #if defined(_DEBUG) |
|
25 #define __PRINT(t) {RDebug::Print(t);} |
|
26 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
27 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
28 #else |
|
29 #define __PRINT(t) |
|
30 #define __PRINT1(t,a) |
|
31 #define __PRINT2(t,a,b) |
|
32 #endif |
|
33 |
|
34 GLREF_C void DoTestL(TInt aDriveToTest); |
|
35 |
|
36 GLREF_D RTest test; |
|
37 |
|
38 //_LIT( KRofsFilesystemName, "Rofs" ); // Comment out warning |
|
39 |
|
40 GLDEF_D RFs TheFs; |
|
41 GLDEF_D TChar gDriveToTest; |
|
42 |
|
43 void ParseCommandArguments() |
|
44 // |
|
45 // |
|
46 // |
|
47 { |
|
48 TBuf<0x100> cmd; |
|
49 User::CommandLine(cmd); |
|
50 TLex lex(cmd); |
|
51 TPtrC token=lex.NextToken(); |
|
52 TFileName thisfile=RProcess().FileName(); |
|
53 if (token.MatchF(thisfile)==0) |
|
54 { |
|
55 token.Set(lex.NextToken()); |
|
56 } |
|
57 test.Printf(_L("CLP=%S"),&token); |
|
58 if(token.Length()!=0) |
|
59 { |
|
60 gDriveToTest=token[0]; |
|
61 gDriveToTest.UpperCase(); |
|
62 } |
|
63 else |
|
64 { |
|
65 #ifdef __WINS__ |
|
66 gDriveToTest='V'; |
|
67 #else |
|
68 gDriveToTest='J'; |
|
69 #endif |
|
70 } |
|
71 } |
|
72 |
|
73 GLDEF_C TInt E32Main() |
|
74 { |
|
75 CTrapCleanup* cleanup; |
|
76 cleanup=CTrapCleanup::New(); |
|
77 |
|
78 ParseCommandArguments(); |
|
79 |
|
80 TInt r=TheFs.Connect(); |
|
81 __PRINT1(_L("Connect ret %d"),r); |
|
82 |
|
83 TInt theDrive; |
|
84 r=TheFs.CharToDrive(gDriveToTest,theDrive); |
|
85 __PRINT1(_L("Look up drive number returned %d"),r); |
|
86 |
|
87 if( KErrNone == r ) |
|
88 { |
|
89 TRAP( r, DoTestL(theDrive) ); |
|
90 } |
|
91 |
|
92 TheFs.Close(); |
|
93 |
|
94 if( KErrNone != r ) |
|
95 { |
|
96 test.Printf( _L("Failed with error %d\n"), r ); |
|
97 } |
|
98 |
|
99 #ifdef __WINS__ |
|
100 // The sin of sins for tests |
|
101 // test.Printf( _L("Press a key...") ); |
|
102 // test.Getch(); |
|
103 #endif |
|
104 delete cleanup; |
|
105 return r; |
|
106 } |
|
107 |