Changeset 90408 in webkit


Ignore:
Timestamp:
Jul 5, 2011 3:20:43 PM (13 years ago)
Author:
Adam Roben
Message:

Clean up run-api-tests output on Windows

We were mixing run-api-tests output with gtest output, and the result was a mess.

Fixes <http://webkit.org/b/63954> run-api-tests output is very confusing on Windows

Reviewed by Dan Bates.

  • Scripts/run-api-tests:

(runTest):
(populateTests):
Made Windows use the formerly-Mac-only codepaths which correctly suppress gtest output
except in verbose mode. Most changes are due to indentation. Use of the arch utility is now
the only Mac-specific thing in these functions. Some other platform-specific code was moved
from here...

(prepareEnvironmentForRunningTestTool):
(testToolPath):
...to here.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90383 r90408  
     12011-07-05  Adam Roben  <aroben@apple.com>
     2
     3        Clean up run-api-tests output on Windows
     4
     5        We were mixing run-api-tests output with gtest output, and the result was a mess.
     6
     7        Fixes <http://webkit.org/b/63954> run-api-tests output is very confusing on Windows
     8
     9        Reviewed by Dan Bates.
     10
     11        * Scripts/run-api-tests:
     12        (runTest):
     13        (populateTests):
     14        Made Windows use the formerly-Mac-only codepaths which correctly suppress gtest output
     15        except in verbose mode. Most changes are due to indentation. Use of the arch utility is now
     16        the only Mac-specific thing in these functions. Some other platform-specific code was moved
     17        from here...
     18
     19        (prepareEnvironmentForRunningTestTool):
     20        (testToolPath):
     21        ...to here.
     22
    1232011-07-04  Gavin Barraclough  <barraclough@apple.com>
    224
  • trunk/Tools/Scripts/run-api-tests

    r90278 r90408  
    4545sub runAllTestsInSuite($);
    4646sub runTest($$);
     47sub prepareEnvironmentForRunningTestTool();
     48sub testToolPath();
    4749
    4850# Timeout for individual test, in sec
     
    140142    my $result = 0;
    141143    my $timedOut = 0;
    142     if (isAppleMacWebKit()) {
    143         my $productDir = productDir();
    144         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    145         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    146         my $apiTesterPath = "$productDir/TestWebKitAPI";
    147 
    148         local *DEVNULL;
    149         my ($childIn, $childOut, $childErr);
    150         if ($verbose) {
    151             $childOut = ">&STDOUT";
    152             $childErr = ">&STDERR";
    153         } else {
    154             open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
    155             $childOut = ">&DEVNULL";
    156             $childErr = ">&DEVNULL";
    157         }
    158 
    159         my $pid;
    160         if (architecture()) {
    161             $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, $gtestArg, @ARGV) or die "Failed to run test: $test.";
    162         } else {
    163             $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, $gtestArg, @ARGV) or die "Failed to run test: $test.";
    164         }
    165 
    166         close($childIn);
    167         close($childOut);
    168         close($childErr);
    169         close(DEVNULL) unless ($verbose);
    170         eval {
    171             local $SIG{ALRM} = sub { die "alarm\n" };
    172             alarm $timeout;
    173             waitpid($pid, 0);
    174             alarm 0;
    175             $result = $?;
    176         };
    177         if ($@) {
    178             die unless $@ eq "alarm\n";
    179             kill SIGTERM, $pid or kill SIGKILL, $pid;
    180             $timedOut = 1;
    181         };
    182 
    183      } elsif (isAppleWinWebKit()) {
    184         my $apiTesterNameSuffix;
    185         if (configurationForVisualStudio() ne "Debug_All") {
    186             $apiTesterNameSuffix = "";
    187         } else {
    188             $apiTesterNameSuffix = "_debug";
    189         }
    190         my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
    191         eval {
    192             local $SIG{ALRM} = sub { die "alarm\n" };
    193             alarm $timeout;
    194             $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
    195             alarm 0;
    196         };
    197         if ($@) {
    198             die unless $@ eq "alarm\n";
    199             $timedOut = 1;
    200         };
    201     } else {
    202         die "run-api-tests is not supported on this platform.\n"
     144
     145    die "run-api-tests is not supported on this platform.\n" unless isAppleMacWebKit() || isAppleWinWebKit();
     146
     147    prepareEnvironmentForRunningTestTool();
     148
     149    local *DEVNULL;
     150    my ($childIn, $childOut, $childErr);
     151    if ($verbose) {
     152        $childOut = ">&STDERR";
     153        $childErr = ">&STDERR";
     154    } else {
     155        open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
     156        $childOut = ">&DEVNULL";
     157        $childErr = ">&DEVNULL";
     158    }
     159
     160    my $pid;
     161    if (isAppleMacWebKit() && architecture()) {
     162        $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), testToolPath(), $gtestArg, @ARGV) or die "Failed to run test: $test.";
     163    } else {
     164        $pid = open3($childIn, $childOut, $childErr, testToolPath(), $gtestArg, @ARGV) or die "Failed to run test: $test.";
     165    }
     166
     167    close($childIn);
     168    close($childOut);
     169    close($childErr);
     170    close(DEVNULL) unless ($verbose);
     171    eval {
     172        local $SIG{ALRM} = sub { die "alarm\n" };
     173        alarm $timeout;
     174        waitpid($pid, 0);
     175        alarm 0;
     176        $result = $?;
     177    };
     178    if ($@) {
     179        die unless $@ eq "alarm\n";
     180        kill SIGTERM, $pid or kill SIGKILL, $pid;
     181        $timedOut = 1;
    203182    }
    204183
     
    218197    my $timedOut;
    219198
    220     if (isAppleMacWebKit()) {
    221         my $productDir = productDir();
    222         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    223         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    224         my $apiTesterPath = "$productDir/TestWebKitAPI";
    225 
    226         local *DEVNULL;
    227         my ($childIn, $childOut, $childErr);
    228         if ($verbose) {
    229             $childErr = ">&STDERR";
    230         } else {
    231             open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
    232             $childErr = ">&DEVNULL";
    233         }
    234 
    235         my $pid;
    236         if (architecture()) {
    237             $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, "--gtest_list_tests") or die "Failed to build list of tests!";
    238         } else {
    239             $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, "--gtest_list_tests") or die "Failed to build list of tests!";
    240         }
    241 
    242         close($childIn);
    243         @tests = <$childOut>;
    244         close($childOut);
    245         close($childErr);
    246         close(DEVNULL) unless ($verbose);
    247 
    248         waitpid($pid, 0);
    249         my $result = $?;
    250 
    251         if ($result) {
    252             print STDERR "Failed to build list of tests!\n";
    253             exit exitStatus($result);
    254         }
    255     } elsif (isAppleWinWebKit()) {
    256         my $apiTesterNameSuffix;
    257         if (configurationForVisualStudio() ne "Debug_All") {
    258             $apiTesterNameSuffix = "";
    259         } else {
    260             $apiTesterNameSuffix = "_debug";
    261         }
    262         my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
    263         open(TESTS, "-|", $apiTesterPath, "--dump-tests") or die $!;
    264         @tests = <TESTS>;
    265         close(TESTS) or die $!;
    266     } else {
    267         die "run-api-tests is not supported on this platform.\n"
     199    die "run-api-tests is not supported on this platform.\n" unless isAppleMacWebKit() || isAppleWinWebKit();
     200
     201    prepareEnvironmentForRunningTestTool();
     202
     203    local *DEVNULL;
     204    my ($childIn, $childOut, $childErr);
     205    if ($verbose) {
     206        $childErr = ">&STDERR";
     207    } else {
     208        open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
     209        $childErr = ">&DEVNULL";
     210    }
     211
     212    my $pid;
     213    if (isAppleMacWebKit() && architecture()) {
     214        $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), testToolPath(), "--gtest_list_tests") or die "Failed to build list of tests!";
     215    } else {
     216        $pid = open3($childIn, $childOut, $childErr, testToolPath(), "--gtest_list_tests") or die "Failed to build list of tests!";
     217    }
     218
     219    close($childIn);
     220    @tests = <$childOut>;
     221    close($childOut);
     222    close($childErr);
     223    close(DEVNULL) unless ($verbose);
     224
     225    waitpid($pid, 0);
     226    my $result = $?;
     227
     228    if ($result) {
     229        print STDERR "Failed to build list of tests!\n";
     230        exit exitStatus($result);
    268231    }
    269232
     
    324287    chdir $originalCwd;
    325288}
     289
     290sub prepareEnvironmentForRunningTestTool()
     291{
     292    return unless isAppleMacWebKit();
     293
     294    $ENV{DYLD_FRAMEWORK_PATH} = productDir();
     295    $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
     296}
     297
     298sub testToolPath()
     299{
     300    my $path = File::Spec->catfile(productDir(), "TestWebKitAPI");
     301    return $path unless isAppleWinWebKit();
     302
     303    my $suffix;
     304    if (configurationForVisualStudio() eq "Debug_All") {
     305        $suffix = "_debug";
     306    } else {
     307        $suffix = "";
     308    }
     309    return "$path$suffix.exe";
     310}
Note: See TracChangeset for help on using the changeset viewer.