kerneltest/f32test/bench/t_fsrcreatefiles.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2006-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 // f32test\bench\t_fsrcreatefiles.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #include <f32file.h>
       
    20 #include <e32test.h>
       
    21 #include "t_benchmain.h"
       
    22 
       
    23 GLDEF_D RTest test(_L("File Server Benchmarks, create files"));
       
    24 LOCAL_D TDriveList gDriveList;
       
    25 
       
    26 /** Creates files
       
    27 
       
    28 	@param aSelector Configuration in case of manual execution
       
    29 */
       
    30 LOCAL_C TInt TestAll(TAny* aSelector)
       
    31 	{
       
    32 	TInt r = 0;
       
    33 	TTime startTime;
       
    34 	TTime endTime;
       
    35 	TTimeIntervalSeconds timeTaken;
       
    36 
       
    37 	Validate(aSelector);
       
    38 	
       
    39 	gFormat = EFalse; 	// The card won't be formatted after this test execution
       
    40 	
       
    41 	startTime.HomeTime();
       
    42 	
       
    43 	TestFileCreate(aSelector);
       
    44 	
       
    45 	endTime.HomeTime();
       
    46 	r = endTime.SecondsFrom(startTime, timeTaken);
       
    47 	FailIfError(r);
       
    48 	test.Printf(_L("#~TS_Timing_%d,%d=%d\n"), gTestHarness, gTestCase, timeTaken.Int());
       
    49 
       
    50 	return KErrNone;
       
    51 	}
       
    52 
       
    53 /** Call all tests
       
    54 
       
    55 */
       
    56 GLDEF_C void CallTestsL()
       
    57 	{
       
    58 
       
    59 	CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
       
    60 	// Each test case of the suite has an identifyer for parsing purposes of the results
       
    61 	gTestHarness = 0; 	
       
    62 
       
    63 	
       
    64 	if(gMode == 0) 
       
    65 		{ // Manual
       
    66 		gSessionPath=_L("?:\\");
       
    67 		TCallBack createFiles(TestFileCreate,TheSelector);
       
    68 		TheSelector->AddDriveSelectorL(TheFs);
       
    69 		TheSelector->AddLineL(_L("Create all files"),createFiles);
       
    70 		TheSelector->Run();
       
    71 		}
       
    72 	else 
       
    73 		{ // Automatic
       
    74 		TestAll(TheSelector);
       
    75 		}
       
    76 		
       
    77 	delete TheSelector;
       
    78 	}