1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/manager/t_locdrv.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,87 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\manager\t_locdrv.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32test.h>
1.22 +#include <e32svr.h>
1.23 +const TUint KMaxDriveFileLen=0x00020000;
1.24 +
1.25 +LOCAL_D RTest test(_L("T_LOCDRV"));
1.26 +
1.27 +GLDEF_C TInt E32Main()
1.28 + {
1.29 + TBusLocalDrive TheLocalDrives[KMaxLocalDrives];
1.30 + TBool isBoolean;
1.31 +
1.32 + test.Title();
1.33 + test.Start(_L("Test Local Drive Sw"));
1.34 +
1.35 + test.Next(_L("Connect - all drives"));
1.36 + TInt i=0;
1.37 + for (; i<KMaxLocalDrives; i++)
1.38 + TheLocalDrives[i].Connect(i,isBoolean);
1.39 +
1.40 + test.Next(_L("Caps - all drives"));
1.41 + TLocalDriveCaps info;
1.42 + for (i=0;i<KMaxLocalDrives;i++)
1.43 + {
1.44 + TInt r=TheLocalDrives[i].Caps(info);
1.45 + if (r==KErrNotSupported)
1.46 + test.Printf(_L("Drive %c: Not Supported\r\n"),(i+'A'));
1.47 + else if (r==KErrNone)
1.48 + test.Printf(_L("Drive %c size: %d\r\n"),(i+'A'),info.iSize );
1.49 + else
1.50 + {
1.51 + test.Printf(_L("Drive %c: Error %d\r\n"),(i+'A'),r);
1.52 + test.Getch();
1.53 + }
1.54 + }
1.55 +
1.56 + TBuf8<256> wrBuf(0x100);
1.57 + TBuf8<256> rdBuf(0X100);
1.58 +
1.59 + for (TInt j=0 ; j<0x100 ; j++)
1.60 + wrBuf[j]=(TUint8)j;
1.61 + for (i=0;i<KMaxLocalDrives;i++)
1.62 + {
1.63 + rdBuf.Fill(0,0x100);
1.64 + TInt r=TheLocalDrives[i].Write((KMaxDriveFileLen-0x100),wrBuf);
1.65 + test((r==KErrNone)||(r==KErrNotSupported));
1.66 + r=TheLocalDrives[i].Read((KMaxDriveFileLen-0x100),0x100,rdBuf);
1.67 + test((r==KErrNone)||(r==KErrNotSupported));
1.68 + r=rdBuf.Compare(wrBuf);
1.69 + test((r==KErrNone)||(r==KErrNotFound));
1.70 + test.Printf( _L("Drive %c Rd/Wr\r\n"),(i+'A'));
1.71 + }
1.72 +
1.73 + test.Next(_L("Drive A: Format"));
1.74 + for (i=0 ; i<0x100 ; i++)
1.75 + wrBuf[i]=0;
1.76 +
1.77 + TFormatInfo formatInfo;
1.78 +
1.79 + TInt r=TheLocalDrives[0].Format(formatInfo);
1.80 + test((r==KErrNone)||(r==KErrNotSupported));
1.81 + r=TheLocalDrives[0].Read((KMaxDriveFileLen-0x100),0x100,rdBuf);
1.82 + test((r==KErrNone)||(r==KErrNotSupported));
1.83 + r=rdBuf.Compare(wrBuf);
1.84 + test((r==KErrNone)||(r==KErrNotFound));
1.85 +
1.86 + test.End();
1.87 +
1.88 + return(0);
1.89 + }
1.90 +