]> granicus.if.org Git - curl/commitdiff
don't use 'strict' anymore, as it doesn't work good with the cygwin fixes
authorDaniel Stenberg <daniel@haxx.se>
Wed, 17 Oct 2001 11:51:02 +0000 (11:51 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 17 Oct 2001 11:51:02 +0000 (11:51 +0000)
also, always kill/restart the HTTP server on startup if it is our test server

tests/getpart.pm
tests/httpserver.pl
tests/runtests.pl

index 20da14b5cf511e3033f2a6428c267fd9a0ea02db..58e1a6006faab450081396bcef3c66c6713caa5b 100644 (file)
@@ -1,5 +1,5 @@
 
-use strict;
+#use strict;
 
 my @xml;
 
index f5cf62cbe65dfb5a0fdbebb87596292c64101e66..0c9a42c2c6944a6f8edf46bcf9012c4366102db3 100755 (executable)
@@ -3,7 +3,7 @@ use Socket;
 use Carp;
 use FileHandle;
 
-use strict;
+#use strict;
 
 require "getpart.pm";
 
@@ -119,7 +119,7 @@ for ( $waitedpid = 0;
         elsif($path =~ /verifiedserver/) {
             # this is a hard-coded query-string for the test script
             # to verify that this is the server actually running!
-            print "HTTP/1.1 999 WE ROOLZ\r\n";
+            print "HTTP/1.1 999 WE ROOLZ: $$\r\n";
             exit;
         }
         else {
index 555930adf742a25d00f9cbce2b99e2aaba7d8d86..af1bedd4416d16db272f66fcba38f6bbd7166ce9 100755 (executable)
@@ -136,35 +136,45 @@ sub checkserver {
 sub runhttpserver {
     my $verbose = $_[0];
     my $RUNNING;
+    my $pid;
 
-    my $pid = checkserver($HTTPPIDFILE );
+    # verify if our/any server is running on this port
+    my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver`;
 
-    if ($pid <= 0) {
-        my $flag=$debugprotocol?"-v ":"";
-        my $cmd="$perl $srcdir/httpserver.pl $flag $HOSTPORT &";
-        system($cmd);
+    if ( $data =~ /WE ROOLZ(: |)(\d*)/ ) {
+        $pid = 0+$2;
         if($verbose) {
-            print "CMD: $cmd\n";
+            print "Test server already running with pid $pid, killing it...\n";
         }
     }
+    elsif($data ne "") {
+        print "An alien HTTP server is running on port $HOSTPORT\n",
+        "Edit runtests.pl to use another port and rerun the test script\n";
+        exit;
+    }
     else {
-        if($pid > 0) {
-            print "httpd ($pid) runs\n";
+        if($verbose) {
+            print "No server running, start it\n";
         }
+    }
 
-        # verify that our server is one one running on this port:
-        my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver`;
-
-        if ( $data !~ /WE ROOLZ/ ) {
-            print "Another HTTP server is running on port $HOSTPORT\n",
-            "Edit runtests.pl to use another port and rerun the test script\n";
+    if($pid) {
+        my $res = kill (9, $pid); # die!
+        if(!$res) {
+            print "Failed to kill our HTTP test server, do it manually and",
+            " restart the tests.\n";
             exit;
         }
+        sleep(2);
+    }
 
-        if($verbose) {
-            print "The running HTTP server has been verified to be our server\n";
-        }
+    my $flag=$debugprotocol?"-v ":"";
+    my $cmd="$perl $srcdir/httpserver.pl $flag $HOSTPORT &";
+    system($cmd);
+    if($verbose) {
+        print "CMD: $cmd\n";
     }
+
 }
 
 #######################################################################