WebKitTools/Scripts/run-webkit-tests
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 #!/usr/bin/perl
       
     2 # Copyright (C) 2010 Google Inc. All rights reserved.
       
     3 #
       
     4 # Redistribution and use in source and binary forms, with or without
       
     5 # modification, are permitted provided that the following conditions are
       
     6 # met:
       
     7 #
       
     8 #     * Redistributions of source code must retain the above copyright
       
     9 # notice, this list of conditions and the following disclaimer.
       
    10 #     * Redistributions in binary form must reproduce the above
       
    11 # copyright notice, this list of conditions and the following disclaimer
       
    12 # in the documentation and/or other materials provided with the
       
    13 # distribution.
       
    14 #     * Neither the name of Google Inc. nor the names of its
       
    15 # contributors may be used to endorse or promote products derived from
       
    16 # this software without specific prior written permission.
       
    17 #
       
    18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
       
    19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
       
    20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
       
    21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
       
    22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       
    24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       
    25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       
    26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    29 
       
    30 # This file is a temporary hack.
       
    31 # It will be removed as soon as all platforms are are ready to move to
       
    32 # new-run-webkit-tests and we can then update the buildbots to explicitly
       
    33 # call old-run-webkit-tests for any platforms which will never support
       
    34 # a Python run-webkit-tests.
       
    35 
       
    36 # This is intentionally written in Perl to guarantee support on
       
    37 # the same set of platforms as old-run-webkit-tests currently supports.
       
    38 # The buildbot master.cfg also currently passes run-webkit-tests to
       
    39 # perl directly instead of executing it in a shell.
       
    40 
       
    41 use strict;
       
    42 use warnings;
       
    43 
       
    44 use FindBin;
       
    45 use lib $FindBin::Bin;
       
    46 use webkitdirs;
       
    47 
       
    48 sub runningOnBuildBot()
       
    49 {
       
    50     # This is a hack to detect if we're running on the buildbot so we can
       
    51     # pass --verbose to new-run-webkit-tests.  This will be removed when we
       
    52     # update the buildbot config to call new-run-webkit-tests explicitly.
       
    53     my %isBuildBotUser = ("apple" => 1, "buildbot" => 1);
       
    54     return $isBuildBotUser{$ENV{"USER"}};
       
    55 }
       
    56 
       
    57 sub useNewRunWebKitTests()
       
    58 {
       
    59     # Change this check to control which platforms use
       
    60     # new-run-webkit-tests by default.
       
    61     # Example: return runningOnBuildBot() && isLeopard();
       
    62     # would enable new-run-webkit-tests on only the leopard buildbots.
       
    63     return 0;
       
    64 }
       
    65 
       
    66 my $harnessName = "old-run-webkit-tests";
       
    67 
       
    68 if (useNewRunWebKitTests()) {
       
    69     $harnessName = "new-run-webkit-tests";
       
    70     if (runningOnBuildBot()) {
       
    71         push(@ARGV, "--verbose");
       
    72         # old-run-webkit-tests treats --results-directory as $CWD relative.
       
    73         # new-run-webkit-tests treats --results-directory as build directory relative.
       
    74         # Override the passed in --results-directory by appending a new one
       
    75         # (later arguments override earlier ones in Python's optparse).
       
    76         push(@ARGV, "--results-directory");
       
    77         # The buildbot always uses $SRCDIR/layout-test-results, hardcode it:
       
    78         push(@ARGV, sourceDir() . "/layout-test-results");
       
    79     }
       
    80 }
       
    81 
       
    82 my $harnessPath = sprintf("%s/%s", relativeScriptsDir(), $harnessName);
       
    83 exec $harnessPath ($harnessPath, @ARGV) or die "Failed to execute $harnessPath";