1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-03 02:41:59 -05:00

runtests: preprocess DISABLED to allow conditionals

... with this function provided, we can disable tests for specific
environments and setups directly within this file.

Closes #6477
This commit is contained in:
Daniel Stenberg 2021-01-18 09:35:29 +01:00
parent bbfad7e8a1
commit f451206266
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -5257,12 +5257,6 @@ sub runtimestats {
logmsg "\n"; logmsg "\n";
} }
# globally disabled tests
disabledtests("$TESTDIR/DISABLED");
# locally disabled tests, ignored by git etc
disabledtests("$TESTDIR/DISABLED.local");
####################################################################### #######################################################################
# Check options to this test program # Check options to this test program
# #
@ -5574,12 +5568,16 @@ if(!$listonly) {
checksystem(); checksystem();
} }
# globally disabled tests
disabledtests("$TESTDIR/DISABLED");
####################################################################### #######################################################################
# Fetch all disabled tests, if there are any # Fetch all disabled tests, if there are any
# #
sub disabledtests { sub disabledtests {
my ($file) = @_; my ($file) = @_;
my @input;
if(open(D, "<$file")) { if(open(D, "<$file")) {
while(<D>) { while(<D>) {
@ -5587,17 +5585,29 @@ sub disabledtests {
# allow comments # allow comments
next; next;
} }
if($_ =~ /(\d+)/) { push @input, $_;
}
close(D);
# preprocess the input to make conditionally disabled tests depending
# on variables
my @pp = prepro(@input);
for my $t (@pp) {
if($t =~ /(\d+)/) {
my ($n) = $1; my ($n) = $1;
$disabled{$n}=$n; # disable this test number $disabled{$n}=$n; # disable this test number
if(! -f "$srcdir/data/test$n") { if(! -f "$srcdir/data/test$n") {
print STDERR "WARNING! Non-existing test $n in DISABLED!\n"; print STDERR "WARNING! Non-existing test $n in $file!\n";
# fail hard to make user notice # fail hard to make user notice
exit 1; exit 1;
} }
logmsg "DISABLED: test $n\n" if ($verbose);
}
else {
print STDERR "$file: rubbish content: $t\n";
exit 2;
} }
} }
close(D);
} }
} }