From: Viktor Szakats Date: Sat, 2 Aug 2025 11:15:28 +0000 (+0200) Subject: runtests: add `--ci` option, show `Env:` only when non-empty X-Git-Tag: curl-8_16_0~269 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=985f39c0ce78b546e832c250588c14023123edfb;p=thirdparty%2Fcurl.git runtests: add `--ci` option, show `Env:` only when non-empty To reduce log noise in local test runs: - move the `buildinfo.txt` dump and header info lines `OS:`, `Perl:`, `diff:` behind a `--ci` `runtests.pl` option. - enable this option for the CI test targets. - hide `Env:` header info line if empty. - merge `Env:` output into a single `logmsg()` call. Closes #18147 --- diff --git a/docs/runtests.md b/docs/runtests.md index 5c3c339a1f..0742444c54 100644 --- a/docs/runtests.md +++ b/docs/runtests.md @@ -101,6 +101,10 @@ Display test results in automake style output (`PASS/FAIL: [number] [name]`). Provide a path to a custom curl binary to run the tests with. Default is the curl executable in the build tree. +## `--ci` + +Show extra information useful in for CI runs. + ## `-d` Enable protocol debug: have the servers display protocol output. If used in diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 33c64906e8..56241b889a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -120,7 +120,7 @@ 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 -p ~flaky ~timing-dependent") -curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20") +curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20 --ci") curl_add_runtests(test-torture "-a -t -j20") curl_add_runtests(test-event "-a -e") diff --git a/tests/Makefile.am b/tests/Makefile.am index 91102004d0..3894355fe9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -129,7 +129,7 @@ TEST_E = -a -e TEST_NF = -a -p ~flaky ~timing-dependent # special CI target derived from nonflaky with CI-specific flags -TEST_CI = $(TEST_NF) -r --retry=5 -j20 +TEST_CI = $(TEST_NF) -r --retry=5 -j20 --ci PYTEST = pytest endif diff --git a/tests/globalconfig.pm b/tests/globalconfig.pm index 83c4ccbaed..9fa436d8bb 100644 --- a/tests/globalconfig.pm +++ b/tests/globalconfig.pm @@ -46,6 +46,7 @@ BEGIN { $TUNITDIR $SRVDIR $listonly + $ci $LOCKDIR $LOGDIR $memanalyze @@ -94,6 +95,7 @@ our $verbose; # 1 to show verbose test output our $torture; # 1 to enable torture testing our $proxy_address; # external HTTP proxy address our $listonly; # only list the tests +our $ci; # show extra info useful in CI runs 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/runtests.pl b/tests/runtests.pl index dfa35aaea5..f2e2a6fdb0 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -872,11 +872,13 @@ sub checksystemfeatures { "* Features: $feat\n", "* Disabled: $dis\n", "* Host: $hostname\n", - "* System: $hosttype\n", - "* OS: $hostos\n", - "* Perl: $^V ($^X)\n", - "* diff: $havediff\n", - "* Args: $args\n"); + "* System: $hosttype\n"); + if($ci) { + logmsg("* OS: $hostos\n", + "* Perl: $^V ($^X)\n", + "* diff: $havediff\n"); + } + logmsg("* Args: $args\n"); if($jobs) { # Only show if not the default for now @@ -890,11 +892,15 @@ sub checksystemfeatures { $feature{"TrackMemory"} = 0; } - logmsg sprintf("* Env: %s%s%s%s", $valgrind?"Valgrind ":"", - $run_duphandle?"test-duphandle ":"", - $run_event_based?"event-based ":"", - $nghttpx_h3); - logmsg sprintf("%s\n", $libtool?"Libtool ":""); + my $env = sprintf("%s%s%s%s%s", + $valgrind?"Valgrind ":"", + $run_duphandle?"test-duphandle ":"", + $run_event_based?"event-based ":"", + $nghttpx_h3, + $libtool?"Libtool ":""); + if($env) { + logmsg "* Env: $env\n"; + } logmsg "* Seed: $randseed\n"; } @@ -2423,6 +2429,9 @@ while(@ARGV) { # lists the test case names only $listonly=1; } + elsif($ARGV[0] eq "--ci") { + $ci=1; + } elsif($ARGV[0] =~ /^-j(.*)/) { # parallel jobs $jobs=1; @@ -2477,6 +2486,7 @@ Usage: runtests.pl [options] [test selection(s)] -ac path use this curl only to talk to APIs (currently only CI test APIs) -am automake style output PASS/FAIL: [number] [name] -c path use this curl executable + --ci show extra info useful in for CI runs (e.g. buildinfo.txt dump) -d display server debug info -e, --test-event event-based execution --test-duphandle duplicate handles before use @@ -2664,7 +2674,7 @@ if(!$listonly) { ####################################################################### # Output information about the curl build # -if(!$listonly) { +if(!$listonly && $ci) { if(open(my $fd, "<", "../buildinfo.txt")) { while(my $line = <$fd>) { chomp $line;