void TMultipleSessionTest::testVolumeInfo(RTest& aTest)
//
//	Test volume info.
//
	{

	aTest.Next(_L("The volume info"));
	TInt r=iFs.SetSessionPath(iSessionPath);
	TDriveList list;
	r=iFs.DriveList(list);
	aTest(r==KErrNone);
	for (TInt i=0;i<KMaxDrives;i++)
		{
		TVolumeInfo v;
		if ((r=iFs.Volume(v,i))==KErrNone)
			{
			printDriveInfo(i,v.iDrive,aTest);
			aTest.Printf(_L("   VOL=\"%S\" ID=%08x\n"),&v.iName,v.iUniqueID);
			aTest.Printf(_L("   SIZE=%ldK FREE=%ldK\n"),v.iSize/1024,v.iFree/1024);
			}
		else if (r==KErrNotReady)
			aTest.Printf(_L("%c: Not Ready\n"),i+'A');
		else if (r==KErrPathNotFound)
			aTest.Printf(_L("%c: Not Found\n"),i+'A');
		else
			{
			aTest.Printf(_L("%c: Error %d\n"),i+'A',r);
			aTest.Getch();
			}
		aTest.Printf(_L("\n"));
		}
	}
Exemple #2
0
GLDEF_C TInt E32Main()
	{
	test.Title();
	TInt r=User::LoadLogicalDevice(_L("D_PROF"));
	if (r!=KErrNone && r!=KErrAlreadyExists)
		User::Panic(_L("T_PROF0"),r);
	r=Profile.Open();
	if (r!=KErrNone)
		User::Panic(_L("T_PROF1"),r);
	FOREVER
		{
		TKeyCode key=test.Getch();
		if (key==TKeyCode('r'))
			{
			Profile.Reset();
			}
		else if (key==TKeyCode('p'))
			{
			ProfileAllThreads();
			}
		else if (key==TKeyCode('x'))
			break;
		}
	Profile.Close();
	User::FreeLogicalDevice(_L("Profile"));
	return KErrNone;
	}
void TMultipleSessionTest::FillUpDisk(RTest& aTest)
//
//	Test that a full disk is ok
//
	{

	aTest.Next(_L("Fill disk to capacity"));
	TInt r=iFs.SetSessionPath(iSessionPath);
	r=iFs.MkDirAll(_L("\\MULTIPLE_SESSION_TEST\\BIGDIRECTORY\\"));
	if	(CurrentDrive(aTest)!=EDriveQ)	//	T_REMFSY may return incorrect result on WINS
		aTest(r==KErrNone || r==KErrAlreadyExists);
	TInt count=0;
	TFileName sessionPath;
	r=iFs.SessionPath(sessionPath);
	test(sessionPath==iSessionPath);
	aTest(r==KErrNone);
	TBuf<128> fileName=_L("\\MULTIPLE_SESSION_TEST\\BIGDIRECTORY\\FILE");
	FOREVER
		{
		TInt r=CreateFileX(fileName,count,iFs, aTest);
		if (r==KErrDiskFull)
			break;
		aTest(r==KErrNone);
		count++;
 #if defined(__WINS__)
		if (count==32 && sessionPath[0]=='C') // Don't fill up disk on NT
			break;
 #endif
		}

	r=iFs.CheckDisk(fileName);
	if (r!=KErrNone && r!=KErrNotSupported)
		{
		aTest.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
		aTest.Getch();
		}

	while(count--)
		DeleteFileX(fileName,count,iFs,CurrentDrive(aTest),aTest);

	r=iFs.CheckDisk(fileName);
	if (r!=KErrNone && r!=KErrNotSupported)
		{
		aTest.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
		aTest.Getch();
		}
	}
// Manual test - requires user to move a card between two physical slots
extern TInt E32Main()
	{
	test.Start(_L("T_MULTISLOT Test"));
	test(fs.Connect()==KErrNone);
	
	// Get the list of removable drive driver-letters
	TDriveList driveList;
	test(fs.DriveList(driveList,KDriveAttRemovable)==KErrNone);
	
	
	TInt length=driveList.Length();
	TBool pass = EFalse;
	
	// i is drive letter (as int)
	// for every removable media logical drive
	for(TInt i=0; i<length; i++)
		{
		if(driveList[i] == 0)
			{
			continue;
			}

		TChar driveChar = i+'A';
		test.Next(_L("Testing Logical Drive"));
		

		TInt FirstlocDrvNum = KErrNotFound;
		TInt SecondlocDrvNum = KErrNotFound;
		TInt driveNum = -1;
		driveNum = i+'A';
		test.Printf(_L("Logical Drive : %d"), driveNum);
		
		// Get local drive number by gettin ghr Serial number fo the card (RFs call), then 
		// enumerating the TBusLocalDrives and finding one that matches.
		test(FindMmcLocalDriveNumber(driveChar,FirstlocDrvNum,driveNum)==KErrNone);
		// Got first local drive number, now move card into second slot.
		test.Printf(_L("<Move MMC Card to second slot, then press any key>"));
		test.Getch();
		// Get second local drive number for same logical drive (should be different local drive number).
		test(FindMmcLocalDriveNumber(driveChar,SecondlocDrvNum,driveNum)==KErrNone);
		if(FirstlocDrvNum!=SecondlocDrvNum)
			{
			pass=ETrue;
			break;
			}
		// else perhaps this wasn't a multislot drive
		}
	test(pass);
	test.End();
	test.Close();
	
	fs.Close();
	return KErrNone;
	}
Exemple #5
0
void __DoTest(TBool aCondition, char* aFile, TInt aLine, TInt aErr)
	{
	if (aCondition)
		return;
		
	if (aErr==0)
		Test.Printf(_L("\r\nCheckpoint Fail at %s:%d\r\n"), aFile, aLine);
	else
		Test.Printf(_L("\r\nCheckpoint Fail at %s:%d: Return code = %d (0x%x)\r\n"), aFile, aLine, aErr, aErr);
	__DEBUGGER();
	Test.Getch();
	User::Exit(aErr);
	}
LOCAL_C TInt CreateFileX(const TDesC& aBaseName,TInt aX, RFs iFs, RTest& aTest)
//
// Create a large file. Return KErrEof or KErrNone
//
	{

	TBuf<128> fileName=aBaseName;
	fileName.AppendNum(aX);

	RFile file;
	TInt r=file.Replace(iFs,fileName,EFileWrite);
	if (r==KErrDiskFull)
		return(r);
	if (r!=KErrNone)
		{
		aTest.Printf(_L("ERROR:: Replace returned %d\n"),r);
		aTest.Getch();
		return(KErrDiskFull);
		}
	r=file.SetSize(65536);
	if (r==KErrDiskFull)
		{
		file.Close();
		return(r);
		}
	if (r!=KErrNone)
		{
		aTest.Printf(_L("ERROR:: SetSize returned %d\n"),r);
		aTest.Getch();
		file.Close();
		return(KErrDiskFull);
		}
	file.Close();
	aTest.Printf(_L("Created file %d size 64k\n"),aX);
	return(KErrNone);
	}
GLDEF_C void ReportCheckDiskFailure(TInt aRet,RTest& aTest)
//
// Report the failure of checkdisk
//
	{

	aTest.Printf(_L("CHECKDISK FAILED: "));
	switch(aRet)
		{
	case 1:	aTest.Printf(_L("File cluster chain contains a bad value (<2 or >maxCluster)\n")); break;
	case 2:	aTest.Printf(_L("Two files are linked to the same cluster\n")); break;
	case 3:	aTest.Printf(_L("Unallocated cluster contains a value != 0\n"));	break;
	case 4:	aTest.Printf(_L("Size of file != number of clusters in chain\n")); break;
	default: aTest.Printf(_L("Undefined Error value %d\n"),aRet);
		}
	aTest.Printf(_L("Press any key to continue\n"));
	aTest.Getch();
	}
TInt E32Main()
	{
	User::SetJustInTime(ETrue);
	__UHEAP_MARK;
	CTrapCleanup* cleanupStack=CTrapCleanup::New();

	LoadLDD_PDD();
	TRAPD(err,RunTestL());	//	Ignore err

	if (err != KErrNone)
		{
		test.Printf(_L("Error %d"), err);
		test.Getch();
		}

	test.Close();
	delete cleanupStack;
	__UHEAP_MARKEND;
   	
	return err;
	}
GLDEF_C TInt E32Main()
//
// Test NanoWait() delays
//
    {

    
    // To use in command line
    	TBool pause = EFalse;
    TBuf<256> cmdline;
	User::CommandLine(cmdline);
	if( cmdline == _L("-p"))
		{
			pause = ETrue;			
		}

    
	test.Title();

	test.Start(_L("Load D_NanoWait.LDD"));
	TInt r=User::LoadLogicalDevice(KLddFileName);
	TEST(r==KErrNone || r==KErrAlreadyExists);
	
	test.Next(_L("Test NanoWait delay"));
	r=nanowait.Open();
	CHECK(r);

	TInt requested = 100000000;  // nsec = 100 msec
	TUint32 startTick;
	TUint32 endTick;
	
	TInt nanokernel_tick_period;
	HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period );
	nanokernel_tick_period *= 1000; 	// convert from micro sec to nsec

	
	test.Printf(_L("Test parameters: total requested:%d nsec\n"), requested);
	
	startTick = User::NTickCount();
	r=nanowait.StartNanoWait(1, requested);
	endTick = User::NTickCount();
	
	startTick *= nanokernel_tick_period;	// in nsec
	endTick   *= nanokernel_tick_period;	// in nsec
	
	TInt measured  = endTick-startTick;
	TInt diff = measured - requested;
	test.Printf(_L("Requested delay:%10d nsec\n"), requested);
	test.Printf(_L("Measured delay :%10d nsec\n"), measured);
	test.Printf(_L("Difference     :%10d nsec\n"), diff);
	
	
	test.End();
	if( pause )
		{
		test.Printf(_L("Press any key\n"));
		test.Getch();	
		}
	
	return(KErrNone);
    }
Exemple #10
0
TInt E32Main()
	{
	TInt err;
	
	Test.Start(_L("Comm Driver Tests"));
	CommStart();
    Test.Printf(_L("Insert plug in then press a key\r\n"));
	Test.Getch();

	TEST(CTrapCleanup::New()!=NULL);
	CActiveScheduler* Scheduler = new CActiveScheduler;
	TEST(Scheduler!=NULL);
	CActiveScheduler::Install(Scheduler);
/*
	CTestSignals* testsignals = NULL;
	TRAP(err, testsignals = CTestSignals::NewL(0));
	TEST(err==KErrNone);
	testsignals->Start();
	Scheduler->Start();
	delete testsignals;
	
	CTestRandTerm* testrandterm = NULL;
	TRAP(err, testrandterm = CTestRandTerm::NewL(0));
	TEST(err==KErrNone);
	testrandterm->Start();
	Scheduler->Start();
	delete testrandterm;

	CTestPerf* testperf = NULL;
	TRAP(err, testperf = CTestPerf::NewL(0));
	TEST(err==KErrNone);
	testperf->Start();
	Scheduler->Start();
	delete testperf;
*/

	CTestXonXoff* testx = NULL;
	TRAP(err, testx = CTestXonXoff::NewL(0));
	TEST(err==KErrNone);
	testx->Start();
	Scheduler->Start();
	delete testx;

/*
	CTestXonXoff* testx1 = NULL;
	TRAP(err, testx1 = CTestXonXoff::NewL(0));
	TEST(err==KErrNone);
	testx1->Start();

	CTestXonXoff* testx2 = NULL;
	TRAP(err, testx2 = CTestXonXoff::NewL(1));
	TEST(err==KErrNone);
	testx2->Start();

	Scheduler->Start();

	delete testx1;
	delete testx2;
*/
	Test.End();
	return KErrNone;
	}
void TestCL(RTest& test, CSdpDatabase *aDb)
	{
	test.Start(_L("Test C -- continuation stress test"));

	gSdpTestDatabase = aDb;
	gSdpTestDatabase->EncodeDbL();

	sdp_debug_level = 1;  // wind the noise down - this works
	test.Printf(_L("SS for KSdpContTestUUID\n"));
	TUint8 requestdata00a[] = {
		0x35, 0x03, 0x19, 0x01, 0x00,	// UUID list
		0xff, 0xff,						// max handles
		0x00							// continuation
		};

	TUint tCount = testSdpContL(test, requestdata00a, sizeof(requestdata00a), KServiceSearchRequest, /*TUint8* aRespData,*/ DUMMTU);
	test.Printf(_L("SS for KSdpContTestUUID %d continuations\n"), tCount);
	test.Getch();

	test.Printf(_L("AR for all attributes\n"));
	TUint8 requestdata01[] = {
		0x00, 0x00, 0x00, 0x00,			// handle
		0x01, 0x00,						// max bytes
		0x35, 0x05,						// DES header attrib list
		0x0a, 0x00, 0x00, 0xff, 0xff,	// attribute ID range 0000 to ffff
		0x00							// continuation
		};
	tCount = testSdpContL(test, requestdata01, sizeof(requestdata01), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU);
	test.Printf(_L("AR for all attributes, handle 00000000 %d continuations\n"), tCount);
	test.Getch();

	test.Printf(_L("AR for all attributes\n"));
	TUint8 requestdata02[] = {
		0x00, 0x01, 0x00, 0x00,			// handle
		0x01, 0x00,						// max bytes
		0x35, 0x05,						// DES header attrib list
		0x0a, 0x00, 0x00, 0xff, 0xff,	// attribute ID range 0000 to ffff
		0x00							// continuation
		};
	tCount = testSdpContL(test, requestdata02, sizeof(requestdata02), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU);
	test.Printf(_L("AR for all attributes, handle 00010000 %d continuations\n"), tCount);
	test.Getch();

	test.Printf(_L("AR for attribute 0004\n"));
	TUint8 requestdata03[] = {
		0x00, 0x01, 0x00, 0x00,			// handle
		0x01, 0x00,						// max bytes
		0x35, 0x03,						// DES header attrib list
		0x09, 0x00, 0x04,				// attribute ID 0004
		0x00							// continuation
		};
	tCount = testSdpContL(test, requestdata03, sizeof(requestdata03), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU);
	test.Printf(_L("AR for attribute 0004, handle 00010000 %d continuations\n"), tCount);
	test.Getch();

	test.Printf(_L("AR for all attributes\n"));
	TUint8 requestdata04[] = {
		0x00, 0x01, 0x00, 0x03e,		// handle
		0x01, 0x00,						// max bytes
		0x35, 0x05,						// DES header attrib list
		0x0a, 0x00, 0x00, 0xff, 0xff,	// attribute ID range 0000 to ffff
		0x00							// continuation
		};
	tCount = testSdpContL(test, requestdata04, sizeof(requestdata04), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU);
	test.Printf(_L("AR for all attributes, handle 0001003e %d continuations\n"), tCount);
	test.Getch();

	sdp_debug_level = 5;

	test.Printf(_L("SAS for all attributes\n"));
	TUint8 requestdata05[] = {
		0x35, 0x03, 0x19, 0x01, 0x00,	// UUID list
		0x01, 0x00,						// max byte count
		0x35, 0x05,						// DES header attrib list
		0x0a, 0x00, 0x00, 0xff, 0xff,	// attribute ID range 0000 to ffff
		0x00							// continuation
		};
	tCount = testSdpContL(test, requestdata05, sizeof(requestdata05), KServiceAttSearchRequest, /*TUint8* aRespData,*/ DUMMTU);
//	tCount = testSdpCont(test, requestdata05, sizeof(requestdata05), KServiceAttSearchRequest, /*TUint8* aRespData,*/ 102);
	test.Printf(_L("SAS for all attributes, %d continuations\n"), tCount);
	test.Getch();
	
//	CleanupStack::PopAndDestroy(/*CSdpReqHandler*/);
	delete gSdpTestDatabase;
	gSdpTestDatabase = 0;
	test.End();
	}