aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-01-20 22:48:43 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-01-20 22:48:43 +0000
commit291a908f195d462c91abd8eabfae55a0cf8c8181 (patch)
treecc93afd4c62c9025ad49128eef149ec240aa1c49 /tests
parentb264a03f891551c442eaff048f6e81ae74d450c1 (diff)
Added support for "verify" => "stripfile" to strip contents of the file that
is being checked. Also made the server retrying sleep only one second instead of three, to reduce some waiting when fooling around with the servers.
Diffstat (limited to 'tests')
-rw-r--r--tests/FILEFORMAT4
-rwxr-xr-xtests/runtests.pl38
2 files changed, 29 insertions, 13 deletions
diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT
index 58d37410e..d41a05205 100644
--- a/tests/FILEFORMAT
+++ b/tests/FILEFORMAT
@@ -187,6 +187,10 @@ This verfies that this data was passed to stdout.
<file name="log/filename">
the file's contents must be identical to this
</file>
+<stripfile>
+One perl op per line that operates on the file before being compared. This is
+pretty advanced. Example: "s/^EPRT .*/EPRT stripped/"
+</stripfile>
<upload>
the contents of the upload data curl should have sent
</upload>
diff --git a/tests/runtests.pl b/tests/runtests.pl
index f2e31b864..90e247293 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -49,6 +49,7 @@ my $LOGDIR="log";
my $TESTDIR="$srcdir/data";
my $LIBDIR="./libtest";
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
+my $SERVER2IN="$LOGDIR/server2.input"; # what curl sent the second server
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
@@ -409,7 +410,7 @@ sub runhttpserver {
}
my $verified;
- for(1 .. 10) {
+ for(1 .. 30) {
# verify that our server is up and running:
my $data=`$CURL --silent -g \"$ip:$port/verifiedserver\" 2>/dev/null`;
@@ -420,9 +421,9 @@ sub runhttpserver {
}
else {
if($verbose) {
- print STDERR "RUN: Retrying HTTP$nameext server existence in 3 sec\n";
+ print STDERR "RUN: Retrying HTTP$nameext server existence in 1 sec\n";
}
- sleep(3);
+ sleep(1);
next;
}
}
@@ -468,14 +469,14 @@ sub runhttpsserver {
}
sleep(1);
- for(1 .. 10) {
+ for(1 .. 30) {
$pid=checkserver($HTTPSPIDFILE);
if($pid <= 0) {
if($verbose) {
- print STDERR "RUN: waiting 3 sec for HTTPS server\n";
+ print STDERR "RUN: waiting one sec for HTTPS server\n";
}
- sleep(3);
+ sleep(1);
}
else {
last;
@@ -546,7 +547,7 @@ sub runftpserver {
my $verified;
$pid = 0;
- for(1 .. 10) {
+ for(1 .. 30) {
# verify that our server is up and running:
my $line;
my $cmd="$CURL --silent ftp://$HOSTIP:$port/verifiedserver 2>/dev/null";
@@ -561,9 +562,9 @@ sub runftpserver {
}
if(!$pid) {
if($verbose) {
- print STDERR "RUN: Retrying FTP$id server existence in 3 sec\n";
+ print STDERR "RUN: Retrying FTP$id server existence in a sec\n";
}
- sleep(3);
+ sleep(1);
next;
}
else {
@@ -611,15 +612,15 @@ sub runftpsserver {
}
sleep(1);
- for(1 .. 10) {
+ for(1 .. 30) {
$pid=checkserver($FTPSPIDFILE );
if($pid <= 0) {
if($verbose) {
- print STDERR "RUN: waiting 3 sec for FTPS server\n";
+ print STDERR "RUN: waiting one sec for FTPS server\n";
}
- sleep(3);
+ sleep(1);
}
else {
last;
@@ -1046,8 +1047,9 @@ sub singletest {
chomp $tool;
}
- # remove previous server output logfile
+ # remove server output logfiles
unlink($SERVERIN);
+ unlink($SERVER2IN);
if(@ftpservercmd) {
# write the instructions to file
@@ -1338,6 +1340,16 @@ sub singletest {
}
my @generated=loadarray($filename);
+ # what parts to cut off from the file
+ my @stripfile = getpart("verify", "stripfile");
+ my $strip;
+ for $strip (@stripfile) {
+ chomp $strip;
+ for(@generated) {
+ eval $strip;
+ }
+ }
+
$res = compare("output", \@generated, \@outfile);
if($res) {
return 1;