aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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";