From: Viktor Szakats Date: Sun, 14 Dec 2025 08:42:59 +0000 (+0100) Subject: runtests: improve XML prolog check, enable `-w` permanently, fix two tests X-Git-Tag: rc-8_18_0-2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=187e219616dce058d9d3dd5eb126d2ab6d3dc9c7;p=thirdparty%2Fcurl.git runtests: improve XML prolog check, enable `-w` permanently, fix two tests 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 --- diff --git a/docs/runtests.md b/docs/runtests.md index bb64b412df..c81172403a 100644 --- a/docs/runtests.md +++ b/docs/runtests.md @@ -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 \` Provide a path to a custom curl binary to run when verifying that the servers diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dd8c274a33..da8e02677c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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") diff --git a/tests/Makefile.am b/tests/Makefile.am index 6c48328ae1..27657657a8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 # ~ 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 diff --git a/tests/data/test1665 b/tests/data/test1665 index 24083582b4..ccb016a5e7 100644 --- a/tests/data/test1665 +++ b/tests/data/test1665 @@ -1,3 +1,4 @@ + @@ -5,7 +6,6 @@ HTTP -# # Server-side @@ -22,7 +22,6 @@ Funny-head: swsclose -# # Client-side @@ -36,7 +35,6 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER -# # Verify data after the test has been "shot" diff --git a/tests/data/test798 b/tests/data/test798 index 07f44fea2a..cb415ee2a3 100644 --- a/tests/data/test798 +++ b/tests/data/test798 @@ -1,3 +1,4 @@ + @@ -7,9 +8,8 @@ cookies cookiejar -# Server-side -# +# Server-side HTTP/1.1 200 OK diff --git a/tests/getpart.pm b/tests/getpart.pm index 9883db22b0..03c3dc6287 100644 --- a/tests/getpart.pm +++ b/tests/getpart.pm @@ -244,12 +244,6 @@ sub loadtest { print STDERR "file $file is empty!\n"; return 1; } - my $prolog = $xml[0]; - chomp $prolog; - if($prolog ne '') { - 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, '') != 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"; diff --git a/tests/globalconfig.pm b/tests/globalconfig.pm index 0c18a1ea6b..d99d4306cf 100644 --- a/tests/globalconfig.pm +++ b/tests/globalconfig.pm @@ -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 diff --git a/tests/runner.pm b/tests/runner.pm index 31e3fd6221..8589f74640 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -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; } diff --git a/tests/runtests.pl b/tests/runtests.pl index d1a1e40935..babec70858 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -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