- Fix report() dispatch.

- Strip "_test..." from test file names.
- Use mystrtok() for command line parsing to avoid collision with the
  one in get_subtests().
- Change User-Agent HTTP header to "Winetest Shell".
This commit is contained in:
Ferenc Wagner 2004-03-19 01:54:10 +00:00 committed by Alexandre Julliard
parent 9c6774f18a
commit 8387770064
3 changed files with 42 additions and 13 deletions

View File

@ -94,6 +94,7 @@ guiStatus (va_list ap)
int int
textProgress (va_list ap) textProgress (va_list ap)
{ {
progressGroup = va_arg (ap, int);
progressMax = va_arg (ap, int); progressMax = va_arg (ap, int);
progressCurr = 0; progressCurr = 0;
return 0; return 0;
@ -402,13 +403,16 @@ report (enum report_type t, ...)
int ret = 0; int ret = 0;
static r_fun_t * const text_funcs[] = static r_fun_t * const text_funcs[] =
{textStatus, textProgress, textStep, textDelta, {textStatus, textProgress, textStep, textDelta,
textDir, textOut, textFatal, textWarning, textAsk}; textDir, textOut,
textWarning, textError, textFatal, textAsk};
static r_fun_t * const GUI_funcs[] = static r_fun_t * const GUI_funcs[] =
{guiStatus, guiProgress, guiStep, guiDelta, {guiStatus, guiProgress, guiStep, guiDelta,
guiDir, guiOut, guiFatal, guiWarning, guiAsk}; guiDir, guiOut,
guiWarning, guiError, guiFatal, guiAsk};
static r_fun_t * const quiet_funcs[] = static r_fun_t * const quiet_funcs[] =
{qNoOp, qNoOp, qNoOp, qNoOp, {qNoOp, qNoOp, qNoOp, qNoOp,
qNoOp, qNoOp, qFatal, qNoOp, qAsk}; qNoOp, qNoOp,
qNoOp, qNoOp, qFatal, qAsk};
static r_fun_t * const * funcs = NULL; static r_fun_t * const * funcs = NULL;
switch (t) { switch (t) {

View File

@ -149,7 +149,7 @@ extract_test (struct wine_test *test, const char *dir, int id)
} }
if (!strlen) report (R_FATAL, "Can't read name of test %d.", id); if (!strlen) report (R_FATAL, "Can't read name of test %d.", id);
test->exename = strmake (NULL, "%s/%s", dir, test->name); test->exename = strmake (NULL, "%s/%s", dir, test->name);
exepos = strstr (test->name, ".exe"); exepos = strstr (test->name, "_test.exe");
if (!exepos) report (R_FATAL, "Not an .exe file: %s", test->name); if (!exepos) report (R_FATAL, "Not an .exe file: %s", test->name);
*exepos = 0; *exepos = 0;
test->name = xrealloc (test->name, exepos - test->name + 1); test->name = xrealloc (test->name, exepos - test->name + 1);
@ -294,11 +294,12 @@ run_tests (char *logname, const char *tag)
xprintf ("Version 2\n"); xprintf ("Version 2\n");
i = LoadStringA (GetModuleHandle (NULL), 0, i = LoadStringA (GetModuleHandle (NULL), 0,
build_tag, sizeof build_tag); build_tag, sizeof build_tag);
if (i == 0) report (R_FATAL, "Build descriptor not found."); if (i == 0) report (R_FATAL, "Build descriptor not found: %d",
GetLastError ());
if (i >= sizeof build_tag) if (i >= sizeof build_tag)
report (R_FATAL, "Build descriptor too long."); report (R_FATAL, "Build descriptor too long.");
xprintf ("Tests from build %s\n", build_tag); xprintf ("Tests from build %s\n", build_tag);
xprintf ("Tag: %s", tag?tag:""); xprintf ("Tag: %s\n", tag?tag:"");
xprintf ("Operating system version:\n"); xprintf ("Operating system version:\n");
print_version (); print_version ();
xprintf ("Test output:\n" ); xprintf ("Test output:\n" );
@ -354,6 +355,30 @@ Usage: winetest [OPTION]...\n\n\
-t TAG include TAG of characters [-.0-9a-zA-Z] in the report\n"); -t TAG include TAG of characters [-.0-9a-zA-Z] in the report\n");
} }
/* One can't nest strtok()-s, so here is a replacement. */
char *
mystrtok (char *newstr)
{
static char *start, *end;
static int finish = 1;
if (newstr) {
start = newstr;
finish = 0;
} else start = end;
if (finish) return NULL;
while (*start == ' ') start++;
if (*start == 0) return NULL;
end = start;
while (*end != ' ')
if (*end == 0) {
finish = 1;
return start;
} else end++;
*end++ = 0;
return start;
}
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR cmdLine, int cmdShow) LPSTR cmdLine, int cmdShow)
{ {
@ -361,7 +386,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
char *tag = NULL, *cp; char *tag = NULL, *cp;
const char *submit = NULL; const char *submit = NULL;
cmdLine = strtok (cmdLine, " "); cmdLine = mystrtok (cmdLine);
while (cmdLine) { while (cmdLine) {
if (*cmdLine == '-') if (*cmdLine == '-')
if (cmdLine[2]) { if (cmdLine[2]) {
@ -382,17 +407,17 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
report (R_QUIET); report (R_QUIET);
break; break;
case 's': case 's':
submit = strtok (NULL, " "); submit = mystrtok (NULL);
if (tag) if (tag)
report (R_WARNING, "ignoring tag for submit"); report (R_WARNING, "ignoring tag for submit");
send_file (submit); send_file (submit);
break; break;
case 'o': case 'o':
logname = strtok (NULL, " "); logname = mystrtok (NULL);
run_tests (logname, tag); run_tests (logname, tag);
break; break;
case 't': case 't':
tag = strtok (NULL, " "); tag = mystrtok (NULL);
cp = badtagchar (tag); cp = badtagchar (tag);
if (cp) { if (cp) {
report (R_ERROR, "invalid char in tag: %c", *cp); report (R_ERROR, "invalid char in tag: %c", *cp);
@ -405,7 +430,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
usage (); usage ();
exit (2); exit (2);
} }
cmdLine = strtok (NULL, " "); cmdLine = mystrtok (NULL);
} }
if (!logname && !submit) { if (!logname && !submit) {
report (R_STATUS, "Starting up"); report (R_STATUS, "Starting up");

View File

@ -111,7 +111,7 @@ send_file (const char *name)
#define SEP "-" #define SEP "-"
const char head[] = "POST /submit HTTP/1.0\r\n" const char head[] = "POST /submit HTTP/1.0\r\n"
"Host: afavant\r\n" "Host: afavant\r\n"
"User-Agent: Winetests Shell\r\n" "User-Agent: Winetest Shell\r\n"
"Content-Type: multipart/form-data; boundary=" SEP "\r\n" "Content-Type: multipart/form-data; boundary=" SEP "\r\n"
"Content-Length: %u\r\n\r\n"; "Content-Length: %u\r\n\r\n";
const char body1[] = "--" SEP "\r\n" const char body1[] = "--" SEP "\r\n"