Commit 83877700 authored by Ferenc Wagner's avatar Ferenc Wagner Committed by Alexandre Julliard

- 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".
parent 9c6774f1
......@@ -94,6 +94,7 @@ guiStatus (va_list ap)
int
textProgress (va_list ap)
{
progressGroup = va_arg (ap, int);
progressMax = va_arg (ap, int);
progressCurr = 0;
return 0;
......@@ -402,13 +403,16 @@ report (enum report_type t, ...)
int ret = 0;
static r_fun_t * const text_funcs[] =
{textStatus, textProgress, textStep, textDelta,
textDir, textOut, textFatal, textWarning, textAsk};
textDir, textOut,
textWarning, textError, textFatal, textAsk};
static r_fun_t * const GUI_funcs[] =
{guiStatus, guiProgress, guiStep, guiDelta,
guiDir, guiOut, guiFatal, guiWarning, guiAsk};
guiDir, guiOut,
guiWarning, guiError, guiFatal, guiAsk};
static r_fun_t * const quiet_funcs[] =
{qNoOp, qNoOp, qNoOp, qNoOp,
qNoOp, qNoOp, qFatal, qNoOp, qAsk};
qNoOp, qNoOp,
qNoOp, qNoOp, qFatal, qAsk};
static r_fun_t * const * funcs = NULL;
switch (t) {
......
......@@ -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);
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);
*exepos = 0;
test->name = xrealloc (test->name, exepos - test->name + 1);
......@@ -294,11 +294,12 @@ run_tests (char *logname, const char *tag)
xprintf ("Version 2\n");
i = LoadStringA (GetModuleHandle (NULL), 0,
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)
report (R_FATAL, "Build descriptor too long.");
xprintf ("Tests from build %s\n", build_tag);
xprintf ("Tag: %s", tag?tag:"");
xprintf ("Tag: %s\n", tag?tag:"");
xprintf ("Operating system version:\n");
print_version ();
xprintf ("Test output:\n" );
......@@ -325,7 +326,7 @@ run_tests (char *logname, const char *tag)
int j;
for (j = 0; j < test->subtest_count; j++) {
report (R_STEP, "Running: %s: %s", test->name,
report (R_STEP, "Running: %s:%s", test->name,
test->subtests[j]);
run_test (test, test->subtests[j]);
}
......@@ -354,6 +355,30 @@ Usage: winetest [OPTION]...\n\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,
LPSTR cmdLine, int cmdShow)
{
......@@ -361,7 +386,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
char *tag = NULL, *cp;
const char *submit = NULL;
cmdLine = strtok (cmdLine, " ");
cmdLine = mystrtok (cmdLine);
while (cmdLine) {
if (*cmdLine == '-')
if (cmdLine[2]) {
......@@ -382,17 +407,17 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
report (R_QUIET);
break;
case 's':
submit = strtok (NULL, " ");
submit = mystrtok (NULL);
if (tag)
report (R_WARNING, "ignoring tag for submit");
send_file (submit);
break;
case 'o':
logname = strtok (NULL, " ");
logname = mystrtok (NULL);
run_tests (logname, tag);
break;
case 't':
tag = strtok (NULL, " ");
tag = mystrtok (NULL);
cp = badtagchar (tag);
if (cp) {
report (R_ERROR, "invalid char in tag: %c", *cp);
......@@ -405,7 +430,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
usage ();
exit (2);
}
cmdLine = strtok (NULL, " ");
cmdLine = mystrtok (NULL);
}
if (!logname && !submit) {
report (R_STATUS, "Starting up");
......
......@@ -111,7 +111,7 @@ send_file (const char *name)
#define SEP "-"
const char head[] = "POST /submit HTTP/1.0\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-Length: %u\r\n\r\n";
const char body1[] = "--" SEP "\r\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment