equal
deleted
inserted
replaced
13 // Description: |
13 // Description: |
14 // f32test\server\t_rcount.cpp |
14 // f32test\server\t_rcount.cpp |
15 // |
15 // |
16 // |
16 // |
17 |
17 |
|
18 #define __E32TEST_EXTENSION__ |
18 #include <f32file.h> |
19 #include <f32file.h> |
19 #include <e32test.h> |
20 #include <e32test.h> |
20 |
21 |
21 #include "../server/t_server.h" |
22 #include "../server/t_server.h" |
22 |
23 |
38 test(count==0); |
39 test(count==0); |
39 TFileName name=_L("Z:\\Test\\T_FILE.CPP"); |
40 TFileName name=_L("Z:\\Test\\T_FILE.CPP"); |
40 name[0] = gExeFileName[0]; |
41 name[0] = gExeFileName[0]; |
41 test.Printf(_L("%S\n"),&name); |
42 test.Printf(_L("%S\n"),&name); |
42 TInt r=file.Open(TheFs,name,EFileRead); |
43 TInt r=file.Open(TheFs,name,EFileRead); |
43 test(r==KErrNone); |
44 test_KErrNone(r); |
44 count=TheFs.ResourceCount(); |
45 count=TheFs.ResourceCount(); |
45 test(count==1); |
46 test(count==1); |
46 file.Close(); |
47 file.Close(); |
47 count=TheFs.ResourceCount(); |
48 count=TheFs.ResourceCount(); |
48 test(count==0); |
49 test(count==0); |
57 { |
58 { |
58 |
59 |
59 User::SetJustInTime(EFalse); |
60 User::SetJustInTime(EFalse); |
60 RFs fs; |
61 RFs fs; |
61 TInt r=fs.Connect(); |
62 TInt r=fs.Connect(); |
62 test(r==KErrNone); |
63 test_KErrNone(r); |
63 RFile file; |
64 RFile file; |
64 fs.ResourceCountMarkStart(); |
65 fs.ResourceCountMarkStart(); |
65 TFileName name=_L("Z:\\Test\\T_FILE.CPP"); |
66 TFileName name=_L("Z:\\Test\\T_FILE.CPP"); |
66 name[0] = gExeFileName[0]; |
67 name[0] = gExeFileName[0]; |
67 |
68 |
68 r=file.Open(fs,name,EFileRead); |
69 r=file.Open(fs,name,EFileRead); |
69 test(r==KErrNone); |
70 test_KErrNone(r); |
70 TInt count=fs.ResourceCount(); |
71 TInt count=fs.ResourceCount(); |
71 test(count==1); |
72 test(count==1); |
72 fs.ResourceCountMarkEnd(); // MarkEnd without close |
73 fs.ResourceCountMarkEnd(); // MarkEnd without close |
73 fs.Close(); |
74 fs.Close(); |
74 return KErrNone; |
75 return KErrNone; |
82 |
83 |
83 test.Next(_L("Test resource count failure")); |
84 test.Next(_L("Test resource count failure")); |
84 TRequestStatus stat; |
85 TRequestStatus stat; |
85 RThread t; |
86 RThread t; |
86 TInt r=t.Create(_L("TestPanicThread"),TestPanic,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
87 TInt r=t.Create(_L("TestPanicThread"),TestPanic,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
87 test(r==KErrNone); |
88 test_KErrNone(r); |
88 t.Logon(stat); |
89 t.Logon(stat); |
89 t.Resume(); |
90 t.Resume(); |
90 User::WaitForRequest(stat); |
91 User::WaitForRequest(stat); |
91 test(t.ExitReason()==CSession2::ESesFoundResCountHeaven); |
92 test(t.ExitReason()==CSession2::ESesFoundResCountHeaven); |
92 test(t.ExitType()==EExitPanic); |
93 test(t.ExitType()==EExitPanic); |
152 // the thread should get paniced by the file server |
153 // the thread should get paniced by the file server |
153 // |
154 // |
154 { |
155 { |
155 RFs f; |
156 RFs f; |
156 TInt r = f.Connect(); |
157 TInt r = f.Connect(); |
157 test(r==KErrNone); |
158 test_KErrNone(r); |
158 |
159 |
159 RFile a; |
160 RFile a; |
160 r=a.Replace(f,KFileName1,EFileWrite); |
161 r=a.Replace(f,KFileName1,EFileWrite); |
161 test(r==KErrNone); |
162 test_KErrNone(r); |
162 RFile b(a); |
163 RFile b(a); |
163 a.Close(); |
164 a.Close(); |
164 |
165 |
165 r=b.Write(_L8("testing testing")); |
166 r=b.Write(_L8("testing testing")); |
166 |
167 |
179 // the thread should get panniced by the server |
180 // the thread should get panniced by the server |
180 // |
181 // |
181 { |
182 { |
182 RFs f; |
183 RFs f; |
183 TInt r = f.Connect(); |
184 TInt r = f.Connect(); |
184 test(r==KErrNone); |
185 test_KErrNone(r); |
185 |
186 |
186 RDir a; |
187 RDir a; |
187 r=a.Open(f,KDirName1,KEntryAttNormal); |
188 r=a.Open(f,KDirName1,KEntryAttNormal); |
188 test(r==KErrNone); |
189 test_KErrNone(r); |
189 RDir b(a); |
190 RDir b(a); |
190 a.Close(); |
191 a.Close(); |
191 |
192 |
192 TEntryArray dummyarray; |
193 TEntryArray dummyarray; |
193 r=b.Read(dummyarray); |
194 r=b.Read(dummyarray); |
213 _LIT(KDrive1, "X:\\"); |
214 _LIT(KDrive1, "X:\\"); |
214 #endif |
215 #endif |
215 |
216 |
216 RFs f; |
217 RFs f; |
217 TInt r = f.Connect(); |
218 TInt r = f.Connect(); |
218 test(r==KErrNone); |
219 test_KErrNone(r); |
219 |
220 |
220 RFormat a; |
221 RFormat a; |
221 TInt count; |
222 TInt count; |
222 r=a.Open(f,KDrive1,EQuickFormat,count); |
223 r=a.Open(f,KDrive1,EQuickFormat,count); |
223 test(r==KErrNone); |
224 test_KErrNone(r); |
224 RFormat b(a); |
225 RFormat b(a); |
225 a.Close(); |
226 a.Close(); |
226 |
227 |
227 r=b.Next(count); |
228 r=b.Next(count); |
228 |
229 |
248 const TInt KDrive1 = EDriveX; |
249 const TInt KDrive1 = EDriveX; |
249 #endif |
250 #endif |
250 |
251 |
251 RFs f; |
252 RFs f; |
252 TInt r = f.Connect(); |
253 TInt r = f.Connect(); |
253 test(r==KErrNone); |
254 test_KErrNone(r); |
254 |
255 |
255 RRawDisk a; |
256 RRawDisk a; |
256 r=a.Open(f,KDrive1); |
257 r=a.Open(f,KDrive1); |
257 |
258 |
258 test(r==KErrNone); |
259 test_KErrNone(r); |
259 RRawDisk b(a); |
260 RRawDisk b(a); |
260 a.Close(); |
261 a.Close(); |
261 TBuf8<19> buffer; |
262 TBuf8<19> buffer; |
262 r=b.Read(0,buffer); |
263 r=b.Read(0,buffer); |
263 |
264 |