void CAppfwkAmaStarterTestStepStandalone::TestCase4L()
	{
	// Launch the appropriate AMAStarter(s)
	LaunchExe(KAmaStarterTest4_1, _L("10000014"), KErrNone);
	LaunchExe(KAmaStarterTest4_2, _L("10000024"), KErrNone);
	LaunchExe(KAmaStarterTestDefault, _L("2000836D"), KErrNone);	// KDefaultSymbianDsc
	
	// Check and compare results as they have been stored in the result log file
	CompareResultsL(_L("tamastarter_result_4"), _L("tamastarter_app1"), 0, 3, 3, 0, EFalse);
	}
void CAppfwkAmaStarterTestStepStandalone::TestCase6L()
	{
	// Launch the appropriate AMAStarter(s)
	LaunchExe(KAmaStarterTest6_1, _L("10000016"), KErrNone);
	LaunchExe(KAmaStarterTest6_2, _L("10000026"), KErrNone);
	LaunchExe(KAmaStarterTest6_3, _L("10000036"), KErrNone);

	//The app in 0x10000036 is launched using EFireAndForget and is resuming right now. 
	//Because generic\tools\cinidata\src\CIniData.cpp is not thread-safe we must wait until 
	//this app is finished with the logfile before we can CompareResultsL. 
	//Tests on H4 hardware shows that these testapps need about 400ms to run.
	User::After(600000);

	// Check and compare results as they have been stored in the result log file
	CompareResultsL(_L("tamastarter_result_6"), _L("tamastarter_app1"), 0, 3, 3, 0, ETrue);
	}
Exemple #3
0
void AddinHelper::HandleLaunch()
{
	if (FALSE){//不拉exe,拉ai
		LaunchExe();
	}
	else{
		LaunchAi();
	}
}
void CAppfwkAmaStarterTestStepStandalone::TestCase1L()
	{
	// Launch the appropriate AMAStarter(s)
	LaunchExe(KAmaStarterTest1, _L("10000011"), KErrNone);
	
	//One of the three apps in 0x10000011 (KAMCFileNameApp3) is launched using EFireAndForget 
	//and is resuming right now. Because generic\tools\cinidata\src\CIniData.cpp is not 
	//thread-safe we must wait until KAMCFileNameApp3 is finished with the logfile before we can 
	//CompareResultsL. Tests on H4 hardware shows that KAMCFileNameApp3 needs about 400ms to run.
	User::After(600000);
		
	// Check and compare results as they have been stored in the result log file
	CompareResultsL(_L("tamastarter_result_1"), _L("tamastarter_app1"), 0, 1, 1, 0, EFalse);
	CompareResultsL(_L("tamastarter_result_1"), _L("tamastarter_app2"), 1, 2, 1, 0, EFalse);
	CompareResultsL(_L("tamastarter_result_1"), _L("tamastarter_app3"), 0, 1, 1, 0, EFalse);
	}
void CAppfwkAmaStarterTestStepStandalone::TestCase3L()
	{
	// Launch the appropriate AMAStarter(s)
	LaunchExe(KAmaStarterTest3, _L("10000013"), KErrNone);
	
	//Two of the 'valid' apps in 0x10000013 are launched using EFireAndForget and are resuming right now. 
	//Because generic\tools\cinidata\src\CIniData.cpp is not thread-safe we must wait until 
	//these apps are finished with the logfile before we can CompareResultsL. 
	//Tests on H4 hardware shows that these testapps need about 400ms each to run until completion.
	User::After(1200000);
	
	// Check and compare results as they have been stored in the result log file
	CompareResultsL(_L("tamastarter_result_3_1"), _L("tamastarter_app1"), 0, 2, 0, 2, EFalse);
	CompareResultsL(_L("tamastarter_result_3_2"), _L("tamastarter_app2"), 0, 1, 1, 0, EFalse);
	CompareResultsL(_L("tamastarter_result_3_3"), _L("tamastarter_app3"), 0, 1, 1, 0, EFalse);
	CompareResultsL(_L("tamastarter_result_3_4"), _L("tamastarter_app4"), 0, 1, 1, 0, EFalse);
	}
void CAppfwkAmaStarterTestStepStandalone::TestCase5L()
	{
	// Launch the appropriate AMAStarter(s)
	LaunchExe(KAmaStarterTest5, _L("10000015"), KErrNone);

	//Two of the apps in 0x10000015 are launched using EFireAndForget and are resuming right now. 
	//Because generic\tools\cinidata\src\CIniData.cpp is not thread-safe we must wait until 
	//these apps are finished with the logfile before we can CompareResultsL. 
	//Tests on H4 hardware shows that these testapps need about 400ms each to run until completion.
	User::After(1200000);
	
	// Check and compare results as they have been stored in the result log file
	CompareResultsL(_L("tamastarter_result_5_1"), _L("tamastarter_app1"), 0, 1, 1, 0, ETrue);
	CompareResultsL(_L("tamastarter_result_5_2"), _L("tamastarter_app2"), 0, 1, 1, 0, ETrue);
	CompareResultsL(_L("tamastarter_result_5_3"), _L("tamastarter_app3"), 0, 1, 1, 0, ETrue);
	CompareResultsL(_L("tamastarter_result_5_4"), _L("tamastarter_app4"), 0, 1, 1, 0, ETrue);

	CompareDscItemsL(TUid::Uid(0x10000015), KAMCFileNameApp1, _L("-Log tamastarter_result_5_1 -Re 0"), EStartProcess, EWaitForStart, ERetry0, 5000, ETrue, EFalse, EFalse);
	CompareDscItemsL(TUid::Uid(0x10000015), KAMCFileNameApp2, _L("-Log tamastarter_result_5_2 -Re 0"), EStartApp, EWaitForStart, ERetry0, 5000, ETrue, ETrue, ETrue);
	CompareDscItemsL(TUid::Uid(0x10000015), KAMCFileNameApp3, _L("-Log tamastarter_result_5_3"), EStartProcess, EFireAndForget, ERetry0, 5000, ETrue, ETrue, EFalse);
	CompareDscItemsL(TUid::Uid(0x10000015), KAMCFileNameApp4, _L("-Log tamastarter_result_5_4"), EStartApp, EFireAndForget, ERetry0, 5000, ETrue, EFalse, EFalse);
	}
TVerdict CAppfwkAmaStarterTestStepStandalone::doTestStepL()
	{	
	INFO_PRINTF1(_L("AMAStarter Standalone tests started...."));

 	__UHEAP_MARK;

	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(sched);
	CActiveScheduler::Install(sched);

#ifdef __WINS__
// Create separate EXEs as AmaStarter is EXEXP and more than 1 processes cannot be created for emulator.
// Capabilities of AmaStarter.exe PowerMgmt(00000004) + ReadDeviceData(00000010) + ProtServ(00000100)
// As SETCAP tool can't be used on hardware for AmaStarter.exe, we don't call the tool in the script, because
// this would mean different scripts for emulator and hardware.
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter_default.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter1.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter2.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter3.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter4_1.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter4_2.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter5.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_1.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_2.exe"), KErrNone);
	LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_3.exe"), KErrNone);
	INFO_PRINTF1(_L("Creation of separate EXEs for AmaStarter (for emulator) completed.\n"));
#endif

	INFO_PRINTF1(_L("Creating DBMS / SQL data store backups and delete original data stores"));
	TRAPD(ret, DscDatabaseBackupL());
	TESTE(ret == KErrNone, ret);

	INFO_PRINTF1(_L("Creating appropriate data store for the tests"));
	TRAP(ret, CreateTestDatabaseL());
	TESTE(ret == KErrNone, ret);

	// Run the standalone tests cases
	INFO_PRINTF1(_L("Now, run the tests"));
	RunStandaloneTests();
	
	INFO_PRINTF1(_L("Restoring DBMS / SQL data store backups available prior to running the test"));
	TRAP(ret, DscDatabaseRestoreL());
	TESTE(ret == KErrNone, ret);

	// Delete log files created to store temporary results
	RSmlTestUtils fs;
	CleanupClosePushL(fs);
	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(fs.DeleteFileUsingWildcardL(KTestLogFileWild));
	CleanupStack::PopAndDestroy(&fs);

	// Close All panic windows that appear from negative testing conditions in this test
	CloseAllPanicWindowsL();

	CleanupStack::PopAndDestroy(sched);
	__UHEAP_MARKEND;

	INFO_PRINTF1(_L("...AMAStarter Standalone tests finished!!"));

	return TestStepResult();
	}