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
This commit is contained in:
Viktor Szakats 2025-08-02 13:15:28 +02:00
parent 37ac4498ee
commit 985f39c0ce
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
5 changed files with 29 additions and 13 deletions

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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;