aboutsummaryrefslogtreecommitdiff
path: root/tests/getpart.pm
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-17 09:58:42 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-18 22:46:04 +0200
commitd009bc2e565844db030d7098624b39b2903a808d (patch)
tree1ccef4e0c1a22960befd8bd413d6fc34e264e806 /tests/getpart.pm
parent5e2f4a33fe663c2ae8cc92c02193a7261c524867 (diff)
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.
Diffstat (limited to 'tests/getpart.pm')
-rw-r--r--tests/getpart.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index 35ab30cb5..9519888ee 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -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.