winetest: Add option -d to specify tests output directory.

Nicolas Le Cam niko.lecam at gmail.com
Sun May 31 06:43:52 CDT 2009


---
 programs/winetest/main.c |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 381328c..1f40460 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -612,7 +612,7 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType,
 }
 
 static char *
-run_tests (char *logname)
+run_tests (char *logname, char *outdir)
 {
     int i;
     char *strres, *eol, *nextline;
@@ -659,16 +659,22 @@ run_tests (char *logname)
         report (R_FATAL, "Could not open logfile: %u", GetLastError());
 
     /* try stable path for ZoneAlarm */
-    strcpy( tempdir, tmppath );
-    strcat( tempdir, "wct" );
-    if (!CreateDirectoryA( tempdir, NULL ))
-    {
-        if (!GetTempFileNameA( tmppath, "wct", 0, tempdir ))
-            report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
-        DeleteFileA( tempdir );
+    if (!outdir) {
+        strcpy( tempdir, tmppath );
+        strcat( tempdir, "wct" );
+
         if (!CreateDirectoryA( tempdir, NULL ))
-            report (R_FATAL, "Could not create directory: %s", tempdir);
+        {
+            if (!GetTempFileNameA( tmppath, "wct", 0, tempdir ))
+                report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
+            DeleteFileA( tempdir );
+            if (!CreateDirectoryA( tempdir, NULL ))
+                report (R_FATAL, "Could not create directory: %s", tempdir);
+        }
     }
+    else
+        strcpy( tempdir, outdir);
+
     report (R_DIR, tempdir);
 
     xprintf ("Version 4\n");
@@ -749,7 +755,8 @@ run_tests (char *logname)
     report (R_STATUS, "Cleaning up");
     CloseHandle( logfile );
     logfile = 0;
-    remove_dir (tempdir);
+    if (!outdir)
+        remove_dir (tempdir);
     heap_free(wine_tests);
     heap_free(curpath);
 
@@ -823,12 +830,13 @@ usage (void)
 " -o FILE   put report into FILE, do not submit\n"
 " -s FILE   submit FILE, do not run tests\n"
 " -t TAG    include TAG of characters [-.0-9a-zA-Z] in the report\n"
-" -x DIR    Extract tests to DIR (default: .\\wct) and exit\n");
+" -x DIR    Extract tests to DIR (default: .\\wct) and exit\n"
+" -d DIR    Use DIR as temp directory (default: %%TEMP%%\\wct)");
 }
 
 int main( int argc, char *argv[] )
 {
-    char *logname = NULL;
+    char *logname = NULL, *outdir = NULL;
     const char *extract = NULL;
     const char *cp, *submit = NULL;
     int reset_env = 1;
@@ -915,6 +923,9 @@ int main( int argc, char *argv[] )
 
             extract_only (extract);
             break;
+        case 'd':
+            outdir = argv[++i];
+            break;
         default:
             report (R_ERROR, "invalid option: -%c", argv[i][1]);
             usage ();
@@ -953,12 +964,12 @@ int main( int argc, char *argv[] )
         }
 
         if (!logname) {
-            logname = run_tests (NULL);
+            logname = run_tests (NULL, outdir);
             if (build_id[0] && !nb_filters &&
                 report (R_ASK, MB_YESNO, "Do you want to submit the test results?") == IDYES)
                 if (!send_file (logname) && !DeleteFileA(logname))
                     report (R_WARNING, "Can't remove logfile: %u", GetLastError());
-        } else run_tests (logname);
+        } else run_tests (logname, outdir);
         report (R_STATUS, "Finished");
     }
     if (poweroff)
-- 
1.6.0.4


--=-pwqwJ2X5oZ5ByQyG1SOV--




More information about the wine-patches mailing list