aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-11-27 12:53:32 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-11-27 12:53:32 +0000
commit989ff585b15e7588bb4e0ff9b47024c0f82be3c4 (patch)
tree67f402efefa760a063a53fefb9954f45780d0f21 /tests
parentf589c1c024a9f70acc00e3125b76d6486cb8148d (diff)
allows simple custom modifications for single test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/ftpserver.pl40
1 files changed, 34 insertions, 6 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index e603f8275..918df0ca7 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -298,6 +298,24 @@ sub PORT_command {
$SIG{CHLD} = \&REAPER;
+my %customreply;
+sub customize {
+ open(CUSTOM, "<log/ftpserver.cmd") ||
+ return 1;
+
+ if($verbose) {
+ print STDERR "FTPD: Getting commands from log/ftpserver.cmd\n";
+ }
+
+ undef %customreply;
+ while(<CUSTOM>) {
+ if($_ =~ /REPLY ([A-Z]+) (.*)/) {
+ $customreply{$1}=$2;
+ }
+ }
+ close(CUSTOM);
+}
+
my @welcome=(
'220- _ _ ____ _ '."\r\n",
'220- ___| | | | _ \| | '."\r\n",
@@ -327,6 +345,8 @@ for ( $waitedpid = 0;
FTPLOG->autoflush(1);
INPUT->autoflush(1);
+ &customize(); # read test control instructions
+
print @welcome;
my $state="fresh";
@@ -367,16 +387,24 @@ for ( $waitedpid = 0;
$state = $newstate;
}
- my $text = $displaytext{$FTPCMD};
+ my $text;
+ $text = $customreply{$FTPCMD};
+ my $fake = $text;
+ if($text eq "") {
+ $text = $displaytext{$FTPCMD};
+ }
if($text) {
print "$text\r\n";
}
- # see if the new state is a function caller.
- my $func = $commandfunc{$FTPCMD};
- if($func) {
- # it is!
- \&$func($FTPARG);
+ if($fake eq "") {
+ # only perform this if we're not faking a reply
+ # see if the new state is a function caller.
+ my $func = $commandfunc{$FTPCMD};
+ if($func) {
+ # it is!
+ \&$func($FTPARG);
+ }
}
logmsg "set to state $state\n";