diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-11-02 23:09:25 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-11-02 23:09:25 +0000 |
commit | 3bfa06c9a2e3d53ae2b2ca1a1841429623f1f12e (patch) | |
tree | dbec9de2a0b026cf18cbf38657a4916b972664ac /tests | |
parent | f34573c8e257a61925f8980bc814adb93133c79d (diff) |
improved functionality for new timeout tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FILEFORMAT | 8 | ||||
-rw-r--r-- | tests/ftpserver.pl | 10 | ||||
-rwxr-xr-x | tests/httpserver.pl | 20 |
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index 40fab2406..8f4a77ebb 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -23,6 +23,14 @@ if the data is sent but this is what should be checked afterwards <size> number to return on a ftp SIZE command </size> +<cmd> +special purpose server-command to control its behavior *before* the +reply is sent +</cmd> +<postcmd> +special purpose server-command to control its behavior *after* the +reply is sent +</oistcmd> </reply> <client> diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 956ff4d85..ef3478775 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -326,6 +326,7 @@ sub PORT_command { $SIG{CHLD} = \&REAPER; my %customreply; +my %delayreply; sub customize { undef %customreply; open(CUSTOM, "<log/ftpserver.cmd") || @@ -337,6 +338,9 @@ sub customize { if($_ =~ /REPLY ([A-Z]+) (.*)/) { $customreply{$1}=$2; } + elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) { + $delayreply{$1}=$2; + } } close(CUSTOM); } @@ -416,6 +420,12 @@ for ( $waitedpid = 0; $state = $newstate; } + my $delay = $delayreply{$FTPCMD}; + if($delay) { + # just go sleep this many seconds! + sleep($delay); + } + my $text; $text = $customreply{$FTPCMD}; my $fake = $text; diff --git a/tests/httpserver.pl b/tests/httpserver.pl index 9b409a9ed..2bbf839dd 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -50,6 +50,16 @@ sub REAPER { logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ''); } +sub performcmd { + my @cmd = @_; + for(@cmd) { + if($_ =~ /^ *wait *(\d*)/) { + # instructed to sleep! + sleep($1); + } + } +} + $SIG{CHLD} = \&REAPER; for ( $waitedpid = 0; @@ -164,6 +174,14 @@ for ( $waitedpid = 0; } loadtest("data/test$testnum"); + + + my @cmd = getpart("reply", "cmd"); + performcmd(@cmd); + + # flush data: + $| = 1; + # send a custom reply to the client my @data = getpart("reply", "data$part"); for(@data) { @@ -172,6 +190,8 @@ for ( $waitedpid = 0; print STDERR "OUT: $_"; } } + my @postcmd = getpart("reply", "postcmd"); + performcmd(@postcmd); } } # print "Hello there, $name, it's now ", scalar localtime, "\r\n"; |