From 4677f733b21e9eba225674d2e8c4a2ad606d467a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 May 2001 12:09:47 +0000 Subject: pid files fixes, ftp server already-running-but-no-control check --- tests/ftpserver.pl | 2 +- tests/httpserver.pl | 2 +- tests/runtests.pl | 22 ++++++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 0263dce55..2b506c5a6 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -45,7 +45,7 @@ listen(Server,SOMAXCONN) || die "listen: $!"; #print "FTP server started on port $port\n"; -open(PID, ">.ftpserver.pid"); +open(PID, ">.ftp.pid"); print PID $$; close(PID); diff --git a/tests/httpserver.pl b/tests/httpserver.pl index 0180dfb14..7bce3ec10 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -33,7 +33,7 @@ if($verbose) { print "HTTP server started on port $port\n"; } -open(PID, ">.server.pid"); +open(PID, ">.http.pid"); print PID $$; close(PID); diff --git a/tests/runtests.pl b/tests/runtests.pl index 7e5c29ef3..c3c76ed66 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -8,7 +8,9 @@ use strict; -use stunnel; +@INC=(@INC, $ENV{'srcdir'}, "."); + +require "stunnel.pm"; my $srcdir = $ENV{'srcdir'} || '.'; my $HOSTIP="127.0.0.1"; @@ -34,10 +36,10 @@ my $TESTCASES="all"; # No variables below this point should need to be modified # -my $HTTPPIDFILE=".server.pid"; +my $HTTPPIDFILE=".http.pid"; my $HTTPSPIDFILE=".https.pid"; -my $FTPPIDFILE=".ftps.pid"; -my $FTPSPIDFILE=".ftpsserver.pid"; +my $FTPPIDFILE=".ftp.pid"; +my $FTPSPIDFILE=".ftps.pid"; # this gets set if curl is compiled with memory debugging: my $memory_debug=0; @@ -191,11 +193,22 @@ sub runftpserver { if ($pid <= 0) { my $flag=$debugprotocol?"-v ":""; + + # verify that our server is NOT running on this port: + my $data=`$CURL --silent -i ftp://$HOSTIP:$FTPPORT/verifiedserver`; + + if ( $data =~ /WE ROOLZ/ ) { + print "A previous FTP server session is already running and we ", + "can't kill it!\n"; + exit; + } + if($debugprotocol) { print "* Starts ftp server verbose:\n"; print "perl $srcdir/ftpserver.pl $flag $FTPPORT &\n"; } system("perl $srcdir/ftpserver.pl $flag $FTPPORT &"); + if($verbose) { print "ftpd started\n"; } @@ -475,6 +488,7 @@ sub singletest { $cmd =~ s/%HTTPSPORT/$HTTPSPORT/g; $cmd =~ s/%FTPPORT/$FTPPORT/g; $cmd =~ s/%FTPSPORT/$FTPSPORT/g; + $cmd =~ s/%SRCDIR/$srcdir/g; #$cmd =~ s/%HOSTNAME/$HOSTNAME/g; if($memory_debug) { -- cgit v1.2.3