]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Correctly invoke stop.pl when start.pl fails
authorMichał Kępień <michal@isc.org>
Tue, 19 Mar 2019 09:26:36 +0000 (10:26 +0100)
committerMichał Kępień <michal@isc.org>
Tue, 19 Mar 2019 09:28:54 +0000 (10:28 +0100)
MR !1141 broke the way stop.pl is invoked when start.pl fails:

  - start.pl changes the working directory to $testdir/$server before
    attempting to start $server,

  - commit 27ee629e6b583f60fea0ab78fb3ebd0d1d71d9d2 causes the $testdir
    variable in stop.pl to be determined using the $SYSTEMTESTTOP
    environment variable, which is set to ".." by all tests.sh scripts,

  - commit e227815af51c0656e22e5aebfe99e2399106b31c makes start.pl pass
    $test (the test's name) rather than $testdir (the path to the test's
    directory) to stop.pl when a given server fails to start.

Thus, when a server is restarted from within a tests.sh script and such
a restart fails, stop.pl attempts to look for the server directory in a
nonexistent location ($testdir/$server/../$test, i.e. $testdir/$test,
instead of $testdir/../$test).  Fix the issue by changing the working
directory before stop.pl is invoked in the scenario described above.

(cherry picked from commit 4afad2a047a9883e52fd3b7af2947b7917ece2a1)

bin/tests/system/start.pl

index 30139c7ac3983669fd221137e79b924c89d139a1..869c1f0eb29d9266ccf0c9754b022d03d47ed3ca 100755 (executable)
@@ -204,6 +204,7 @@ sub start_server {
                        print "I:$test:Couldn't start server $command (pid=$child)\n";
                        print "I:$test:failed\n";
                        system "kill -9 $child" if ("$child" ne "");
+                       chdir "$testdir";
                        system "$PERL $topdir/stop.pl $test";
                        exit 1;
                }