← Commit list

e669179681

Daniel Stenberg
Daniel Stenberg
2026-08-18
SUCCESS Duration: 417s

Subject

runtests: introduce a subset option

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

docs/runtests.md+18 -0
@@ -260,6 +260,24 @@ script randomly discards entries to fail until the amount is **num**.
The random seed initially set for this is fixed per month and can be set with
*--seed*.
+## `--subset=<section>/<parts>`
+
+Tell runtests to run a subset of the available tests. The test selection is
+done first based on existing options. The list of selected tests is then
+divided into a number of *parts*. The selected *section* specifier is the
+set of tests this invoke runs. Note that both numbers must be provided and
+*section* is zero indexed so it must be smaller than *parts*.
+
+Using this option you can for example split up an identical test run into
+three separate invokes that combined run all the tests:
+
+ ./runtests.pl --subset=0/3
+ ./runtests.pl --subset=1/3
+ ./runtests.pl --subset=2/3
+
+This option works fine in combination with `-R` but consider also using
+`--seed` for that.
+
## `-t[num]`
Selects a **torture** test for the given tests. This makes runtests.pl first
tests/runtests.pl+29 -0
@@ -2355,6 +2355,8 @@ $args = join(' ', @ARGV);
$valgrind = checktestcmd("valgrind");
my $number = 0;
my $fromnum = -1;
+my $useshares;
+my $usepart;
my @testthis;
while(@ARGV) {
if($ARGV[0] eq "-v") {
@@ -2470,6 +2472,14 @@ while(@ARGV) {
$tortalloc = $1;
}
}
+ elsif($ARGV[0] =~ /^--subset=(\d+)\/(\d+)$/) {
+ # split all tests into $2 parts.
+ # this invoke then runs the part number $1 (0-indexed)
+ ($usepart, $useshares) = ($1, $2);
+ if($useshares < 1 || $usepart >= $useshares) {
+ die "illegal subset specified";
+ }
+ }
elsif($ARGV[0] =~ /--shallow=(\d+)/) {
# Fail no more than this amount per tests when running
# torture.
@@ -2897,6 +2907,25 @@ if($scrambleorder) {
$TESTCASES = join(" ", @rand);
}
+if($useshares) {
+ my @a = grep { length($_) } split(/ +/, $TESTCASES);
+ my $n = scalar(@a);
+
+ if($useshares < 1 || $usepart >= $useshares) {
+ die "illegal subset specified";
+ }
+
+ my $start = int(($n * $usepart) / $useshares);
+ my $end = int(($n * ($usepart + 1)) / $useshares); # one past last index
+ my $run = $end - $start;
+
+ printf STDERR "Subset: 1/%u of the tests (run %u tests out of %u). Part %u\n",
+ $useshares, $run, $n, $usepart;
+
+ my @s = $run ? @a[$start .. $end - 1] : ();
+ $TESTCASES = join(" ", @s);
+}
+
# Display the contents of the given file. Line endings are canonicalized
# and excessively long files are elided
sub displaylogcontent {