os/kernelhwsrv/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <f32file.h>
sl@0
    17
#include <e32test.h>
sl@0
    18
#include <e32math.h>
sl@0
    19
#include <f32dbg.h>
sl@0
    20
#include "t_ms_main.h"
sl@0
    21
sl@0
    22
sl@0
    23
GLDEF_D RTest test(_L("T_MS_SCSI"));
sl@0
    24
sl@0
    25
//
sl@0
    26
// Do tests relative to session path
sl@0
    27
//
sl@0
    28
GLDEF_C void CallTestsL()
sl@0
    29
sl@0
    30
	{
sl@0
    31
	t_scsi_prot();
sl@0
    32
	}
sl@0
    33
sl@0
    34
//
sl@0
    35
// Do testing on aDrive
sl@0
    36
//
sl@0
    37
LOCAL_C void DoTests()
sl@0
    38
	{
sl@0
    39
	TRAPD(r,CallTestsL());
sl@0
    40
	if (r!=KErrNone)
sl@0
    41
		{
sl@0
    42
		test.Printf(_L("Error: Leave %d\n"),r);
sl@0
    43
		test(EFalse);
sl@0
    44
		}
sl@0
    45
	}
sl@0
    46
sl@0
    47
_LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
sl@0
    48
GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
sl@0
    49
	{
sl@0
    50
	if( aExpected != aValue )
sl@0
    51
		{
sl@0
    52
		TText filenameU[512];
sl@0
    53
		TUint i = 0;
sl@0
    54
		for (; (i < sizeof(filenameU)) && (aFileName[i] != (char)0); i++)
sl@0
    55
			{
sl@0
    56
			filenameU[i]=aFileName[i];
sl@0
    57
			}
sl@0
    58
		filenameU[i]=0;
sl@0
    59
		test.Printf( KValueTestFailMsg, aValue, aExpected );
sl@0
    60
		test.operator()( EFalse, aLine, &filenameU[0]);
sl@0
    61
		}
sl@0
    62
	}
sl@0
    63
sl@0
    64
sl@0
    65
GLDEF_C TInt E32Main()
sl@0
    66
    {
sl@0
    67
	CTrapCleanup* cleanup;
sl@0
    68
	cleanup=CTrapCleanup::New();
sl@0
    69
 	__UHEAP_MARK;
sl@0
    70
sl@0
    71
	test.Title();
sl@0
    72
	test.Start(_L("Starting tests..."));
sl@0
    73
sl@0
    74
	TTime timerC;
sl@0
    75
	timerC.HomeTime();
sl@0
    76
	
sl@0
    77
	DoTests();
sl@0
    78
sl@0
    79
	TTime endTimeC;
sl@0
    80
	endTimeC.HomeTime();
sl@0
    81
	TTimeIntervalSeconds timeTakenC;
sl@0
    82
	TInt r=endTimeC.SecondsFrom(timerC,timeTakenC);
sl@0
    83
	test(r==KErrNone);
sl@0
    84
	test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
sl@0
    85
	test.End();
sl@0
    86
	test.Close();
sl@0
    87
	__UHEAP_MARKEND;
sl@0
    88
	delete cleanup;
sl@0
    89
	return(KErrNone);
sl@0
    90
    }
sl@0
    91