]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: auto-detect test bundle builds
authorViktor Szakats <commit@vsz.me>
Mon, 17 Mar 2025 17:46:42 +0000 (18:46 +0100)
committerViktor Szakats <commit@vsz.me>
Tue, 18 Mar 2025 11:23:43 +0000 (12:23 +0100)
If libtests, units and servers binaries are all present, auto-enable
bundle mode.

Drop manual runtests option.

Note: Make sure to "make clean" before changing the test bundle build
setting.

Also fix to append executable extension to all libtest and unit test
executables when launching them. This should make it a tiny bit faster
on Windows.

Follow-up to f4f25505df1d2ede727071eb0c518368a206f64b #15000
Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772

Closes #16750

tests/CMakeLists.txt
tests/Makefile.am
tests/runner.pm
tests/runtests.md
tests/runtests.pl

index 47b01a3faccf4ae739d555cfd002ff8106b93282..e3de29d6ac6e4a95983bff2da882a8835884ebe9 100644 (file)
@@ -40,9 +40,6 @@ add_subdirectory(unit)
 add_subdirectory(certs EXCLUDE_FROM_ALL)
 
 function(curl_add_runtests _targetname _test_flags)
-  if(CURL_TEST_BUNDLES)
-    string(APPEND _test_flags " -bundle")
-  endif()
   if(NOT BUILD_LIBCURL_DOCS)
     string(APPEND _test_flags " !documentation")
   endif()
index 1707d6eb976f9cebfd4ea4ad5c48a48b0a031009..eec55ab9095a07dd1a98defbbca9e1e38134449a 100644 (file)
@@ -123,9 +123,6 @@ if CROSSCOMPILING
 TEST = @echo "NOTICE: we can't run the tests when cross-compiling!"
 PYTEST = $(TEST)
 else # if not cross-compiling:
-if USE_TEST_BUNDLES
-TEST_COMMON += -bundle
-endif
 
 if BUILD_DOCS
 else
index 633a927bcf1878c6bbf097a8d17b96517b1f41fa..7f379f42a140520dfe1cd552dccdfd9834b43101 100644 (file)
@@ -916,24 +916,20 @@ sub singletest_run {
         # Default the tool to a unit test with the same name as the test spec
         if($keywords{"unittest"} && !$tool) {
             $tool_name="unit$testnum";
-            $tool = $tool_name;
+            $tool = $tool_name . exe_ext('TOOL');
         }
 
         if($tool =~ /^lib/) {
             if($bundle) {
-                $CMDLINE=$LIBDIR . "libtests";
-            }
-            else {
-                $CMDLINE=$LIBDIR . $tool;
+                $tool = "libtests" . exe_ext('TOOL');
             }
+            $CMDLINE=$LIBDIR . $tool;
         }
         elsif($tool =~ /^unit/) {
             if($bundle) {
-                $CMDLINE=$UNITDIR . "units";
-            }
-            else {
-                $CMDLINE=$UNITDIR . $tool;
+                $tool = "units" . exe_ext('TOOL')
             }
+            $CMDLINE=$UNITDIR . $tool;
         }
 
         if(! -f $CMDLINE) {
index ef6b012eba6a7c7a5244f9ecef9af8edc3b22ddd..2c875440d77cf6bd1edfe80e6cdecb40b62b6105 100644 (file)
@@ -96,11 +96,6 @@ Provide a path to a curl binary to talk to APIs (currently only CI test APIs).
 
 Display test results in automake style output (`PASS/FAIL: [number] [name]`).
 
-## `-bundle`
-
-Run tests via bundled test binaries. Bundled test binaries contain all tests,
-and the test name passed as the first argument selects which test run.
-
 ## `-c \<curl\>`
 
 Provide a path to a custom curl binary to run the tests with. Default is the
index e23f809eff786d49a4d9ac42c19f3c707b96550f..f360920b02f61a5b8dcf911b4fa1f0ebb86cc077 100755 (executable)
@@ -88,6 +88,7 @@ use serverhelp qw(
     server_exe
     );
 use pathhelp qw(
+    exe_ext
     sys_native_current_path
     );
 use processhelp qw(
@@ -2280,11 +2281,6 @@ while(@ARGV) {
         $ACURL=shell_quote($ARGV[1]);
         shift @ARGV;
     }
-    elsif ($ARGV[0] eq "-bundle") {
-        # use test bundles
-        $bundle=1;
-        $ENV{'CURL_TEST_BUNDLES'} = 1;
-    }
     elsif ($ARGV[0] eq "-d") {
         # have the servers display protocol output
         $debugprotocol=1;
@@ -2466,7 +2462,6 @@ Usage: runtests.pl [options] [test selection(s)]
   -a       continue even if a test fails
   -ac path use this curl only to talk to APIs (currently only CI test APIs)
   -am      automake style output PASS/FAIL: [number] [name]
-  -bundle  use test bundles
   -c path  use this curl executable
   -d       display server debug info
   -e, --test-event  event-based execution
@@ -2546,6 +2541,15 @@ EOHELP
     shift @ARGV;
 }
 
+# Detect a test bundle build
+if(-e $LIBDIR . "libtests" . exe_ext('TOOL') &&
+   -e $UNITDIR . "units" . exe_ext('TOOL') &&
+   -e $SRVDIR . "servers" . exe_ext('SRV')) {
+    # use test bundles
+    $bundle=1;
+    $ENV{'CURL_TEST_BUNDLES'} = 1;
+}
+
 delete $ENV{'DEBUGINFOD_URLS'} if($ENV{'DEBUGINFOD_URLS'} && $no_debuginfod);
 
 if(!$randseed) {