[PATCH v2] include/wine/test.h: fix winetest_argv[1] in case of single test

Eric Pouech eric.pouech at gmail.com
Tue Feb 22 07:22:45 CST 2022


Wine's test infrastructure allows to call ./wine <test>.exe without
test name when only a single test is available in <test>.exe.

Unfortunately, a lots of tests also rely on winetest_argv[1] to be
the name of current test
(esp. when respawning themselves to run sub processes).

So, ensure wintest_argv is correctly populated in the case of a <test>
containing a single test file and called without any argument on
command line.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 include/wine/test.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/wine/test.h b/include/wine/test.h
index 599234b3519..bf6f5ad856f 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -691,7 +691,11 @@ int main( int argc, char **argv )
     if (!argv[1])
     {
         if (winetest_testlist[0].name && !winetest_testlist[1].name)  /* only one test */
+        {
+            char* fake_argv[3] = {argv[0], strdup(winetest_testlist[0].name), NULL};
+            winetest_argv = fake_argv;
             return run_test( winetest_testlist[0].name );
+        }
         usage( argv[0] );
     }
     if (!strcmp( argv[1], "--list" ))




More information about the wine-devel mailing list