reactos/rostests/rosautotest/main.cpp
Colin Finck 10f13abcb5 Big testing system commit
rosautotest
- Rewrite rosautotest in C++
  Should increase maintainability and expandability, since most of the functionality is encapsulated in classes and there exist some abstract classes for further enhancements (i.e. new test types).
  Furthermore, due to the usage of STL strings, we don't need x lines anymore just for building a string out of several small parts.
- The new codebase made it fairly easy to implement a Crash Recovery feature based on a journal.
  If you start rosautotest with the /r option under ReactOS, it will keep a journal about the tests to run and the tests already ran. In case of a crash, it can just continue with the next test in the list then.
- Add some reasonable timeouts to avoid certain hangs in case a test crashes

sysreg2
- Make the necessary changes to sysreg2 to restart the VM in case of such a crash in 3rd stage, but set a maximum number of allowed crashes as well.
  Christoph, please test and review that on the Buildslave :-)
- Prepend all sysreg messages with [SYSREG] through a new function SysregPrintf, so the BuildBot aggregator script of testman can distinguish between debug output and sysreg messages.
- Put all header includes into the central header file "sysreg.h"
- Remove unnecessary libs from the Makefile

testman
- Change the testman Web Interface to show such crashes as CRASH in the Compare and Detail views.

svn path=/trunk/; revision=40147
2009-03-21 01:39:04 +00:00

93 lines
3 KiB
C++

/*
* PROJECT: ReactOS Automatic Testing Utility
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
* PURPOSE: Main implementation file
* COPYRIGHT: Copyright 2008-2009 Colin Finck <colin@reactos.org>
*/
#include "precomp.h"
#include <cstdio>
CConfiguration Configuration;
/**
* Prints the application usage.
*/
static void
IntPrintUsage()
{
cout << "rosautotest - ReactOS Automatic Testing Utility" << endl
<< "Usage: rosautotest [options] [module] [test]" << endl
<< " options:" << endl
<< " /? - Shows this help." << endl
<< " /c <comment> - Specifies the comment to be submitted to the Web Service." << endl
<< " Skips the comment set in the configuration file (if any)." << endl
<< " Only has an effect when /w is also used." << endl
<< " /r - Maintain information to resume from ReactOS crashes" << endl
<< " Can only be run under ReactOS and relies on sysreg2," << endl
<< " so incompatible with /w" << endl
<< " /s - Shut down the system after finishing the tests." << endl
<< " /w - Submit the results to the webservice." << endl
<< " Requires a \"rosautotest.ini\" with valid login data." << endl
<< " Incompatible with the /r option." << endl
<< endl
<< " module:" << endl
<< " The module to be tested (i.e. \"advapi32\")" << endl
<< " If this parameter is specified without any test parameter," << endl
<< " all tests of the specified module are run." << endl
<< endl
<< " test:" << endl
<< " The test to be run. Needs to be a test of the specified module." << endl;
}
/**
* Main entry point
*/
extern "C" int
wmain(int argc, wchar_t* argv[])
{
CWineTest WineTest;
int ReturnValue = 1;
try
{
/* Set up the configuration */
Configuration.ParseParameters(argc, argv);
Configuration.GetSystemInformation();
Configuration.GetConfigurationFromFile();
/* Run the tests */
WineTest.Run();
/* For sysreg */
DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");
ReturnValue = 0;
}
catch(CInvalidParameterException)
{
IntPrintUsage();
}
catch(CSimpleException& e)
{
StringOut(e.GetMessage());
}
catch(CFatalException& e)
{
stringstream ss;
ss << "An exception occured in rosautotest." << endl
<< "Message: " << e.GetMessage() << endl
<< "File: " << e.GetFile() << endl
<< "Line: " << e.GetLine() << endl
<< "Last Win32 Error: " << GetLastError() << endl;
StringOut(ss.str());
}
/* Shut down the system if requested, also in case of an exception above */
if(Configuration.DoShutdown() && !ShutdownSystem())
ReturnValue = 1;
return ReturnValue;
}