]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: improve XML prolog check, enable `-w` permanently, fix two tests
authorViktor Szakats <commit@vsz.me>
Sun, 14 Dec 2025 08:42:59 +0000 (09:42 +0100)
committerViktor Szakats <commit@vsz.me>
Sun, 14 Dec 2025 11:26:38 +0000 (12:26 +0100)
To really verify the presence of the XML prolog, also in CI.

- move the prolog check from `loadtest` to `checktest`.
  (load did a soft error, silently skipping the test instead of failing)
- runtests: enable `-w` functionality permanently for all test targets,
  drop the option. It has no measurable performance impact.
- test 798, 1665: add XML prolog.
  Follow-up to f0d277cb0e3712ae4edf8f51822ffa99e9b3ec54

Follow-up to b5ea0736bbeeae717925d8eccbdb15057d8e88e9 #19946
Follow-up to 904e7ecb66519951681377758fe6b07dde28ce36 #19347

Closes #19970

docs/runtests.md
tests/CMakeLists.txt
tests/Makefile.am
tests/data/test1665
tests/data/test798
tests/getpart.pm
tests/globalconfig.pm
tests/runner.pm
tests/runtests.pl

index bb64b412df2f4b896501b977dfe17763d0932625..c81172403a17b6829487e8dbe9aa42ed886bbbad 100644 (file)
@@ -298,10 +298,6 @@ Enable verbose output. Speaks more than by default. If used in conjunction
 with parallel testing, it is difficult to associate the logs with the specific
 test being run.
 
-## `-w`
-
-Verify test data.
-
 ## `-vc \<curl\>`
 
 Provide a path to a custom curl binary to run when verifying that the servers
index dd8c274a33adb3e2a65ca1437e7205f5b712dec5..da8e02677c07c752b7d0071f6bf1fbcdb93cf095 100644 (file)
@@ -120,15 +120,15 @@ configure_file(
   "${CMAKE_CURRENT_SOURCE_DIR}/configurehelp.pm.in"
   "${CMAKE_CURRENT_BINARY_DIR}/configurehelp.pm" @ONLY)
 
-curl_add_runtests(tests          "-a -w")  # Avoid 'test', which is a reserved target name in CMake
-curl_add_runtests(test-quiet     "-a -w -s")
-curl_add_runtests(test-am        "-a -w -am")
-curl_add_runtests(test-full      "-a -w -p -r")
+curl_add_runtests(tests          "-a")  # Avoid 'test', which is a reserved target name in CMake
+curl_add_runtests(test-quiet     "-a -s")
+curl_add_runtests(test-am        "-a -am")
+curl_add_runtests(test-full      "-a -p -r")
 # ~flaky means that it ignores results of tests using the flaky keyword
-curl_add_runtests(test-nonflaky  "-a -w -p ~flaky ~timing-dependent")
+curl_add_runtests(test-nonflaky  "-a -p ~flaky ~timing-dependent")
 curl_add_runtests(test-ci        "-a -p ~flaky ~timing-dependent -r --retry=5 -j20 --buildinfo")
-curl_add_runtests(test-torture   "-a -w -t -j20")
-curl_add_runtests(test-event     "-a -w -e")
+curl_add_runtests(test-torture   "-a -t -j20")
+curl_add_runtests(test-event     "-a -e")
 
 curl_add_pytests(curl-pytest      "-n auto")
 curl_add_pytests(curl-pytest-ci   "-n auto -v")
index 6c48328ae1098c299217c3e28b529b76eb4f0d31..27657657a8d9cbf05ee266322cf03fd1d5e19564 100644 (file)
@@ -118,18 +118,18 @@ TEST_COMMON += !documentation
 endif
 
 TEST = srcdir=$(srcdir) @PERL@ $(PERLFLAGS) $(srcdir)/runtests.pl $(TEST_COMMON)
-TEST_Q = -a -w -s
-TEST_AM = -a -w -am
-TEST_F = -a -w -p -r
-TEST_T = -a -w -t -j20
-TEST_E = -a -w -e
+TEST_Q = -a -s
+TEST_AM = -a -am
+TEST_F = -a -p -r
+TEST_T = -a -t -j20
+TEST_E = -a -e
 
 # ~<keyword> means that it runs all tests matching the keyword, but ignores
 # their results (since these ones are likely to fail for no good reason)
-TEST_NF = -a -w -p ~flaky ~timing-dependent
+TEST_NF = -a -p ~flaky ~timing-dependent
 
 # special target for CI use
-TEST_CI = -a -p ~flaky ~timing-dependent -r --retry=5 -j20 --buildinfo
+TEST_CI = $(TEST_NF) -r --retry=5 -j20 --buildinfo
 
 PYTEST = pytest
 endif
index 24083582b4606281bb07adb0c416474a77e9a125..ccb016a5e77789be035888ae6706060bfedfe33c 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="US-ASCII"?>
 <testcase>
 <info>
 <keywords>
@@ -5,7 +6,6 @@ HTTP
 </keywords>
 </info>
 
-#
 # Server-side
 <reply>
 <data>
@@ -22,7 +22,6 @@ Funny-head: swsclose
 </data>
 </reply>
 
-#
 # Client-side
 <client>
 <server>
@@ -36,7 +35,6 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
 </command>
 </client>
 
-#
 # Verify data after the test has been "shot"
 <verify>
 <protocol crlf="headers">
index 07f44fea2abd164b8fff856e6236c739fe3dfcfd..cb415ee2a302770363e458331a230490f42c5d3b 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="US-ASCII"?>
 <testcase>
 <info>
 <keywords>
@@ -7,9 +8,8 @@ cookies
 cookiejar
 </keywords>
 </info>
-# Server-side
-#
 
+# Server-side
 <reply>
 <data crlf="headers" nocheck="yes">
 HTTP/1.1 200 OK
index 9883db22b0b674c9141f4d8403430c0714715c02..03c3dc6287ea827b47b94593b9d7c1f4eb17723a 100644 (file)
@@ -244,12 +244,6 @@ sub loadtest {
             print STDERR "file $file is empty!\n";
             return 1;
         }
-        my $prolog = $xml[0];
-        chomp $prolog;
-        if($prolog ne '<?xml version="1.0" encoding="US-ASCII"?>') {
-            print STDERR "file $file missing the XML prolog!\n";
-            return 1;
-        }
     }
     else {
         # failure
@@ -297,6 +291,11 @@ sub checktest {
         my $content = do { local $/; <$xmlh> };
         close($xmlh);
 
+        if(index($content, '<?xml version="1.0" encoding="US-ASCII"?>') != 0) {
+            print STDERR "*** getpart.pm: $xmlfile is missing the XML prolog.\n";
+            return 1;
+        }
+
         my $eol = eol_detect($content);
         if($eol eq '') {
             print STDERR "*** getpart.pm: $xmlfile has mixed newlines. Replace significant carriage return with %CR macro, or convert to consistent newlines.\n";
index 0c18a1ea6b0106358f7bccbf527d2342f2a517de..d99d4306cf2b0919b5a10fdfc3e52bea7923937e 100644 (file)
@@ -75,7 +75,6 @@ BEGIN {
         %keywords
         @protocols
         $dev_null
-        $checktests
     );
 }
 use pathhelp qw(
@@ -96,7 +95,6 @@ our $torture;         # 1 to enable torture testing
 our $proxy_address;   # external HTTP proxy address
 our $listonly;        # only list the tests
 our $buildinfo;       # dump buildinfo.txt
-our $checktests;      # 1 to run a check on test data
 our $run_duphandle;   # run curl with --test-duphandle to verify handle duplication
 our $run_event_based; # run curl with --test-event to test the event API
 our $automakestyle;   # use automake-like test status output format
index 31e3fd6221329d992714535eb856c632e10ebbd2..8589f746406f17717b228f0ce9d851cb27c1a678 100644 (file)
@@ -1162,7 +1162,7 @@ sub singletest_postcheck {
         }
     }
 
-    if($checktests && checktest("${TESTDIR}/test${testnum}")) {
+    if(checktest("${TESTDIR}/test${testnum}")) {
         logmsg " $testnum: postcheck FAILED: issue(s) found in test data\n";
         return -1;
     }
index d1a1e40935aebd18b8503a127dfc6c5cdcb48786..babec70858fd7a72b66ca47b088db67df7abca99 100755 (executable)
@@ -1179,7 +1179,7 @@ sub singletest_shouldrun {
         }
     }
 
-    if($why && $checktests && checktest("${TESTDIR}/test${testnum}")) {
+    if($why && checktest("${TESTDIR}/test${testnum}")) {
         logmsg "Warning: issue(s) found in test data: ${TESTDIR}/test${testnum}\n";
     }
 
@@ -2419,10 +2419,6 @@ while(@ARGV) {
         # execute in scrambled order
         $scrambleorder=1;
     }
-    elsif($ARGV[0] eq "-w") {
-        # verify test data
-        $checktests=1;
-    }
     elsif($ARGV[0] =~ /^-t(.*)/) {
         # torture
         $torture=1;
@@ -2568,7 +2564,6 @@ Usage: runtests.pl [options] [test selection(s)]
   -u       error instead of warning on server unexpectedly alive
   -v       verbose output
   -vc path use this curl only to verify the existing servers
-  -w       check test data
   [num]    like "5 6 9" or " 5 to 22 " to run those tests only
   [!num]   like "!5 !6 !9" to disable those tests
   [~num]   like "~5 ~6 ~9" to ignore the result of those tests