Commit e9a993b9 authored by Yang Tse's avatar Yang Tse
Browse files

Move stopping of servers instructed by test definition, after the removal of

server logs advisor read lock and before test results verifications are done.

When stopping a pingpong server, stop server before its slaves.
parent 982fe339
Loading
Loading
Loading
Loading
+21 −23
Original line number Diff line number Diff line
@@ -2272,6 +2272,27 @@ sub singletest {
    # timestamp removal of server logs advisor read lock
    $timesrvrlog{$testnum} = Time::HiRes::time() if($timestats);

    # test definition might instruct to stop some servers
    my @killservers = getpart("client", "killserver");
    foreach my $serv (@killservers) {
        chomp $serv;
        if($run{$serv}) {
            stopserver($run{$serv}); # the pid file is in the hash table
            $run{$serv}=0; # clear pid
        }
        else {
            logmsg "RUN: The $serv server is not running\n";
        }
        if($serv =~ /^ftp(\d*)(-ipv6|)/) {
            my ($id, $ext) = ($1, $2);
            #print STDERR "SERV $serv $id $ext\n";
            ftpkillslave($id, $ext, $verbose);
        }
    }

    # remove the test server commands file after each test
    unlink($FTPDCMD);

    # run the postcheck command
    my @postcheck= getpart("client", "postcheck");
    $cmd = $postcheck[0];
@@ -2290,9 +2311,6 @@ sub singletest {
        }
    }

    # remove the special FTP command file after each test!
    unlink($FTPDCMD);

    my $e;
    for $e (@envs) {
        $ENV{$e}=""; # clean up
@@ -2508,24 +2526,6 @@ sub singletest {
        return 1;
    }

    @what = getpart("client", "killserver");
    for(@what) {
        my $serv = $_;
        chomp $serv;
        if($serv =~ /^ftp(\d*)(-ipv6|)/) {
            my ($id, $ext) = ($1, $2);
            #print STDERR "SERV $serv $id $ext\n";
            ftpkillslave($id, $ext, $verbose);
        }
        if($run{$serv}) {
            stopserver($run{$serv}); # the pid file is in the hash table
            $run{$serv}=0; # clear pid
        }
        else {
            logmsg "RUN: The $serv server is not running\n";
        }
    }

    if($curl_debug) {
        if(! -f $memdump) {
            logmsg "\n** ALERT! memory debugging with no output file?\n";
@@ -2615,8 +2615,6 @@ sub singletest {
        cleardir($LOGDIR);
    }

    unlink($FTPDCMD); # remove the instructions for this test

    # timestamp test result verification end
    $timevrfyend{$testnum} = Time::HiRes::time() if($timestats);