mirror of
https://github.com/curl/curl.git
synced 2026-07-27 05:58:06 +03:00
tests: introduce preprocessed test cases
The runtests script now always performs variable replacement on the entire test source file before the test gets executed, and saves the updated version in a temporary file (log/test[num]) so that all test case readers/servers can use that version (if present) and thus enjoy the powers of test case variable substitution. This is necessary to allow complete port number freedom. Test 309 is updated to work with a non-fixed port number thanks to this.
This commit is contained in:
parent
5e2f4a33fe
commit
d009bc2e56
10 changed files with 171 additions and 177 deletions
|
|
@ -209,6 +209,31 @@ sub loadtest {
|
|||
return 0;
|
||||
}
|
||||
|
||||
sub fulltest {
|
||||
return @xml;
|
||||
}
|
||||
|
||||
# write the test to the given file
|
||||
sub savetest {
|
||||
my ($file)=@_;
|
||||
|
||||
if(open(XML, ">$file")) {
|
||||
binmode XML; # for crapage systems, use binary
|
||||
for(@xml) {
|
||||
print XML $_;
|
||||
}
|
||||
close(XML);
|
||||
}
|
||||
else {
|
||||
# failure
|
||||
if($warning) {
|
||||
print STDERR "file $file wouldn't open!\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#
|
||||
# Strip off all lines that match the specified pattern and return
|
||||
# the new array.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue