aboutsummaryrefslogtreecommitdiff
path: root/tests/runtests.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-17 07:59:10 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-17 07:59:10 +0000
commit5b0bfc298ff7eb72e6c4a27d6153821240cd4138 (patch)
treec5cf7b19ebf87caefc9fb7f1237da0003ff612f0 /tests/runtests.pl
parent0383f7f19dfdb8ad66797a338aa95fe7b3287d83 (diff)
improved the check for our own ftp server
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-xtests/runtests.pl47
1 files changed, 28 insertions, 19 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index b942dac18..7a7081630 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -448,25 +448,25 @@ sub runftpserver {
print "RUN: Check port $FTPPORT for our own FTP server\n"
if ($verbose);
-
my $time=time();
# check if this is our server running on this port:
- my $data=`$CURL -m4 --silent -i ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`;
+ my @data=`$CURL -m4 --silent ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`;
+ my $line;
# if this took more than 2 secs, we assume it "hung" on a weird server
my $took = time()-$time;
-
- if ( $data =~ /WE ROOLZ: (\d+)/ ) {
- # this is our test server with a known pid!
- $pid = 0+$1;
- }
- else {
- if($data || ($took > 2)) {
- # this is not a known server
- print "RUN: Unknown server on our favourite port: $FTPPORT\n";
- return -1;
+
+ foreach $line (@data) {
+ if ( $line =~ /WE ROOLZ: (\d+)/ ) {
+ # this is our test server with a known pid!
+ $pid = 0+$1;
}
}
+ if(!$pid || ($took > 2)) {
+ # this is not a known server
+ print "RUN: Unknown server on our favourite port: $FTPPORT\n";
+ return -1;
+ }
}
if($pid > 0) {
@@ -490,22 +490,31 @@ sub runftpserver {
system($cmd);
my $verified;
+ $pid = 0;
for(1 .. 10) {
# verify that our server is up and running:
- my $data=`$CURL --silent -i ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`;
-
- if ( $data =~ /WE ROOLZ: (\d+)/ ) {
- $pid = 0+$1;
- $verified = 1;
- last;
+ my $line;
+ my $cmd="$CURL --silent ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null";
+ print "$cmd\n" if($verbose);
+ my @data = `$cmd`;
+ foreach $line (@data) {
+ print STDERR "We read: $_";
+ if ( $line =~ /WE ROOLZ: (\d+)/ ) {
+ $pid = 0+$1;
+ $verified = 1;
+ last;
+ }
}
- else {
+ if(!$pid) {
if($verbose) {
print STDERR "RUN: Retrying FTP server existence in 3 sec\n";
}
sleep(3);
next;
}
+ else {
+ last;
+ }
}
if(!$verified) {
warn "RUN: failed to start our FTP server\n";