os/kernelhwsrv/kerneltest/f32test/smassstorage/src/t_ms_main.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 //
    15 
    16 #include <f32file.h>
    17 #include <e32test.h>
    18 #include <e32math.h>
    19 #include <f32dbg.h>
    20 #include "t_ms_main.h"
    21 #include "mstestdatadef.h"
    22 
    23 GLDEF_D RTest test(_L("T_MS"));
    24 
    25 
    26 //
    27 // Do testing on aDrive
    28 //
    29 LOCAL_C void DoTests()
    30 	{
    31 	TRAPD(r,CallTestsL());
    32 	if (r!=KErrNone)
    33 		{
    34 		test.Printf(_L("Error: Leave %d\n"),r);
    35 		test(EFalse);
    36 		}
    37 	}
    38 
    39 
    40 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
    41 GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
    42 	{
    43 	if( aExpected != aValue )
    44 		{
    45 		TText filenameU[512];
    46 		TUint i = 0;
    47 		for (; (i < sizeof(filenameU)) && (aFileName[i] != (char)0); i++)
    48 			{
    49 			filenameU[i]=aFileName[i];
    50 			}
    51 		filenameU[i]=0;
    52 		test.Printf( KValueTestFailMsg, aValue, aExpected );
    53 		test.operator()( EFalse, aLine, &filenameU[0]);
    54 		}
    55 	}
    56 
    57 
    58 //
    59 // Test with drive nearly full
    60 //
    61 GLDEF_C TInt E32Main()
    62     {
    63 	CTrapCleanup* cleanup;
    64 	cleanup=CTrapCleanup::New();
    65 	
    66 #ifndef __NO_HEAP_CHECK
    67  	__UHEAP_MARK;
    68 #endif
    69 
    70 	test.Title();
    71 	test.Start(_L("Starting tests..."));
    72 
    73 	TTime timerC;
    74 	timerC.HomeTime();
    75 	
    76 	DoTests();
    77 
    78 	TTime endTimeC;
    79 	endTimeC.HomeTime();
    80 	TTimeIntervalSeconds timeTakenC;
    81 	TInt r=endTimeC.SecondsFrom(timerC,timeTakenC);
    82 	test(r==KErrNone);
    83 	test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
    84 	test.End();
    85 	test.Close();
    86 
    87 #ifndef __NO_HEAP_CHECK
    88 	__UHEAP_MARKEND;
    89 #endif
    90 
    91 	delete cleanup;
    92 	return(KErrNone);
    93     }
    94