Exemplo n.º 1
0
//----------------------------------------------------------------------------------------
LOCAL_C void InitTestUtils()
//----------------------------------------------------------------------------------------
	{
	testUtils = CBioTestUtils::NewLC(gTest,ETuCleanMessageFolder);
	gTest.Start(_L("CBIODatabase"));
	gTest.Console()->ClearScreen();
	}
Exemplo n.º 2
0
LOCAL_C void ProfileAllThreads()
	{
	TFindThread ft(_L("*"));
	TFullName fullname;
	test.Console()->ClearScreen();
	FOREVER
		{
		TInt r=ft.Next(fullname);
		if (r!=KErrNone)
			break;
		RThread t;
		r=t.Open(ft);
		if (r==KErrNone)
			{
			TProfileData data;
			r=Profile.Read(t,data);
			if (r==KErrNone)
				{
				while(fullname.Length()<40)
					fullname.Append(TChar(' '));
				test.Printf(_L("%S T=%9d C=%9d Y=%9d\n"),
					&fullname,data.iTotalCpuTime,data.iMaxContinuousCpuTime,data.iMaxTimeBeforeYield);
				}
			t.Close();
			}
		}
	}
Exemplo n.º 3
0
void UseKernelCpuTime()
{
    test.Start(_L("Create CCpuMeter"));
    CCpuMeter* m = CCpuMeter::New();
    test_NotNull(m);
    TInt iv = 1000500;	// on average 1000.5 ms
    TRequestStatus s;
    CConsoleBase* console = test.Console();
    console->Read(s);
    FOREVER
    {
        User::AfterHighRes(1000000);
        m->Measure();
        m->Display(iv);
        while (s!=KRequestPending)
        {
            User::WaitForRequest(s);
            TKeyCode k = console->KeyCode();
            if (k == EKeyEscape)
            {
                delete m;
                return;
            }
            if (m->iNumCpus > 1)
            {
                // SMP only options
                if (k == EKeySpace)
                    m->DisplayCoreControlInfo();
                else if (k>='1' && k<=('0'+m->iNumCpus))
                    m->ChangeNumberOfCores(k - '0');
            }
            console->Read(s);
        }
    }
}
Exemplo n.º 4
0
void CTestNbssMtm::ConstructL()
	{
	// connect to file system & create a BIO database
	User::LeaveIfError(iFs.Connect());

	iBioTestUtils = CBioTestUtils::NewL(test,ETuGoServerSide);

	iBioTestUtils->CreateServicesL();

	iBioTestUtils->InstantiateServerMtmsL();

	iNbssServerMtm = iBioTestUtils->iBioServerMtm;

	CActiveScheduler::Add(this); // add to active scheduler

	// create an entry selection
	iSelection= new (ELeave) CMsvEntrySelection;

	iNumFiles=0;
	iFilesProcessed=0;
	iMessagesCreated=0;
	iTestsSuccessful = ETrue;

	test.Console()->ClearScreen(); // get rid of menu
	}
Exemplo n.º 5
0
GLDEF_C TInt E32Main()
	{	
	__UHEAP_MARK;
	test.Start(_L("Setup"));
	theCleanup = CTrapCleanup::New();
	TRAPD(ret,doMainL());		
	test(ret==KErrNone);
	delete theCleanup;	
	test.Console()->SetPos(0, 13);
	test.End();
	test.Close();
	__UHEAP_MARKEND;
	return(KErrNone);
	}
Exemplo n.º 6
0
void CallTestsL(void)
	{
    //-- set up console output 
    F32_Test_Utils::SetConsole(test.Console()); 
    
    TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
    test_KErrNone(nRes);
    
    PrintDrvInfo(TheFs, gDriveNum);

    if(Is_SimulatedSystemDrive(TheFs, gDriveNum) || Is_Fat(TheFs, gDriveNum) || Is_Lffs(TheFs, gDriveNum))
        {
	    TestFilenameMatches();
        }
    else
        {
        test.Printf(_L("This test can't be performed on this file system. Skipping.\n"));
        }

	}
Exemplo n.º 7
0
GLDEF_C TInt E32Main()
	{
 	test.Title();
	test.Start(_L("Testing..."));
	__UHEAP_MARK;

	testSetup();

	TRAPD(error,doMainL());

	testUnsetup();

	test (error==KErrNone);

	test.Console()->Printf(_L("Done, press any key\n"));

	__UHEAP_MARKEND;
	test.End();
	return KErrNone;
	}
Exemplo n.º 8
0
/**
 * setup test environment, create CFailureTester object and run tests.
 * 
 * This is an OOM test. 
 * It tests 3 cases: 
 * (i) constructing CPushMessage with the arguments as member variables.
 * (ii) constructing CPushMessage with the arguments put on the cleanupstack.
 * (iii) constructing CPushHandlerBase 
 * Running Instructions:
 * 1. Build this test harness:	cd \wappush\pushutils\group
 *								bldmake bldfiles
 *								abld test build wins udeb t_failure
 * 2. Create log directories in	c:\logs\push 
 * 3. Run TFailure.exe:			cd \epoc32\release\wins\udeb
 *								tfailure -dtextshell -- 
 */
LOCAL_C void doMainL()
	{
	gTest.Start(KTestTitle);
			
	gTest.Printf(_L("@SYMTestCaseID IWS-WAPBROWSER-PUSHUTILS-T_FAILURE-0001 "));	
	
	CWapPushLog* log = CWapPushLog::NewL(*gTest.Console());
	log->SetLogFileName(_L("TFailure.txt"));
	CleanupStack::PushL(log);

	CFailureTester* myTester = CFailureTester::NewL(*log);
	CleanupStack::PushL(myTester);
	myTester->HeapFailureTest();
	myTester->InitSchedulerL();
	myTester->PluginHeapFailureTest();

	
	CleanupStack::PopAndDestroy(2, log); //log, myTester
	gTest.End();
	gTest.Close();
	}
Exemplo n.º 9
0
LOCAL_C void ReportError(TInt aError)
	{
	test.Console()->Printf(_L("\n\n"));
	switch (aError)
		{
		case KErrArgument:
			test.Console()->Printf(_L("Usage: t_seriallog logfilename [serial port]\n"));
			break;
		case KErrTimedOut:
			test.Console()->Printf(_L("ERROR: Timeout during serial write\n"));
			break;
		case KErrNotFound:
			test.Console()->Printf(_L("ERROR: File/Port not found\n"));
			break;
		case KErrNotSupported:
			test.Console()->Printf(_L("ERROR: Port not found/supported\n"));
			break;
		default:
			test.Console()->Printf(_L("ERROR: %d\n"),aError);
			break;
		}
	if (aError)
		User::After(KSerialLogErrorDisplayWait);
	}
Exemplo n.º 10
0
void MeasureByNOPs()
{
    test.Start(_L("Create thread"));
    RThread t;
    TInt r=t.Create(KLitThreadName,CountNops,0x1000,NULL,NULL);
    test(r==KErrNone);
    t.SetPriority(EPriorityAbsoluteVeryLow);
    t.Resume();

    test.Next(_L("Get processor clock frequency"));
    TMachineInfoV2Buf buf;
    TMachineInfoV2& info=buf();
    r=UserHal::MachineInfo(buf);
    test(r==KErrNone);
    MaxCycles=info.iProcessorClockInKHz*1000;
    test.Printf(_L("Clock frequency %dHz\n"),MaxCycles);
    TRequestStatus s;
    CConsoleBase* console=test.Console();
    console->Read(s);
#ifdef __WINS__
    TInt timerperiod = 5;
    UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"TimerResolution",&timerperiod);
#endif

    FOREVER
    {
        TUint32 init_count=NopCount;
        TUint32 init_ms=User::NTickCount();
        User::After(1000000);
        TUint32 final_count=NopCount;
        TUint32 final_ms=User::NTickCount();
        TUint32 cycles=final_count-init_count;
        TUint32 ms=final_ms-init_ms;
#ifdef __WINS__
        ms*=timerperiod;
#endif
        while (s!=KRequestPending)
        {
            User::WaitForRequest(s);
            TKeyCode k=console->KeyCode();
            if (k==EKeyTab)
            {
                // calibrate
                TInt64 inst64 = MAKE_TINT64(0, cycles);
                inst64*=1000;
                inst64/=MAKE_TINT64(0,ms);
                MaxCycles=I64LOW(inst64);
                test.Printf(_L("NOPs per second %u\n"),MaxCycles);
            }
            else if (k==EKeyEscape)
                return;
            console->Read(s);
        }
        TInt64 used64=MAKE_TINT64(0, MaxCycles);

        used64-=MAKE_TINT64(0,cycles);
        used64*=1000000;
        used64/=MAKE_TINT64(0,ms);
        used64/=MAKE_TINT64(0, MaxCycles);
        test.Printf(_L("%4d\n"),I64INT(used64));
    }
}