[ROSAUTOTEST] Add /t parameter for repeating tests

This commit is contained in:
Victor Perevertkin 2020-05-18 05:42:53 +03:00 committed by Victor Perevertkin
parent 29b49c36ff
commit d230f8829c
3 changed files with 49 additions and 3 deletions

View file

@ -19,6 +19,7 @@ CConfiguration::CConfiguration()
: m_CrashRecovery(false), : m_CrashRecovery(false),
m_IsInteractive(false), m_IsInteractive(false),
m_PrintToConsole(true), m_PrintToConsole(true),
m_RepeatCount(1),
m_Shutdown(false), m_Shutdown(false),
m_Submit(false) m_Submit(false)
{ {
@ -52,10 +53,17 @@ CConfiguration::ParseParameters(int argc, wchar_t* argv[])
{ {
if(argv[i][0] == '-' || argv[i][0] == '/') if(argv[i][0] == '-' || argv[i][0] == '/')
{ {
unsigned long tmp_RepeatCount;
switch(argv[i][1]) switch(argv[i][1])
{ {
case 'c': case 'c':
++i; ++i;
if (i >= argc)
{
throw CInvalidParameterException();
}
m_Comment = UnicodeToAscii(argv[i]); m_Comment = UnicodeToAscii(argv[i]);
break; break;
@ -75,6 +83,23 @@ CConfiguration::ParseParameters(int argc, wchar_t* argv[])
m_Submit = true; m_Submit = true;
break; break;
case 't':
++i;
if (i >= argc)
{
throw CInvalidParameterException();
}
tmp_RepeatCount = wcstoul(argv[i], NULL, 10);
if (tmp_RepeatCount == 0 || tmp_RepeatCount > 10000)
{
throw CInvalidParameterException();
}
m_RepeatCount = tmp_RepeatCount;
break;
default: default:
throw CInvalidParameterException(); throw CInvalidParameterException();
} }

View file

@ -12,6 +12,7 @@ private:
bool m_IsInteractive; bool m_IsInteractive;
bool m_IsReactOS; bool m_IsReactOS;
bool m_PrintToConsole; bool m_PrintToConsole;
unsigned long m_RepeatCount;
bool m_Shutdown; bool m_Shutdown;
bool m_Submit; bool m_Submit;
string m_Comment; string m_Comment;
@ -33,6 +34,7 @@ public:
bool DoSubmit() const { return m_Submit; } bool DoSubmit() const { return m_Submit; }
bool IsInteractive() const { return m_IsInteractive; } bool IsInteractive() const { return m_IsInteractive; }
bool IsReactOS() const { return m_IsReactOS; } bool IsReactOS() const { return m_IsReactOS; }
unsigned long GetRepeatCount() const { return m_RepeatCount; }
const string& GetComment() const { return m_Comment; } const string& GetComment() const { return m_Comment; }
const wstring& GetModule() const { return m_Module; } const wstring& GetModule() const { return m_Module; }
const string& GetTest() const { return m_Test; } const string& GetTest() const { return m_Test; }

View file

@ -28,6 +28,7 @@ IntPrintUsage()
<< " Can only be run under ReactOS and relies on sysreg2," << endl << " Can only be run under ReactOS and relies on sysreg2," << endl
<< " so incompatible with /w" << endl << " so incompatible with /w" << endl
<< " /s - Shut down the system after finishing the tests." << endl << " /s - Shut down the system after finishing the tests." << endl
<< " /t <num> - Repeat the test <num> times (1-10000)" << endl
<< " /w - Submit the results to the webservice." << endl << " /w - Submit the results to the webservice." << endl
<< " Requires a \"rosautotest.ini\" with valid login data." << endl << " Requires a \"rosautotest.ini\" with valid login data." << endl
<< " Incompatible with the /r option." << endl << " Incompatible with the /r option." << endl
@ -47,7 +48,6 @@ IntPrintUsage()
extern "C" int extern "C" int
wmain(int argc, wchar_t* argv[]) wmain(int argc, wchar_t* argv[])
{ {
CWineTest WineTest;
int ReturnValue = 1; int ReturnValue = 1;
try try
@ -64,7 +64,7 @@ wmain(int argc, wchar_t* argv[])
<< "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed; << "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed;
ss << ((float)GetTickCount()/1000) << " seconds" << endl; ss << ((float)GetTickCount()/1000) << " seconds" << endl;
StringOut(ss.str()); StringOut(ss.str());
/* Report tests startup */ /* Report tests startup */
InitLogs(); InitLogs();
ReportEventW(hLog, ReportEventW(hLog,
@ -77,8 +77,27 @@ wmain(int argc, wchar_t* argv[])
NULL, NULL,
NULL); NULL);
if (Configuration.GetRepeatCount() > 1)
{
stringstream ss1;
ss1 << "[ROSAUTOTEST] The test will be repeated " << Configuration.GetRepeatCount() << " times" << endl;
StringOut(ss1.str());
}
/* Run the tests */ /* Run the tests */
WineTest.Run(); for (unsigned long i = 0; i < Configuration.GetRepeatCount(); i++)
{
CWineTest WineTest;
if (Configuration.GetRepeatCount() > 1)
{
stringstream ss;
ss << "[ROSAUTOTEST] Running attempt #" << i+1 << endl;
StringOut(ss.str());
}
WineTest.Run();
}
/* For sysreg2 */ /* For sysreg2 */
DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n"); DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");