os/kernelhwsrv/kerneltest/f32test/rofs/src/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) 2000-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
// Main entry point for the tests
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32std.h>
sl@0
    19
#include <e32std_private.h>
sl@0
    20
#include <f32file.h>
sl@0
    21
#include <e32test.h>
sl@0
    22
sl@0
    23
sl@0
    24
#if defined(_DEBUG)
sl@0
    25
#define __PRINT(t) {RDebug::Print(t);}
sl@0
    26
#define __PRINT1(t,a) {RDebug::Print(t,a);}
sl@0
    27
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
sl@0
    28
#else
sl@0
    29
#define __PRINT(t)
sl@0
    30
#define __PRINT1(t,a)
sl@0
    31
#define __PRINT2(t,a,b)
sl@0
    32
#endif
sl@0
    33
sl@0
    34
GLREF_C void DoTestL(TInt aDriveToTest);
sl@0
    35
sl@0
    36
GLREF_D RTest	test;
sl@0
    37
sl@0
    38
//_LIT( KRofsFilesystemName, "Rofs" ); // Comment out warning
sl@0
    39
sl@0
    40
GLDEF_D RFs TheFs;
sl@0
    41
GLDEF_D TChar gDriveToTest;
sl@0
    42
sl@0
    43
void ParseCommandArguments()
sl@0
    44
//
sl@0
    45
//
sl@0
    46
//
sl@0
    47
	{
sl@0
    48
	TBuf<0x100> cmd;
sl@0
    49
	User::CommandLine(cmd);
sl@0
    50
	TLex lex(cmd);
sl@0
    51
	TPtrC token=lex.NextToken();
sl@0
    52
	TFileName thisfile=RProcess().FileName();
sl@0
    53
	if (token.MatchF(thisfile)==0)
sl@0
    54
		{
sl@0
    55
		token.Set(lex.NextToken());
sl@0
    56
		}
sl@0
    57
	test.Printf(_L("CLP=%S"),&token);
sl@0
    58
	if(token.Length()!=0)		
sl@0
    59
		{
sl@0
    60
		gDriveToTest=token[0];
sl@0
    61
		gDriveToTest.UpperCase();
sl@0
    62
		}
sl@0
    63
	else
sl@0
    64
		{
sl@0
    65
#ifdef __WINS__
sl@0
    66
		gDriveToTest='V';
sl@0
    67
#else
sl@0
    68
		gDriveToTest='J';
sl@0
    69
#endif
sl@0
    70
		}
sl@0
    71
	}
sl@0
    72
sl@0
    73
GLDEF_C TInt E32Main()
sl@0
    74
	{
sl@0
    75
	CTrapCleanup* cleanup;
sl@0
    76
	cleanup=CTrapCleanup::New();
sl@0
    77
sl@0
    78
	ParseCommandArguments();
sl@0
    79
sl@0
    80
	TInt r=TheFs.Connect();
sl@0
    81
	__PRINT1(_L("Connect ret %d"),r);
sl@0
    82
	
sl@0
    83
	TInt theDrive;
sl@0
    84
	r=TheFs.CharToDrive(gDriveToTest,theDrive);
sl@0
    85
	__PRINT1(_L("Look up drive number returned %d"),r);
sl@0
    86
	
sl@0
    87
	if( KErrNone == r )
sl@0
    88
		{
sl@0
    89
		TRAP( r, DoTestL(theDrive) );
sl@0
    90
		}
sl@0
    91
sl@0
    92
    TheFs.Close();
sl@0
    93
sl@0
    94
	if( KErrNone != r )
sl@0
    95
		{
sl@0
    96
		test.Printf( _L("Failed with error %d\n"), r );
sl@0
    97
		}
sl@0
    98
sl@0
    99
#ifdef __WINS__
sl@0
   100
// The sin of sins for tests
sl@0
   101
//	test.Printf( _L("Press a key...") );
sl@0
   102
//	test.Getch();
sl@0
   103
#endif	
sl@0
   104
	delete cleanup;
sl@0
   105
    return r;
sl@0
   106
	}
sl@0
   107