os/kernelhwsrv/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 
    22 
    23 GLDEF_D RTest test(_L("T_MS_SCSI"));
    24 
    25 //
    26 // Do tests relative to session path
    27 //
    28 GLDEF_C void CallTestsL()
    29 
    30 	{
    31 	t_scsi_prot();
    32 	}
    33 
    34 //
    35 // Do testing on aDrive
    36 //
    37 LOCAL_C void DoTests()
    38 	{
    39 	TRAPD(r,CallTestsL());
    40 	if (r!=KErrNone)
    41 		{
    42 		test.Printf(_L("Error: Leave %d\n"),r);
    43 		test(EFalse);
    44 		}
    45 	}
    46 
    47 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
    48 GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
    49 	{
    50 	if( aExpected != aValue )
    51 		{
    52 		TText filenameU[512];
    53 		TUint i = 0;
    54 		for (; (i < sizeof(filenameU)) && (aFileName[i] != (char)0); i++)
    55 			{
    56 			filenameU[i]=aFileName[i];
    57 			}
    58 		filenameU[i]=0;
    59 		test.Printf( KValueTestFailMsg, aValue, aExpected );
    60 		test.operator()( EFalse, aLine, &filenameU[0]);
    61 		}
    62 	}
    63 
    64 
    65 GLDEF_C TInt E32Main()
    66     {
    67 	CTrapCleanup* cleanup;
    68 	cleanup=CTrapCleanup::New();
    69  	__UHEAP_MARK;
    70 
    71 	test.Title();
    72 	test.Start(_L("Starting tests..."));
    73 
    74 	TTime timerC;
    75 	timerC.HomeTime();
    76 	
    77 	DoTests();
    78 
    79 	TTime endTimeC;
    80 	endTimeC.HomeTime();
    81 	TTimeIntervalSeconds timeTakenC;
    82 	TInt r=endTimeC.SecondsFrom(timerC,timeTakenC);
    83 	test(r==KErrNone);
    84 	test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
    85 	test.End();
    86 	test.Close();
    87 	__UHEAP_MARKEND;
    88 	delete cleanup;
    89 	return(KErrNone);
    90     }
    91