ReactOS  0.4.15-dev-3299-gbe8e5fc
main.cpp File Reference
#include "precomp.h"
#include <cstdio>
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

static void IntPrintUsage ()
 
int wmain (int argc, wchar_t *argv[])
 

Variables

CConfiguration Configuration
 

Function Documentation

◆ IntPrintUsage()

static void IntPrintUsage ( )
static

Prints the application usage.

Definition at line 17 of file main.cpp.

18 {
19  cout << "rosautotest - ReactOS Automatic Testing Utility" << endl
20  << "Usage: rosautotest [options] [module] [test]" << endl
21  << " options:" << endl
22  << " /? - Shows this help." << endl
23  << " /c <comment> - Specifies the comment to be submitted to the Web Service." << endl
24  << " Skips the comment set in the configuration file (if any)." << endl
25  << " Only has an effect when /w is also used." << endl
26  << " /n - Do not print test output to console" << endl
27  << " /r - Maintain information to resume from ReactOS crashes" << endl
28  << " Can only be run under ReactOS and relies on sysreg2," << endl
29  << " so incompatible with /w" << endl
30  << " /s - Shut down the system after finishing the tests." << endl
31  << " /t <num> - Repeat the test <num> times (1-10000)" << endl
32  << " /w - Submit the results to the webservice." << endl
33  << " Requires a \"rosautotest.ini\" with valid login data." << endl
34  << " Incompatible with the /r option." << endl
35  << " /l - List all modules that would run." << endl
36  << endl
37  << " module:" << endl
38  << " The module to be tested (i.e. \"advapi32\")" << endl
39  << " If this parameter is specified without any test parameter," << endl
40  << " all tests of the specified module are run." << endl
41  << endl
42  << " test:" << endl
43  << " The test to be run. Needs to be a test of the specified module." << endl;
44 }
#define cout
Definition: iostream.cpp:38
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357

Referenced by wmain().

◆ wmain()

int wmain ( int  argc,
wchar_t argv[] 
)

Main entry point

Definition at line 50 of file main.cpp.

51 {
52  int ReturnValue = 1;
53 
54  try
55  {
57 
58  /* Set up the configuration */
59  Configuration.ParseParameters(argc, argv);
60  Configuration.GetSystemInformation();
61  Configuration.GetConfigurationFromFile();
62 
63  ss << endl
64  << endl
65  << "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed;
66  ss << ((float)GetTickCount()/1000) << " seconds" << endl;
67  StringOut(ss.str());
68 
69  /* Report tests startup */
70  InitLogs();
73  0,
74  MSG_TESTS_STARTED,
75  NULL,
76  0,
77  0,
78  NULL,
79  NULL);
80 
81  if (Configuration.GetRepeatCount() > 1)
82  {
83  stringstream ss1;
84 
85  ss1 << "[ROSAUTOTEST] The test will be repeated " << Configuration.GetRepeatCount() << " times" << endl;
86  StringOut(ss1.str());
87  }
88 
89  /* Run the tests */
90  for (unsigned long i = 0; i < Configuration.GetRepeatCount(); i++)
91  {
92  CWineTest WineTest;
93 
94  if (Configuration.GetRepeatCount() > 1)
95  {
97  ss << "[ROSAUTOTEST] Running attempt #" << i+1 << endl;
98  StringOut(ss.str());
99  }
100  WineTest.Run();
101  }
102 
103  /* For sysreg2 */
104  DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");
105 
106  ReturnValue = 0;
107  }
109  {
110  IntPrintUsage();
111  }
112  catch(CSimpleException& e)
113  {
115 
116  // e.GetMessage() must include ending '\n'.
117  ss << "[ROSAUTOTEST] " << e.GetMessage();
118  StringOut(ss.str());
119  }
120  catch(CFatalException& e)
121  {
123 
124  // e.GetMessage() must include ending '\n'.
125  ss << "An exception occured in rosautotest." << endl
126  << "Message: " << e.GetMessage()
127  << "File: " << e.GetFile() << endl
128  << "Line: " << e.GetLine() << endl
129  << "Last Win32 Error: " << GetLastError() << endl;
130  StringOut(ss.str());
131  }
132 
133  /* For sysreg2 to notice if rosautotest itself failed */
134  if(ReturnValue == 1)
135  DbgPrint("SYSREG_ROSAUTOTEST_FAILURE\n");
136 
137  /* Report successful end of tests */
140  0,
141  MSG_TESTS_SUCCESSFUL,
142  NULL,
143  0,
144  0,
145  NULL,
146  NULL);
147  FreeLogs();
148 
149  /* Shut down the system if requested, also in case of an exception above */
150  if(Configuration.DoShutdown() && !ShutdownSystem())
151  ReturnValue = 1;
152 
153  return ReturnValue;
154 }
static int argc
Definition: ServiceArgs.c:12
bool ShutdownSystem()
Definition: shutdown.cpp:16
#define DbgPrint
Definition: hal.h:12
static void IntPrintUsage()
Definition: main.cpp:17
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
Definition: wdfinterrupt.h:372
_String str() const
Definition: _sstream.h:230
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setprecision(int __n)
Definition: _iomanip.h:119
#define argv
Definition: mplay32.c:18
VOID FreeLogs()
Definition: misc.cpp:219
void Run()
Definition: CWineTest.cpp:364
VOID InitLogs()
Definition: misc.cpp:175
ios_base &_STLP_CALL fixed(ios_base &__s)
Definition: _ios_base.h:332
UINT32 void void ** ReturnValue
Definition: acevents.h:214
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
#define e
Definition: ke_i.h:82
#define EVENTLOG_SUCCESS
Definition: winnt_old.h:2753
#define EVENTLOG_INFORMATION_TYPE
Definition: winnt_old.h:2756
static HANDLE hLog
Definition: misc.cpp:13
string StringOut(const string &String, bool forcePrint=true)
Definition: tools.cpp:96
BOOL WINAPI ReportEventW(IN HANDLE hEventLog, IN WORD wType, IN WORD wCategory, IN DWORD dwEventID, IN PSID lpUserSid, IN WORD wNumStrings, IN DWORD dwDataSize, IN LPCWSTR *lpStrings, IN LPVOID lpRawData)
Definition: eventlog.c:1516
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static float(__cdecl *square_half_float)(float x
#define NULL
Definition: types.h:112
#define ss
Definition: i386-dis.c:434

Variable Documentation

◆ Configuration

Definition at line 11 of file main.cpp.