winetest fixes

Ferenc Wagner wferi at afavant.elte.hu
Thu Mar 18 17:26:03 CST 2004


ChangeLog:
  * 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".

Index: gui.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/gui.c,v
retrieving revision 1.4
diff -u -r1.4 gui.c
--- gui.c	21 Feb 2004 04:01:56 -0000	1.4
+++ gui.c	18 Mar 2004 23:20:50 -0000
@@ -94,6 +94,7 @@
 int
 textProgress (va_list ap)
 {
+    progressGroup = va_arg (ap, int);
     progressMax = va_arg (ap, int);
     progressCurr = 0;
     return 0;
@@ -402,13 +403,16 @@
     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) {
Index: main.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/main.c,v
retrieving revision 1.5
diff -u -r1.5 main.c
--- main.c	21 Feb 2004 04:01:56 -0000	1.5
+++ main.c	18 Mar 2004 23:20:50 -0000
@@ -149,7 +149,7 @@
     }
     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 @@
     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 @@
         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 @@
   -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 @@
     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 @@
                 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 @@
                 usage ();
                 exit (2);
             }
-        cmdLine = strtok (NULL, " ");
+        cmdLine = mystrtok (NULL);
     }
     if (!logname && !submit) {
         report (R_STATUS, "Starting up");
Index: send.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/send.c,v
retrieving revision 1.5
diff -u -r1.5 send.c
--- send.c	1 Mar 2004 23:28:02 -0000	1.5
+++ send.c	18 Mar 2004 23:20:50 -0000
@@ -111,7 +111,7 @@
 #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"



More information about the wine-patches mailing list