1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/bench/t_fsrdirscan.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1475 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\bench\t_fsrdirscan.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <f32file.h>
1.22 +#include <e32test.h>
1.23 +#include "t_select.h"
1.24 +#include "..\server\t_server.h"
1.25 +#include "t_benchmain.h"
1.26 +
1.27 +GLDEF_D RTest test(_L("File Server Benchmarks, DirScan"));
1.28 +
1.29 +//----------------------------------------------------------------------------------------------
1.30 +//! @SYMTestCaseID PBASE-T_FSRDIRSCAN-0274
1.31 +//! @SYMTestType CIT
1.32 +//! @SYMPREQ PREQ000
1.33 +//! @SYMTestCaseDesc This test case is measuring performance of the FAT implementation.
1.34 +//! @SYMTestActions 0. Expects the files to exist in order to successful execution
1.35 +//! 1. Time finding an entry in each directory with TFindFile
1.36 +//! 2. Time finding an entry in each directory with RFile::Open
1.37 +//! 3. Time finding an entry in each directory with TFindFile with multiple
1.38 +//! clients accessing the directory
1.39 +//! 4. Time finding an entry in each directory with RFile::Open with multiple
1.40 +//! clients accessing the directory
1.41 +//! 5. Time finding an entry in each directory with TFindFile with multiple
1.42 +//! clients accessing different directories
1.43 +//! 6. Time finding an entry in each directory with RFile::Open with multiple
1.44 +//! clients accessing different directories
1.45 +//! 7. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
1.46 +//! 8. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
1.47 +//! and different clients accessing the same directory
1.48 +//! 9. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
1.49 +//! and different clients accessing different directories
1.50 +//! 10. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
1.51 +//! 11. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
1.52 +//! and different clients accessing the same directory
1.53 +//! 12. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
1.54 +//! and different clients accessing different directories
1.55 +//! 13. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
1.56 +//! 14. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
1.57 +//! and different clients accessing the same directory
1.58 +//! 15. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
1.59 +//! and different clients accessing different directories
1.60 +//!
1.61 +//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
1.62 +//! @SYMTestPriority High
1.63 +//! @SYMTestStatus Implemented
1.64 +//----------------------------------------------------------------------------------------------
1.65 +
1.66 +LOCAL_D RSemaphore client;
1.67 +LOCAL_D const TInt KHeapSize = 0x4000;
1.68 +LOCAL_D TBuf8<4096> buf;
1.69 +
1.70 +LOCAL_D TDriveList gDriveList;
1.71 +
1.72 +LOCAL_D TFileName gFindEntryDir;
1.73 +LOCAL_D TBuf<100> gFindDir;
1.74 +
1.75 +LOCAL_D TFileName gFindEntryDir2;
1.76 +LOCAL_D TBuf<100> gFindDir2;
1.77 +
1.78 +// Concurrent threads
1.79 +RThread gSpeedy;
1.80 +RThread gSpeedyII;
1.81 +TInt ThreadCount = 0;
1.82 +
1.83 +_LIT(KDirMultipleName2, "dir%d_%d\\");
1.84 +
1.85 +/** Find entry in directory
1.86 +
1.87 +*/
1.88 +LOCAL_C TInt FindEntryAccess2(TAny*)
1.89 + {
1.90 + RFs fs;
1.91 + TInt r = fs.Connect();
1.92 + RTest test(_L("test 2"));
1.93 +
1.94 + fs.SetSessionPath(gSessionPath);
1.95 +
1.96 + client.Signal();
1.97 +
1.98 + FOREVER
1.99 + {
1.100 + TEntry entry;
1.101 + r = fs.Entry(gFindEntryDir2, entry);
1.102 + FailIfError(r);
1.103 + r = fs.Entry(gFindDir2,entry);
1.104 + FailIfError(r);
1.105 + }
1.106 + }
1.107 +
1.108 +/** Starts a concurrent client session
1.109 +
1.110 + @param aFunction Thread to be started twice
1.111 +*/
1.112 +LOCAL_C void DoTest(TThreadFunction aFunction)
1.113 + {
1.114 + TBuf<20> buf = _L("Speedy");
1.115 + buf.AppendNum(ThreadCount++);
1.116 + TInt r = gSpeedy.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
1.117 + FailIfError(r);
1.118 +
1.119 + buf = _L("Speedy");
1.120 + buf.AppendNum(ThreadCount++);
1.121 + r = gSpeedyII.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
1.122 + FailIfError(r);
1.123 +
1.124 + gSpeedy.SetPriority(EPriorityLess);
1.125 + gSpeedyII.SetPriority(EPriorityLess);
1.126 +
1.127 + gSpeedy.Resume();
1.128 + gSpeedyII.Resume();
1.129 +
1.130 + client.Wait();
1.131 + client.Wait();
1.132 + }
1.133 +
1.134 +/** Starts a concurrent client session in different directories
1.135 +
1.136 + @param aFunction Thread to be started
1.137 +*/
1.138 +LOCAL_C void DoTest2(TThreadFunction aFunction)
1.139 + {
1.140 + TBuf<20> buf = _L("Speedy");
1.141 + buf.AppendNum(ThreadCount++);
1.142 + TInt r = gSpeedy.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
1.143 + FailIfError(r);
1.144 +
1.145 + buf = _L("Speedy");
1.146 + buf.AppendNum(ThreadCount++);
1.147 + r = gSpeedyII.Create(buf, FindEntryAccess2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
1.148 + FailIfError(r);
1.149 +
1.150 + gSpeedy.SetPriority(EPriorityLess);
1.151 + gSpeedyII.SetPriority(EPriorityLess);
1.152 +
1.153 + gSpeedy.Resume();
1.154 + gSpeedyII.Resume();
1.155 +
1.156 + client.Wait();
1.157 + client.Wait();
1.158 + }
1.159 +
1.160 +/** Kills the concurrent session
1.161 +
1.162 +*/
1.163 +LOCAL_C void DoTestKill()
1.164 + {
1.165 + TInt r = 0;
1.166 +
1.167 + gSpeedy.Kill(KErrNone);
1.168 + FailIfError(r);
1.169 + gSpeedy.Close();
1.170 +
1.171 + gSpeedyII.Kill(KErrNone);
1.172 + FailIfError(r);
1.173 + gSpeedyII.Close();
1.174 + }
1.175 +
1.176 +/** Find entry in directory
1.177 +
1.178 +*/
1.179 +LOCAL_C TInt FindEntryAccess(TAny*)
1.180 + {
1.181 + RFs fs;
1.182 + TInt r = fs.Connect();
1.183 + RTest test(_L("test 2"));
1.184 +
1.185 + r = fs.SetSessionPath(gSessionPath);
1.186 +
1.187 + client.Signal();
1.188 +
1.189 + FOREVER
1.190 + {
1.191 + TEntry entry;
1.192 +
1.193 + r = fs.Entry(gFindEntryDir,entry);
1.194 + FailIfError(r);
1.195 +
1.196 + r = fs.Entry(gFindDir,entry);
1.197 + FailIfError(r);
1.198 + }
1.199 + }
1.200 +
1.201 +/** Find last.txt with TFindFile and with two threads accessing the current directory
1.202 + and looking for the same file
1.203 +
1.204 + @param aN Number of files in the directory
1.205 + @param aStep Test step
1.206 +*/
1.207 +LOCAL_C void FindFileM1(TInt aN, TInt aStep)
1.208 + {
1.209 + TBuf16<100> dir1;
1.210 + TBuf16<100> dir2;
1.211 + TBuf16<100> dir3;
1.212 + TBuf16<100> dir4;
1.213 + TBuf16<100> dirtemp;
1.214 +
1.215 + TInt r = 0;
1.216 + TFindFile find(TheFs);
1.217 + TTime startTime;
1.218 + TTime endTime;
1.219 + TTimeIntervalMicroSeconds timeTaken(0);
1.220 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.221 +
1.222 + if(aN <= gFilesLimit)
1.223 + {
1.224 + dir1 = gSessionPath;
1.225 + dir2 = gSessionPath;
1.226 + dir3 = gSessionPath;
1.227 +
1.228 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.229 + dir1.Append(dirtemp);
1.230 + gFindDir = dir1;
1.231 +
1.232 + dirtemp.Format(KDirMultipleName2, 2, aN);
1.233 + dir2.Append(dirtemp);
1.234 +
1.235 + dirtemp.Format(KDirMultipleName2, 3, aN);
1.236 + dir3.Append(dirtemp);
1.237 +
1.238 + dir1.Append(KCommonFile);
1.239 + dir2.Append(KCommonFile);
1.240 + dir3.Append(KCommonFile);
1.241 +
1.242 +
1.243 + if(gTypes >= 1)
1.244 + {
1.245 + gFindEntryDir = dir1;
1.246 + DoTest(FindEntryAccess);
1.247 +
1.248 + dir4.Format(KDirMultipleName, 1, aN);
1.249 + startTime.HomeTime();
1.250 +
1.251 + r = find.FindByPath(dir1, &dir4);
1.252 + FailIfError(r);
1.253 +
1.254 + endTime.HomeTime();
1.255 + DoTestKill();
1.256 +
1.257 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.258 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.259 + }
1.260 +
1.261 + if(gTypes >= 2)
1.262 + {
1.263 + dir4 = gSessionPath;
1.264 + dirtemp.Format(KDirMultipleName, 2, aN);
1.265 + dir4.Append(dirtemp);
1.266 + gFindDir = dir4;
1.267 + gFindEntryDir = dir2;
1.268 +
1.269 + DoTest(FindEntryAccess);
1.270 +
1.271 + startTime.HomeTime();
1.272 +
1.273 + r = find.FindByPath(dir2, &dir4);
1.274 + FailIfError(r);
1.275 +
1.276 + endTime.HomeTime();
1.277 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.278 + DoTestKill();
1.279 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.280 + }
1.281 +
1.282 + if(gTypes >= 3)
1.283 + {
1.284 + dir4 = gSessionPath;
1.285 + dirtemp.Format(KDirMultipleName, 3, aN);
1.286 + dir4.Append(dirtemp);
1.287 +
1.288 + gFindDir = dir4;
1.289 + gFindEntryDir = dir3;
1.290 +
1.291 + DoTest(FindEntryAccess);
1.292 +
1.293 + startTime.HomeTime();
1.294 +
1.295 + r = find.FindByPath(dir3, &dir4);
1.296 + FailIfError(r);
1.297 +
1.298 + endTime.HomeTime();
1.299 + DoTestKill();
1.300 +
1.301 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.302 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.303 + }
1.304 + }
1.305 +
1.306 + PrintResult(aStep, 1, aN);
1.307 + PrintResultTime(aStep, 2, timeTaken1);
1.308 + PrintResultTime(aStep, 3, timeTaken2);
1.309 + PrintResultTime(aStep, 4, timeTaken3);
1.310 + }
1.311 +
1.312 +/** Find last.txt by opening it and with two threads accessing the current directory
1.313 + and looking for the same file
1.314 +
1.315 + @param aN Number of files in the directory
1.316 + @param aStep Test step
1.317 +*/
1.318 +LOCAL_C void FindFileM2(TInt aN, TInt aStep)
1.319 + {
1.320 + TBuf16<100> dir1;
1.321 + TBuf16<100> dir2;
1.322 + TBuf16<100> dir3;
1.323 + TBuf16<100> dirtemp;
1.324 +
1.325 + TInt r = 0;
1.326 +
1.327 + TTime startTime;
1.328 + TTime endTime;
1.329 + TTimeIntervalMicroSeconds timeTaken(0);
1.330 + RFile file;
1.331 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.332 +
1.333 + if(aN <= gFilesLimit)
1.334 + {
1.335 + dir1 = gSessionPath;
1.336 + dir2 = gSessionPath;
1.337 + dir3 = gSessionPath;
1.338 +
1.339 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.340 + dir1.Append(dirtemp);
1.341 + gFindDir = dir1;
1.342 +
1.343 + dirtemp.Format(KDirMultipleName2, 2, aN);
1.344 + dir2.Append(dirtemp);
1.345 +
1.346 + dirtemp.Format(KDirMultipleName2, 3, aN);
1.347 + dir3.Append(dirtemp);
1.348 +
1.349 + dir1.Append(KCommonFile);
1.350 +
1.351 + if(gTypes >= 1)
1.352 + {
1.353 + gFindEntryDir = dir1;
1.354 + DoTest(FindEntryAccess);
1.355 +
1.356 + User::After(200);
1.357 +
1.358 + startTime.HomeTime();
1.359 +
1.360 + r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
1.361 + FailIfError(r);
1.362 +
1.363 + endTime.HomeTime();
1.364 +
1.365 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.366 +
1.367 + file.Close();
1.368 + DoTestKill();
1.369 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.370 + }
1.371 +
1.372 + if(gTypes >= 2)
1.373 + {
1.374 + gFindDir = dir2;
1.375 + dir2.Append(KCommonFile);
1.376 + gFindEntryDir = dir2;
1.377 +
1.378 + DoTest(FindEntryAccess);
1.379 +
1.380 + User::After(200);
1.381 +
1.382 + startTime.HomeTime();
1.383 +
1.384 + r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
1.385 + FailIfError(r);
1.386 +
1.387 + endTime.HomeTime();
1.388 +
1.389 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.390 + file.Close();
1.391 + DoTestKill();
1.392 +
1.393 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.394 + }
1.395 +
1.396 + if(gTypes >= 3)
1.397 + {
1.398 + gFindDir = dir3;
1.399 + dir3.Append(KCommonFile);
1.400 + gFindEntryDir = dir3;
1.401 +
1.402 + DoTest(FindEntryAccess);
1.403 +
1.404 + User::After(200);
1.405 +
1.406 + startTime.HomeTime();
1.407 +
1.408 + r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
1.409 + FailIfError(r);
1.410 +
1.411 + endTime.HomeTime();
1.412 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.413 + DoTestKill();
1.414 +
1.415 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.416 + file.Close();
1.417 + }
1.418 + }
1.419 +
1.420 + PrintResult(aStep, 1, aN);
1.421 + PrintResultTime(aStep, 2, timeTaken1);
1.422 + PrintResultTime(aStep, 3, timeTaken2);
1.423 + PrintResultTime(aStep, 4, timeTaken3);
1.424 + }
1.425 +
1.426 +/** Find last.txt with TFindFile and without any other process
1.427 +
1.428 + @param aN Number of files in the directory
1.429 + @param aStep Test step
1.430 +*/
1.431 +LOCAL_C void FindFile1(TInt aN, TInt aStep)
1.432 + {
1.433 + TBuf16<100> dir1;
1.434 + TBuf16<100> dir2;
1.435 + TBuf16<100> dir3;
1.436 + TBuf16<100> dir4;
1.437 + TBuf16<100> dirtemp;
1.438 +
1.439 + TInt r = 0;
1.440 + TFindFile find(TheFs);
1.441 + TTime startTime;
1.442 + TTime endTime;
1.443 + TTimeIntervalMicroSeconds timeTaken(0);
1.444 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.445 +
1.446 + if(aN <= gFilesLimit)
1.447 + {
1.448 + dir1 = gSessionPath;
1.449 + dir2 = gSessionPath;
1.450 + dir3 = gSessionPath;
1.451 +
1.452 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.453 + dir1.Append(dirtemp);
1.454 +
1.455 + dirtemp.Format(KDirMultipleName2, 2, aN);
1.456 + dir2.Append(dirtemp);
1.457 +
1.458 + dirtemp.Format(KDirMultipleName2, 3, aN);
1.459 + dir3.Append(dirtemp);
1.460 +
1.461 + dir1.Append(KCommonFile);
1.462 + dir2.Append(KCommonFile);
1.463 + dir3.Append(KCommonFile);
1.464 +
1.465 + r = TheFs.SetSessionPath(gSessionPath);
1.466 + FailIfError(r);
1.467 +
1.468 + if(gTypes >= 1)
1.469 + {
1.470 + dir4.Format(KDirMultipleName, 1, aN);
1.471 +
1.472 + startTime.HomeTime();
1.473 +
1.474 + r = find.FindByPath(dir1, &dir4);
1.475 + FailIfError(r);
1.476 +
1.477 + endTime.HomeTime();
1.478 +
1.479 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.480 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.481 + }
1.482 +
1.483 + if(gTypes >= 2)
1.484 + {
1.485 + dir4.Format(KDirMultipleName, 2, aN);
1.486 +
1.487 + startTime.HomeTime();
1.488 +
1.489 + r = find.FindByPath(dir2, &dir4);
1.490 + FailIfError(r);
1.491 +
1.492 + endTime.HomeTime();
1.493 +
1.494 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.495 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.496 + }
1.497 +
1.498 + if(gTypes >= 3)
1.499 + {
1.500 + dir4.Format(KDirMultipleName, 3, aN);
1.501 +
1.502 + startTime.HomeTime();
1.503 +
1.504 + r = find.FindByPath(dir3, &dir4);
1.505 + FailIfError(r);
1.506 +
1.507 + endTime.HomeTime();
1.508 +
1.509 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.510 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.511 + }
1.512 + }
1.513 +
1.514 + PrintResult(aStep, 1, aN);
1.515 + PrintResultTime(aStep, 2, timeTaken1);
1.516 + PrintResultTime(aStep, 3, timeTaken2);
1.517 + PrintResultTime(aStep, 4, timeTaken3);
1.518 + }
1.519 +
1.520 +/** Find last.txt by opening it and without any other process
1.521 +
1.522 + @param aN Number of files in the directory
1.523 + @param aStep Test step
1.524 +*/
1.525 +LOCAL_C void FindFile2(TInt aN, TInt aStep)
1.526 + {
1.527 + TBuf16<100> dir1;
1.528 + TBuf16<100> dir2;
1.529 + TBuf16<100> dir3;
1.530 + TBuf16<100> dirtemp;
1.531 +
1.532 + TInt r = 0;
1.533 +
1.534 + TTime startTime;
1.535 + TTime endTime;
1.536 + TTimeIntervalMicroSeconds timeTaken(0);
1.537 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.538 +
1.539 + RFile file;
1.540 +
1.541 + if(aN <= gFilesLimit)
1.542 + {
1.543 + dir1 = gSessionPath;
1.544 + dir2 = gSessionPath;
1.545 + dir3 = gSessionPath;
1.546 +
1.547 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.548 + dir1.Append(dirtemp);
1.549 +
1.550 + dirtemp.Format(KDirMultipleName2, 2, aN);
1.551 + dir2.Append(dirtemp);
1.552 +
1.553 + dirtemp.Format(KDirMultipleName2, 3, aN);
1.554 + dir3.Append(dirtemp);
1.555 +
1.556 + dir1.Append(KCommonFile);
1.557 + dir2.Append(KCommonFile);
1.558 + dir3.Append(KCommonFile);
1.559 +
1.560 + r = TheFs.SetSessionPath(gSessionPath);
1.561 + FailIfError(r);
1.562 +
1.563 + if(gTypes >= 1)
1.564 + {
1.565 + startTime.HomeTime();
1.566 +
1.567 + r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
1.568 + FailIfError(r);
1.569 +
1.570 + endTime.HomeTime();
1.571 +
1.572 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.573 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.574 + file.Close();
1.575 + }
1.576 +
1.577 + if(gTypes >= 2)
1.578 + {
1.579 + startTime.HomeTime();
1.580 +
1.581 + r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
1.582 + FailIfError(r);
1.583 +
1.584 + endTime.HomeTime();
1.585 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.586 + file.Close();
1.587 +
1.588 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.589 + }
1.590 +
1.591 + if(gTypes >= 3)
1.592 + {
1.593 + startTime.HomeTime();
1.594 +
1.595 + r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
1.596 + FailIfError(r);
1.597 +
1.598 + endTime.HomeTime();
1.599 +
1.600 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.601 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.602 + file.Close();
1.603 + }
1.604 + }
1.605 +
1.606 + PrintResult(aStep, 1, aN);
1.607 + PrintResultTime(aStep, 2, timeTaken1);
1.608 + PrintResultTime(aStep, 3, timeTaken2);
1.609 + PrintResultTime(aStep, 4, timeTaken3);
1.610 + }
1.611 +
1.612 +/** Find last.txt with TFindFile and with two threads accessing the 2 directories
1.613 +
1.614 + @param aN Number of files in the directory
1.615 + @param aStep Test step
1.616 +*/
1.617 +LOCAL_C void FindFileMD1(TInt aN, TInt aStep)
1.618 + {
1.619 + TBuf16<100> dir1;
1.620 + TBuf16<100> dir2;
1.621 + TBuf16<100> dir3;
1.622 + TBuf16<100> dir4;
1.623 + TBuf16<100> dirtemp;
1.624 +
1.625 + TInt r = 0;
1.626 + TFindFile find(TheFs);
1.627 + TTime startTime;
1.628 + TTime endTime;
1.629 + TTimeIntervalMicroSeconds timeTaken(0);
1.630 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.631 +
1.632 + if(aN <= gFilesLimit)
1.633 + {
1.634 + dir1 = gSessionPath;
1.635 + dir2 = gSessionPath;
1.636 + dir3 = gSessionPath;
1.637 +
1.638 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.639 + dir1.Append(dirtemp);
1.640 +
1.641 + dirtemp.Format(KDirMultipleName, 2, aN);
1.642 + dir2.Append(dirtemp);
1.643 +
1.644 + dirtemp.Format(KDirMultipleName, 3, aN);
1.645 + dir3.Append(dirtemp);
1.646 +
1.647 + dir4 = gSessionPath;
1.648 + dirtemp.Format(KDirMultipleName, 3, 300);
1.649 +
1.650 + dir4.Append(dirtemp);
1.651 +
1.652 + gFindDir = dir1;
1.653 + gFindDir2 = dir4;
1.654 +
1.655 + dir1.Append(KCommonFile);
1.656 + dir2.Append(KCommonFile);
1.657 + dir3.Append(KCommonFile);
1.658 + dir4.Append(KCommonFile);
1.659 +
1.660 + gFindEntryDir = dir1;
1.661 + gFindEntryDir2 = dir4;
1.662 +
1.663 +
1.664 + TheFs.SetSessionPath(gSessionPath);
1.665 +
1.666 + dir4.Format(KDirMultipleName, 1, aN);
1.667 +
1.668 + if(gTypes >= 1)
1.669 + {
1.670 + DoTest2(FindEntryAccess);
1.671 +
1.672 + startTime.HomeTime();
1.673 + r = find.FindByPath(dir1, &dir4);
1.674 + FailIfError(r);
1.675 + endTime.HomeTime();
1.676 +
1.677 + DoTestKill();
1.678 +
1.679 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.680 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.681 + }
1.682 +
1.683 + if(gTypes >= 2)
1.684 + {
1.685 + dir4 = gSessionPath;
1.686 + dirtemp.Format(KDirMultipleName, 2, aN);
1.687 + dir4.Append(dirtemp);
1.688 + gFindDir = dir4;
1.689 + gFindEntryDir=dir2;
1.690 +
1.691 + DoTest2(FindEntryAccess);
1.692 + dir4.Format(KDirMultipleName, 2, aN);
1.693 +
1.694 + startTime.HomeTime();
1.695 +
1.696 + r = find.FindByPath(dir2,&dir4);
1.697 + test(r==KErrNone);
1.698 + endTime.HomeTime();
1.699 + timeTaken=endTime.MicroSecondsFrom(startTime);
1.700 + DoTestKill();
1.701 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.702 + }
1.703 +
1.704 + if(gTypes>=3)
1.705 + {
1.706 + dir4 = gSessionPath;
1.707 + dirtemp.Format(KDirMultipleName, 3, aN);
1.708 + dir4.Append(dirtemp);
1.709 +
1.710 + gFindDir = dir4;
1.711 + gFindEntryDir=dir2;
1.712 +
1.713 + DoTest2(FindEntryAccess);
1.714 + dir4.Format(KDirMultipleName, 3, aN);
1.715 +
1.716 + startTime.HomeTime();
1.717 +
1.718 + r=find.FindByPath(dir3,&dir4);
1.719 + test(r==KErrNone);
1.720 +
1.721 + endTime.HomeTime();
1.722 + DoTestKill();
1.723 +
1.724 + timeTaken=endTime.MicroSecondsFrom(startTime);
1.725 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.726 + }
1.727 + }
1.728 +
1.729 + PrintResult(aStep, 1, aN);
1.730 + PrintResultTime(aStep, 2, timeTaken1);
1.731 + PrintResultTime(aStep, 3, timeTaken2);
1.732 + PrintResultTime(aStep, 4, timeTaken3);
1.733 + }
1.734 +
1.735 +
1.736 +/** Find last.txt by opening the file and with two threads accessing the current
1.737 + directory and other one
1.738 +
1.739 + @param aN Number of files in the directory
1.740 + @param aStep Test step
1.741 +*/
1.742 +LOCAL_C void FindFileMD2(TInt aN, TInt aStep)
1.743 + {
1.744 + TBuf16<100> dir1;
1.745 + TBuf16<100> dir2;
1.746 + TBuf16<100> dir3;
1.747 + TBuf16<100> dir4;
1.748 + TBuf16<100> dirtemp;
1.749 +
1.750 + TInt r = 0;
1.751 +
1.752 + TTime startTime;
1.753 + TTime endTime;
1.754 + TTimeIntervalMicroSeconds timeTaken(0);
1.755 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.756 +
1.757 + RFile file;
1.758 +
1.759 + if(aN <= gFilesLimit)
1.760 + {
1.761 + dir1 = gSessionPath;
1.762 + dir2 = gSessionPath;
1.763 + dir3 = gSessionPath;
1.764 +
1.765 + dirtemp.Format(KDirMultipleName2, 1, aN);
1.766 + dir1.Append(dirtemp);
1.767 + gFindDir = dir1;
1.768 +
1.769 + dirtemp.Format(KDirMultipleName2, 2, aN);
1.770 + dir2.Append(dirtemp);
1.771 +
1.772 + dirtemp.Format(KDirMultipleName2, 3, aN);
1.773 + dir3.Append(dirtemp);
1.774 +
1.775 + dir1.Append(KCommonFile);
1.776 + gFindEntryDir = dir1;
1.777 +
1.778 + dir4 = gSessionPath;
1.779 + dirtemp.Format(KDirMultipleName, 3, 300);
1.780 + dir4.Append(dirtemp);
1.781 +
1.782 +
1.783 + if(gTypes >= 1)
1.784 + {
1.785 + gFindDir2 = dir4;
1.786 + dir4.Append(KCommonFile);
1.787 + gFindEntryDir2 = dir4;
1.788 +
1.789 + DoTest2(FindEntryAccess);
1.790 +
1.791 + User::After(200);
1.792 +
1.793 + startTime.HomeTime();
1.794 +
1.795 + r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
1.796 + FailIfError(r);
1.797 +
1.798 + endTime.HomeTime();
1.799 +
1.800 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.801 +
1.802 + file.Close();
1.803 + DoTestKill();
1.804 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.805 + }
1.806 +
1.807 + if(gTypes >= 2)
1.808 + {
1.809 + gFindDir = dir2;
1.810 + dir2.Append(KCommonFile);
1.811 + gFindEntryDir = dir2;
1.812 + DoTest2(FindEntryAccess);
1.813 +
1.814 + User::After(200);
1.815 + startTime.HomeTime();
1.816 +
1.817 + r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
1.818 + FailIfError(r);
1.819 +
1.820 + endTime.HomeTime();
1.821 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.822 + file.Close();
1.823 + DoTestKill();
1.824 +
1.825 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.826 + }
1.827 +
1.828 + if(gTypes >= 3)
1.829 + {
1.830 + gFindDir = dir3;
1.831 + dir3.Append(KCommonFile);
1.832 + gFindEntryDir = dir3;
1.833 + DoTest2(FindEntryAccess);
1.834 +
1.835 + User::After(200);
1.836 + startTime.HomeTime();
1.837 +
1.838 + r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
1.839 + FailIfError(r);
1.840 +
1.841 + endTime.HomeTime();
1.842 + timeTaken=endTime.MicroSecondsFrom(startTime);
1.843 + DoTestKill();
1.844 +
1.845 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.846 + file.Close();
1.847 + }
1.848 + }
1.849 +
1.850 + PrintResult(aStep, 1, aN);
1.851 + PrintResultTime(aStep, 2, timeTaken1);
1.852 + PrintResultTime(aStep, 3, timeTaken2);
1.853 + PrintResultTime(aStep, 4, timeTaken3);
1.854 + }
1.855 +
1.856 +/** The test finds an entry in each directory
1.857 + Precondition: the drive is already filled with the right files
1.858 +
1.859 + @param aSelector Configuration in case of manual execution
1.860 +*/
1.861 +LOCAL_C TInt TestFindEntry(TAny* aSelector)
1.862 + {
1.863 + TInt i = 100;
1.864 + TInt testStep ;
1.865 +
1.866 + Validate(aSelector);
1.867 +
1.868 +
1.869 + test.Printf(_L("#~TS_Title_%d,%d: Find entry last.txt, TFindFile\n"), gTestHarness, gTestCase);
1.870 +
1.871 + testStep = 1;
1.872 + while(i <= KMaxFiles)
1.873 + {
1.874 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.875 + FindFile1(i, testStep++);
1.876 + i += 100;
1.877 + }
1.878 +
1.879 + gTestCase++;
1.880 + test.Printf(_L("#~TS_Title_%d,%d: Find entry last.txt, RFile::Open \n"), gTestHarness, gTestCase);
1.881 +
1.882 + i = 100;
1.883 + testStep = 1;
1.884 + while(i <= KMaxFiles)
1.885 + {
1.886 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.887 + FindFile2(i, testStep++);
1.888 + i += 100;
1.889 + }
1.890 +
1.891 + gTestCase++;
1.892 + return(KErrNone);
1.893 + }
1.894 +
1.895 +/** The test finds an entry in each directory with multiple clients accessing the same directory
1.896 + Precondition: the drive is already filled with the right files
1.897 +
1.898 + @param aSelector Configuration in case of manual execution
1.899 +*/
1.900 +LOCAL_C TInt TestFindEntryMultipleClients(TAny* aSelector)
1.901 + {
1.902 + TInt i=100;
1.903 + TInt testStep;
1.904 +
1.905 + Validate(aSelector);
1.906 +
1.907 + test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing same directory, TFindFile\n"), gTestHarness, gTestCase);
1.908 +
1.909 + i = 100;
1.910 + testStep = 1;
1.911 + while(i <= KMaxFiles)
1.912 + {
1.913 + if(i == 100 || i==1000 || i==5000 || i==10000)
1.914 + FindFileM1(i, testStep++);
1.915 + i+=100;
1.916 + }
1.917 +
1.918 + gTestCase++;
1.919 + test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing same directory, RFile::Open \n"), gTestHarness, gTestCase);
1.920 +
1.921 + i=100;
1.922 + testStep = 1;
1.923 + while(i <= KMaxFiles)
1.924 + {
1.925 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.926 + FindFileM2(i, testStep++);
1.927 + i += 100;
1.928 + }
1.929 +
1.930 + gTestCase++;
1.931 + return(KErrNone);
1.932 + }
1.933 +
1.934 +/** The test finds an entry in each directory with multiple clients accessing different directories
1.935 + Precondition: the drive is already filled with the right files
1.936 +
1.937 + @param aSelector Configuration in case of manual execution
1.938 +*/
1.939 +LOCAL_C TInt TestFindEntryMultipleClientsDD(TAny* aSelector)
1.940 + {
1.941 + TInt i=100;
1.942 + TInt testStep;
1.943 +
1.944 + Validate(aSelector);
1.945 +
1.946 + test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing dif directory, TFindFile\n"), gTestHarness, gTestCase);
1.947 +
1.948 + i = 100;
1.949 + testStep = 1;
1.950 + while(i <= KMaxFiles)
1.951 + {
1.952 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.953 + FindFileMD1(i, testStep++);
1.954 + i += 100;
1.955 + }
1.956 +
1.957 + gTestCase++;
1.958 + test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing dir directory, RFile::Open \n"), gTestHarness, gTestCase);
1.959 +
1.960 + i = 100;
1.961 + testStep = 1;
1.962 + while(i <= KMaxFiles)
1.963 + {
1.964 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.965 + FindFileMD2(i, testStep++);
1.966 + i += 100;
1.967 + }
1.968 +
1.969 + gTestCase++;
1.970 + return(KErrNone);
1.971 + }
1.972 +
1.973 +/** Find last.txt with TFindFile and with two threads accessing the 2 directories
1.974 +
1.975 + @param aN Number of files in the directory
1.976 + @param aWild Wildcard string to be used in the search
1.977 + @param aStep Test step
1.978 +*/
1.979 +LOCAL_C void FindFileWild1(TInt aN, const TDesC& aWild, TInt aStep)
1.980 + {
1.981 + TBuf16<100> dir1;
1.982 + TBuf16<100> dir2;
1.983 + TBuf16<100> dir3;
1.984 + TBuf16<100> dir4;
1.985 +
1.986 + CDir* dir;
1.987 + TInt r = 0;
1.988 +
1.989 + TFindFile find(TheFs);
1.990 +
1.991 + TTime startTime;
1.992 + TTime endTime;
1.993 + TTimeIntervalMicroSeconds timeTaken(0);
1.994 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.995 +
1.996 + if(aN <= gFilesLimit)
1.997 + {
1.998 + dir1 = gSessionPath;
1.999 + dir2 = gSessionPath;
1.1000 + dir3 = gSessionPath;
1.1001 +
1.1002 + dir4.Format(KDirMultipleName2, 1, aN);
1.1003 + dir1.Append(dir4);
1.1004 +
1.1005 + dir4.Format(KDirMultipleName2, 2, aN);
1.1006 + dir2.Append(dir4);
1.1007 +
1.1008 + dir4.Format(KDirMultipleName2, 3, aN);
1.1009 + dir3.Append(dir4);
1.1010 +
1.1011 + if(gTypes >= 1)
1.1012 + {
1.1013 + dir4.Format(KDirMultipleName, 1, aN);
1.1014 + startTime.HomeTime();
1.1015 +
1.1016 + r = find.FindWildByPath(aWild, &dir1, dir);
1.1017 + FailIfError(r);
1.1018 +
1.1019 + endTime.HomeTime();
1.1020 +
1.1021 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1022 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1023 + delete dir;
1.1024 + }
1.1025 +
1.1026 + if(gTypes >= 2)
1.1027 + {
1.1028 + startTime.HomeTime();
1.1029 +
1.1030 + r = find.FindWildByPath(_L("*.txt"), &dir2, dir);
1.1031 + FailIfError(r);
1.1032 +
1.1033 + endTime.HomeTime();
1.1034 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1035 +
1.1036 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1037 + delete dir;
1.1038 + }
1.1039 +
1.1040 + if(gTypes >= 3)
1.1041 + {
1.1042 + startTime.HomeTime();
1.1043 +
1.1044 + r = find.FindWildByPath(_L("*.txt"), &dir3, dir);
1.1045 + FailIfError(r);
1.1046 +
1.1047 + endTime.HomeTime();
1.1048 + timeTaken=endTime.MicroSecondsFrom(startTime);
1.1049 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1050 + delete dir;
1.1051 + }
1.1052 + }
1.1053 +
1.1054 + PrintResult(aStep, 1, aN);
1.1055 + PrintResultTime(aStep, 2, timeTaken1);
1.1056 + PrintResultTime(aStep, 3, timeTaken2);
1.1057 + PrintResultTime(aStep, 4, timeTaken3);
1.1058 + }
1.1059 +
1.1060 +/** Find last.txt with TFindFile and with two threads accessing the 2 directories
1.1061 +
1.1062 + @param aN Number of files in the directory
1.1063 + @param aWild Wildcard string to be used in the search
1.1064 + @param aStep Test step
1.1065 +*/
1.1066 +LOCAL_C void FindFileWild2(TInt aN, const TDesC& aWild, TInt aStep)
1.1067 + {
1.1068 + TBuf16<100> dir1;
1.1069 + TBuf16<100> dir2;
1.1070 + TBuf16<100> dir3;
1.1071 + TBuf16<100> dir4;
1.1072 + TBuf16<100> temp;
1.1073 +
1.1074 +
1.1075 + TInt r = 0;
1.1076 + TFindFile find(TheFs);
1.1077 + TTime startTime;
1.1078 + TTime endTime;
1.1079 + TTimeIntervalMicroSeconds timeTaken(0);
1.1080 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.1081 +
1.1082 + CDir* dir;
1.1083 +
1.1084 + if(aN <= gFilesLimit)
1.1085 + {
1.1086 + dir1 = gSessionPath;
1.1087 + dir2 = gSessionPath;
1.1088 + dir3 = gSessionPath;
1.1089 +
1.1090 + dir4.Format(KDirMultipleName2, 1, aN);
1.1091 + dir1.Append(dir4);
1.1092 +
1.1093 + dir4.Format(KDirMultipleName2, 2, aN);
1.1094 + dir2.Append(dir4);
1.1095 +
1.1096 + dir4.Format(KDirMultipleName2, 3, aN);
1.1097 + dir3.Append(dir4);
1.1098 +
1.1099 + gFindDir = dir1;
1.1100 +
1.1101 + if(gTypes >= 1)
1.1102 + {
1.1103 + temp = dir1;
1.1104 + temp.Append(KCommonFile);
1.1105 +
1.1106 + gFindEntryDir = temp;
1.1107 + DoTest(FindEntryAccess);
1.1108 +
1.1109 + startTime.HomeTime();
1.1110 +
1.1111 + r = find.FindWildByPath(aWild, &dir1, dir);
1.1112 + FailIfError(r);
1.1113 +
1.1114 + endTime.HomeTime();
1.1115 + DoTestKill();
1.1116 + delete dir;
1.1117 +
1.1118 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1119 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1120 + }
1.1121 +
1.1122 + if(gTypes >= 2)
1.1123 + {
1.1124 + gFindDir = dir2;
1.1125 + temp = dir2;
1.1126 + temp.Append(KCommonFile);
1.1127 +
1.1128 + gFindEntryDir = temp;
1.1129 +
1.1130 +
1.1131 + DoTest(FindEntryAccess);
1.1132 +
1.1133 + startTime.HomeTime();
1.1134 +
1.1135 + r = find.FindWildByPath(aWild, &dir2, dir);
1.1136 + FailIfError(r);
1.1137 +
1.1138 + endTime.HomeTime();
1.1139 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1140 + DoTestKill();
1.1141 + delete dir;
1.1142 +
1.1143 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1144 + }
1.1145 +
1.1146 + if(gTypes >= 3)
1.1147 + {
1.1148 + gFindDir = dir3;
1.1149 + temp = dir3;
1.1150 + temp.Append(KCommonFile);
1.1151 +
1.1152 + gFindEntryDir = temp;
1.1153 + DoTest(FindEntryAccess);
1.1154 +
1.1155 + startTime.HomeTime();
1.1156 +
1.1157 + r = find.FindWildByPath(aWild, &dir3, dir);
1.1158 + FailIfError(r);
1.1159 +
1.1160 + endTime.HomeTime();
1.1161 + DoTestKill();
1.1162 + delete dir;
1.1163 +
1.1164 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1165 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1166 + }
1.1167 + }
1.1168 +
1.1169 + PrintResult(aStep, 1, aN);
1.1170 + PrintResultTime(aStep, 2, timeTaken1);
1.1171 + PrintResultTime(aStep, 3, timeTaken2);
1.1172 + PrintResultTime(aStep, 4, timeTaken3);
1.1173 + }
1.1174 +
1.1175 +/** Find last.txt with TFindFile and with two threads accessing the 2 directories
1.1176 +
1.1177 + @param aN Number of files in the directory
1.1178 + @param aWild Wildcard string to be used in the search
1.1179 + @param aStep Test step
1.1180 +*/
1.1181 +LOCAL_C void FindFileWild3(TInt aN, const TDesC& aWild, TInt aStep)
1.1182 + {
1.1183 + TBuf16<100> dir1;
1.1184 + TBuf16<100> dir2;
1.1185 + TBuf16<100> dir3;
1.1186 + TBuf16<100> dir4;
1.1187 + TBuf16<100> temp;
1.1188 + TBuf16<100> temp2;
1.1189 +
1.1190 + TInt r = 0;
1.1191 + TFindFile find(TheFs);
1.1192 + TTime startTime;
1.1193 + TTime endTime;
1.1194 + TTimeIntervalMicroSeconds timeTaken(0);
1.1195 + TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1.1196 +
1.1197 + CDir* dir;
1.1198 +
1.1199 + if(aN <= gFilesLimit)
1.1200 + {
1.1201 + dir1 = gSessionPath;
1.1202 + dir2 = gSessionPath;
1.1203 + dir3 = gSessionPath;
1.1204 +
1.1205 + dir4.Format(KDirMultipleName2, 1, aN);
1.1206 + dir1.Append(dir4);
1.1207 +
1.1208 + temp=gSessionPath;
1.1209 + dir4.Format(KDirMultipleName, 3, 300);
1.1210 +
1.1211 + temp.Append(dir4);
1.1212 + gFindDir = dir1;
1.1213 + gFindDir2 = temp;
1.1214 +
1.1215 + temp2 = gFindDir;
1.1216 + temp2.Append(KCommonFile);
1.1217 + gFindEntryDir = temp2;
1.1218 + temp2 = gFindDir2;
1.1219 + temp2.Append(KCommonFile);
1.1220 + gFindEntryDir2 = temp2;
1.1221 +
1.1222 + if(gTypes >= 1)
1.1223 + {
1.1224 + DoTest2(FindEntryAccess);
1.1225 +
1.1226 + dir4.Format(KDirMultipleName, 1, aN);
1.1227 + startTime.HomeTime();
1.1228 +
1.1229 + r = find.FindWildByPath(aWild, &dir1, dir);
1.1230 + FailIfError(r);
1.1231 +
1.1232 + endTime.HomeTime();
1.1233 + DoTestKill();
1.1234 + delete dir;
1.1235 +
1.1236 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1237 + timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1238 + }
1.1239 +
1.1240 + if(gTypes >= 2)
1.1241 + {
1.1242 + dir4.Format(KDirMultipleName2, 2, aN);
1.1243 + dir2.Append(dir4);
1.1244 +
1.1245 + temp = dir2;
1.1246 + temp.Append(KCommonFile);
1.1247 + gFindDir = dir2;
1.1248 + gFindEntryDir = temp;
1.1249 +
1.1250 + DoTest2(FindEntryAccess);
1.1251 +
1.1252 + startTime.HomeTime();
1.1253 +
1.1254 + r = find.FindWildByPath(aWild, &dir2, dir);
1.1255 + FailIfError(r);
1.1256 +
1.1257 + endTime.HomeTime();
1.1258 + DoTestKill();
1.1259 + delete dir;
1.1260 +
1.1261 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1262 + timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1263 + }
1.1264 +
1.1265 + if(gTypes >= 3)
1.1266 + {
1.1267 + dir4.Format(KDirMultipleName2, 3, aN);
1.1268 + dir3.Append(dir4);
1.1269 +
1.1270 + temp = dir3;
1.1271 + temp.Append(KCommonFile);
1.1272 + gFindDir = dir3;
1.1273 + gFindEntryDir = temp;
1.1274 +
1.1275 + DoTest2(FindEntryAccess);
1.1276 +
1.1277 + startTime.HomeTime();
1.1278 +
1.1279 + r = find.FindWildByPath(aWild, &dir3, dir);
1.1280 + FailIfError(r);
1.1281 +
1.1282 + endTime.HomeTime();
1.1283 + DoTestKill();
1.1284 + delete dir;
1.1285 +
1.1286 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.1287 + timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1.1288 + }
1.1289 + }
1.1290 +
1.1291 + PrintResult(aStep, 1, aN);
1.1292 + PrintResultTime(aStep, 2, timeTaken1);
1.1293 + PrintResultTime(aStep, 3, timeTaken2);
1.1294 + PrintResultTime(aStep, 4, timeTaken3);
1.1295 + }
1.1296 +
1.1297 +/** Times the system when looking for files with patterns
1.1298 +
1.1299 + @param aSelector Configuration in case of manual execution
1.1300 +*/
1.1301 +LOCAL_C TInt TestFileFindPattern(TAny* aSelector)
1.1302 + {
1.1303 + TInt i = 100;
1.1304 + TInt testStep;
1.1305 +
1.1306 + Validate(aSelector);
1.1307 +
1.1308 + test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1.1309 +
1.1310 + testStep = 1;
1.1311 + while(i <= KMaxFiles)
1.1312 + {
1.1313 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1314 + FindFileWild1(i,_L("*.txt"), testStep++);
1.1315 + i += 100;
1.1316 + }
1.1317 +
1.1318 + gTestCase++;
1.1319 + test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() multiple clients accessing same directory\n"), gTestHarness, gTestCase);
1.1320 +
1.1321 + i = 100;
1.1322 + testStep = 1;
1.1323 + while(i <= KMaxFiles)
1.1324 + {
1.1325 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1326 + FindFileWild2(i,_L("*.txt"), testStep++);
1.1327 + i += 100;
1.1328 + }
1.1329 +
1.1330 + gTestCase++;
1.1331 + test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1.1332 +
1.1333 + i = 100;
1.1334 + testStep = 1;
1.1335 + while(i <= KMaxFiles)
1.1336 + {
1.1337 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1338 + FindFileWild3(i,_L("*.txt"), testStep++);
1.1339 + i += 100;
1.1340 + }
1.1341 +
1.1342 + gTestCase++;
1.1343 + test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1.1344 +
1.1345 + i = 100;
1.1346 + testStep = 1;
1.1347 + while(i <= KMaxFiles)
1.1348 + {
1.1349 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1350 + FindFileWild1(i,_L("ffff*.txt"), testStep++);
1.1351 + i += 100;
1.1352 + }
1.1353 +
1.1354 + gTestCase++;
1.1355 + test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() mult clients access same directory\n"), gTestHarness, gTestCase);
1.1356 +
1.1357 + i = 100;
1.1358 + testStep = 1;
1.1359 + while(i <= KMaxFiles)
1.1360 + {
1.1361 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1362 + FindFileWild2(i,_L("ffff*.txt"), testStep++);
1.1363 + i += 100;
1.1364 + }
1.1365 +
1.1366 + gTestCase++;
1.1367 + test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1.1368 +
1.1369 + i = 100;
1.1370 + testStep = 1;
1.1371 + while(i <= KMaxFiles)
1.1372 + {
1.1373 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1374 + FindFileWild3(i,_L("ffff*.txt"), testStep++);
1.1375 + i += 100;
1.1376 + }
1.1377 +
1.1378 +
1.1379 + gTestCase++;
1.1380 + test.Printf(_L("\nFind last.*, TFindFile\n"));
1.1381 + test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1.1382 +
1.1383 + i = 100;
1.1384 + testStep = 1;
1.1385 + while(i<=KMaxFiles)
1.1386 + {
1.1387 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1388 + FindFileWild1(i,_L("last.*"), testStep++);
1.1389 + i += 100;
1.1390 + }
1.1391 +
1.1392 + gTestCase++;
1.1393 + test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() mult clients access same directory\n"), gTestHarness, gTestCase);
1.1394 +
1.1395 + i = 100;
1.1396 + testStep = 1;
1.1397 + while(i <= KMaxFiles)
1.1398 + {
1.1399 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1400 + FindFileWild2(i,_L("last.*"), testStep++);
1.1401 + i += 100;
1.1402 + }
1.1403 +
1.1404 + gTestCase++;
1.1405 + test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1.1406 +
1.1407 + i = 100;
1.1408 + testStep = 1;
1.1409 + while(i <= KMaxFiles)
1.1410 + {
1.1411 + if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1.1412 + FindFileWild3(i,_L("last.*"), testStep++);
1.1413 + i += 100;
1.1414 + }
1.1415 +
1.1416 + gTestCase++;
1.1417 + return(KErrNone);
1.1418 + }
1.1419 +
1.1420 +/** It goes automatically through all the options
1.1421 +
1.1422 + @param aSelector Configuration in case of manual execution
1.1423 +*/
1.1424 +LOCAL_C TInt TestAll(TAny* aSelector)
1.1425 + {
1.1426 + Validate(aSelector);
1.1427 +
1.1428 + TestFindEntry(aSelector);
1.1429 + TestFindEntryMultipleClients(aSelector);
1.1430 + TestFindEntryMultipleClientsDD(aSelector);
1.1431 + TestFileFindPattern(aSelector);
1.1432 +
1.1433 + return(KErrNone);
1.1434 + }
1.1435 +
1.1436 +/** Call all tests
1.1437 +
1.1438 +*/
1.1439 +GLDEF_C void CallTestsL()
1.1440 + {
1.1441 +
1.1442 + TInt r = client.CreateLocal(0);
1.1443 + FailIfError(r);
1.1444 +
1.1445 + CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
1.1446 +
1.1447 + // Each test case of the suite has an identifyer for parsing purposes of the results
1.1448 + gTestHarness = 3;
1.1449 + gTestCase = 1;
1.1450 +
1.1451 + CreateDirWithNFiles(300, 3);
1.1452 + PrintHeaders(1, _L("t_fsrdirscan. Directory scanning"));
1.1453 +
1.1454 + if(gMode==0)
1.1455 + { // Manual
1.1456 + gSessionPath=_L("?:\\");
1.1457 + TCallBack createFiles(TestFileCreate,TheSelector);
1.1458 + TCallBack findFile(TestFindEntry,TheSelector);
1.1459 + TCallBack findFileMC(TestFindEntryMultipleClients,TheSelector);
1.1460 + TCallBack findFileMCDD(TestFindEntryMultipleClientsDD,TheSelector);
1.1461 + TCallBack findFilePattern(TestFileFindPattern,TheSelector);
1.1462 + TheSelector->AddDriveSelectorL(TheFs);
1.1463 + TheSelector->AddLineL(_L("Create all files"),createFiles);
1.1464 + TheSelector->AddLineL(_L("Find filename"),findFile);
1.1465 + TheSelector->AddLineL(_L("Find with mult clients same directory"),findFileMC);
1.1466 + TheSelector->AddLineL(_L("Find with mult clients dif directories"),findFileMCDD);
1.1467 + TheSelector->AddLineL(_L("All using glob patterns"),findFilePattern);
1.1468 + TheSelector->Run();
1.1469 + }
1.1470 + else
1.1471 + { // Automatic
1.1472 + TestAll(TheSelector);
1.1473 + }
1.1474 +
1.1475 + client.Close();
1.1476 + test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
1.1477 + delete TheSelector;
1.1478 + }