Changeset 86922 in webkit


Ignore:
Timestamp:
May 19, 2011 9:10:49 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-19 Dmitry Lomov <dslomov@google.com>

Reviewed by Adam Roben.

Detect hangs in run-api-tests
https://bugs.webkit.org/show_bug.cgi?id=48043

  • Scripts/run-api-tests: Added test timeouts
Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r86907 r86922  
     12011-05-19  Dmitry Lomov  <dslomov@google.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Detect hangs in run-api-tests
     6        https://bugs.webkit.org/show_bug.cgi?id=48043
     7
     8        * Scripts/run-api-tests: Added test timeouts
     9
    1102011-05-19  Dmitry Lomov  <dslomov@google.com>
    211
  • trunk/Tools/Scripts/run-api-tests

    r86907 r86922  
    4646sub runTest($$);
    4747
     48# Timeout for individual test, in sec
     49my $timeout = 10;
     50
    4851my $showHelp = 0;
    4952my $verbose = 0;
     
    132135
    133136    my $result = 0;
     137    my $timedOut = 0;
    134138    if (isAppleMacWebKit()) {
    135139        my $productDir = productDir();
     
    160164        close($childErr);
    161165        close(DEVNULL) unless ($verbose);
    162 
    163         waitpid($pid, 0);
    164         $result = $?;
    165     } elsif (isAppleWinWebKit()) {
     166        eval {
     167            local $SIG{ALRM} = sub { die "alarm\n" };
     168            alarm $timeout;
     169            waitpid($pid, 0);
     170            alarm 0;
     171            $result = $?;
     172        };
     173        if ($@) {
     174            die unless $@ eq "alarm\n";
     175            kill SIGTERM, $pid or kill SIGKILL, $pid;
     176            $timedOut = 1;
     177        };
     178
     179     } elsif (isAppleWinWebKit()) {
    166180        my $apiTesterNameSuffix;
    167181        if (configurationForVisualStudio() ne "Debug_All") {
     
    171185        }
    172186        my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
    173         $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
     187        eval {
     188            local $SIG{ALRM} = sub { die "alarm\n" };
     189            alarm $timeout;
     190            $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
     191            alarm 0;
     192        };
     193        if ($@) {
     194            die unless $@ eq "alarm\n";
     195            $timedOut = 1;
     196        };
    174197    } else {
    175198        die "run-api-tests is not supported on this platform.\n"
    176199    }
    177    
    178     if (!$result) {
     200
     201    if ($timedOut) {
     202        print BOLD YELLOW, "Timeout", RESET, "\n";
     203    } elsif (!$result) {
    179204        print BOLD GREEN, "Passed", RESET, "\n";
    180205    } else {
    181206        print BOLD RED, "Failed", RESET, "\n";
    182207    }
    183     return $result;
     208    return $timedOut || $result;
    184209}
    185210
Note: See TracChangeset for help on using the changeset viewer.