Add an all option to tests

Francois Gouget fgouget at free.fr
Tue Dec 10 21:15:45 CST 2002


This is a variation on the 'all' option I proposed before. This time we
run each test in a separate process. This way they should not interfer
with each other (no more than manually running them in sequence would).

Changelog:

 * include/wine/test.h

   Add an 'all' option to run all the tests contained in a test
executable


Index: include/wine/test.h
===================================================================
RCS file: /home/wine/wine/include/wine/test.h,v
retrieving revision 1.8
diff -u -r1.8 test.h
--- include/wine/test.h	11 Dec 2002 00:17:42 -0000	1.8
+++ include/wine/test.h	11 Dec 2002 03:12:10 -0000
@@ -317,7 +317,32 @@
     if ((p = getenv( "WINETEST_REPORT_SUCCESS"))) report_success = atoi(p);
     if (!argv[1]) usage( argv[0] );

-    return run_test(argv[1]);
+    if (strcmp(argv[1], "all") == 0)
+    {
+        const struct test* test;
+        int status=0;
+
+        for (test = winetest_testlist; test->name; test++)
+        {
+            int rc;
+            char* cmd;
+            fprintf(stderr, "Testing %s\n", test->name);
+            cmd=malloc(1+strlen(argv[0])+2+strlen(test->name)+1);
+            sprintf(cmd,"\"%s\" %s",argv[0],test->name);
+            rc=system(cmd);
+            free(cmd);
+            if (rc<0 || (rc & 0xff)!=0) {
+                rc=256;
+            }
+            status+=rc >> 8;
+            fprintf(stderr, "\n");
+        }
+        return (status <= 255) ? status : 255;
+    }
+    else
+    {
+        return run_test(argv[1]);
+    }
 }

 #endif  /* WINETEST_WANT_MAIN */


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                     Avoid the Gates of Hell - use Linux.




More information about the wine-patches mailing list