From 291a908f195d462c91abd8eabfae55a0cf8c8181 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 20 Jan 2005 22:48:43 +0000 Subject: [PATCH] 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. --- tests/FILEFORMAT | 4 ++++ tests/runtests.pl | 38 +++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index 58d3741..d41a052 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -187,6 +187,10 @@ This verfies that this data was passed to stdout. the file's contents must be identical to this + +One perl op per line that operates on the file before being compared. This is +pretty advanced. Example: "s/^EPRT .*/EPRT stripped/" + the contents of the upload data curl should have sent diff --git a/tests/runtests.pl b/tests/runtests.pl index f2e31b8..90e2472 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; -- 2.7.4