]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
more reliable method for killing "ans" servers on windows
authorEvan Hunt <each@isc.org>
Thu, 24 Jan 2019 03:20:26 +0000 (19:20 -0800)
committerEvan Hunt <each@isc.org>
Fri, 25 Jan 2019 18:43:10 +0000 (10:43 -0800)
as perl and python are both native to cygwin, we don't want to use
the "kill -f" option to terminate them.

bin/tests/system/stop.pl

index cf84d4e1a2511be21dc6d0c0cb1a076cefb6aabc..05093ceb2d894e910cb1a37ec086eabfed254b25 100644 (file)
@@ -106,17 +106,22 @@ foreach my $name (@ns) {
 @ns = wait_for_servers(60, @ns);
 
 foreach my $name(@ans) {
-       stop_signal($name, "TERM");
+       stop_signal($name, "TERM", 1);
 }
 
 @ans = wait_for_servers(60, @ans);
 
 # Pass 3: SIGABRT
-foreach my $name (@ns, @ans) {
+foreach my $name (@ns) {
        print "I:$test:$name didn't die when sent a SIGTERM\n";
        stop_signal($name, "ABRT");
        $errors = 1;
 }
+foreach my $name (@ans) {
+       print "I:$test:$name didn't die when sent a SIGTERM\n";
+       stop_signal($name, "ABRT", 1);
+       $errors = 1;
+}
 
 exit($errors);
 
@@ -184,11 +189,15 @@ sub server_died {
 }
 
 sub send_signal {
-       my ( $signal, $pid ) = @_;
+       my ( $signal, $pid, $ans ) = @_;
+
+       if (! defined $ans) {
+               $ans = 0;
+       }
 
        my $result = 0;
 
-       if ($^O eq 'cygwin' || $^O eq 'msys') {
+       if (!$ans && ($^O eq 'cygwin' || $^O eq 'msys')) {
                my $killout = `/bin/kill -f -$signal $pid 2>&1`;
                chomp($killout);
                $result = 1 if ($killout eq '');
@@ -200,7 +209,10 @@ sub send_signal {
 
 # Stop a server by sending a signal to it.
 sub stop_signal {
-       my ( $server, $signal ) = @_;
+       my ( $server, $signal, $ans ) = @_;
+       if (! defined $ans) {
+               $ans = 0;
+       }
 
        my $pid_file = server_pid_file($server);
        my $pid = read_pid($pid_file);
@@ -208,7 +220,7 @@ sub stop_signal {
        return unless defined($pid);
 
        # Send signal to the server, and bail out if signal can't be sent
-       if (send_signal($signal, $pid) != 1) {
+       if (send_signal($signal, $pid, $ans) != 1) {
                server_died($server, $signal);
                return;
        }