Пример #1
0
/// Runs all registered tests (if they meet their dependencies)
void CFeatureTestMgr::RunAll()
{
	// Writing the list of the active registered tests. 
	// This can be useful to later check, when a crash occurs, 
	// which tests were executed and which are skipped 
	// (We will have no valid results for them)
	{
		if(m_pAutoTester && !m_testManifestWritten)
		{
			XmlNodeRef testManifest = GetISystem()->CreateXmlNode("testManifest");
			testManifest->setTag("testmanifest");		

			CryLogAlways("About to dump out the testmanifest xml...");

			for (TFeatureTestVec::iterator iter(m_featureTests.begin()); iter != m_featureTests.end(); ++iter)
			{
				FeatureTestState& fTest = *iter;
				XmlNodeRef testDescrNode = fTest.m_pTest->XmlDescription();
				if(testDescrNode)
				{
					testManifest->addChild(testDescrNode);
				}
				
			}

			m_pAutoTester->WriteTestManifest(testManifest);
			m_testManifestWritten = true;
		}
	}



	if (!IsRunning())
	{
		// Ensure all tests are cleaned up and scheduled to run
		ResetAllTests(eFTS_Scheduled);

		if (StartNextTest() || WaitingForScheduledTests())
		{
			CryLog("Running all map feature tests...");
		}
		else
		{
			CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "No tests available to run!");
		}
	}
	else
	{
		CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Tests are already running, can't start more until tests are complete.");
	}
}
Пример #2
0
/// Runs all registered tests (if they meet their dependencies)
void CFeatureTestMgr::RunAll()
{
	if (!IsRunning())
	{
		// Ensure all tests are cleaned up and scheduled to run
		ResetAllTests(eFTS_Scheduled);

		if (StartNextTest() || WaitingForScheduledTests())
		{
			CryLog("Running all map feature tests...");
		}
		else
		{
			CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "No tests available to run!");
		}
	}
	else
	{
		CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Tests are already running, can't start more until tests are complete.");
	}
}
Пример #3
0
/// Updates testing state
void CFeatureTestMgr::Update(float deltaTime)
{
	if (m_pendingLevelReload)
	{
		m_pendingLevelReload = false;
		m_hasQuickloaded = false;
		CryLogAlways("Reloading level before starting map tests.");
		gEnv->pConsole->ExecuteString("map");
		return;
	}

	if (m_pendingQuickload)
	{
		m_pendingQuickload = false;

		bool bAllowQuickload = true;

		if (gEnv->IsEditor())
		{
			ICVar* pg_allowSaveLoadInEditor = gEnv->pConsole->GetCVar("g_allowSaveLoadInEditor");
			const bool bAllowSaveInEditor = pg_allowSaveLoadInEditor && (pg_allowSaveLoadInEditor->GetIVal() != 0);
			if (!bAllowSaveInEditor)
			{
				CryLogAlways("Ignoring quickload tests in editor");
				bAllowQuickload = false;
			}
		}

		if (bAllowQuickload)
		{
			QuickloadReportResults();
			return;
		}
	}

	// WORKAROUND: Auto-tester sends run all request before FG tests have loaded, so we wait for them to register here
	if (m_pendingRunAll)
	{
		// Have any feature tests registered yet?
		if (!m_featureTests.empty())
		{
			// Initiate the RunAll!
			m_pendingRunAll = false;
			RunAll();
		}
	}

	// If running tests
	if (m_running)
	{
		// If a test is in progress
		if (m_pRunningTest)
		{
			m_pRunningTest->Update(deltaTime);
		}
		else	// We don't have a current test
		{
			// Get one from the scheduled list
			if (!StartNextTest() && !WaitingForScheduledTests())
			{
				CryLogAlways("Finished running map tests!");
			}
		}
	}
	else
	{
		//If we have tests scheduled but nothing is running, then wait for a time out

		if(WaitingForScheduledTests())
		{
			m_timeWaitedForScheduled += deltaTime;
			if(m_timeWaitedForScheduled >= m_timeoutScheduled)
			{
				m_waiting = false;
				CryLogAlways("More feature tests were scheduled, but exceeded wait time:%.2f!", m_timeoutScheduled);
			}
			else
			{
				//Try to start the next test again in case conditions are now met
				StartNextTest();
			}
		}
	}
}