2 # Copyright (C) 2010 Google Inc. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
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
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.
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.
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.
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.
46 use lib $FindBin::Bin;
49 sub runningOnBuildBot()
51 # This is a hack to detect if we're running on the buildbot so we can
52 # pass --verbose to new-run-webkit-tests. This will be removed when we
53 # update the buildbot config to call new-run-webkit-tests explicitly.
54 my %isBuildBotUser = ("apple" => 1, "buildbot" => 1, "webkitbuildbot" => 1, "slave" => 1);
55 return $isBuildBotUser{$ENV{"USER"}};
58 # We could use isWebKit2() instead of our own custom usingWebKit2(), but then
59 # we'd have to be careful to add -2 or --webkit-test-runner back into @ARGV below.
62 # If either -2 or --webkit-test-runner is passed, we're supposed to use WebKit2.
63 # NRWT's WebKit2 support is still a work in progress:
64 # https://bugs.webkit.org/show_bug.cgi?id=56729
65 return grep(/(-2|--webkit-test-runner)/, @ARGV);
70 # LeaksViewer gets confused by NRWT's --leaks output, see bugs:
71 # https://bugs.webkit.org/show_bug.cgi?id=66227
72 # https://bugs.webkit.org/show_bug.cgi?id=66228
73 return grep(/--leaks/, @ARGV);
76 sub useNewRunWebKitTests()
78 # Change this check to control which platforms use new-run-webkit-tests by default.
79 # Example: return runningOnBuildBot() && isLeopard();
80 # would enable new-run-webkit-tests on only the leopard buildbots.
82 # Note: We use a whitelist here to avoid calling isPORT() for ports
83 # for which we haven't explicitly added support. Calling isPORT()
84 # will remove the --PORT argument from @ARGV, causing us to fail to pass it to the test harness.
86 # NRWT Windows support still needs work: https://bugs.webkit.org/show_bug.cgi?id=38756
88 # NRWT doesn't support qt-mac, qt-arm and qt-4.8 platforms now: https://bugs.webkit.org/show_bug.cgi?id=64071 and https://bugs.webkit.org/show_bug.cgi?id=64086
90 return (!isDarwin() and !isARM() and (getQtVersion() ne "4.8"));
93 return ((isLeopard() or isSnowLeopard() or isGtk()) and !usingWebKit2() and !usingLeaks());
96 my $harnessName = "old-run-webkit-tests";
98 if (useNewRunWebKitTests()) {
99 $harnessName = "new-run-webkit-tests";
100 push(@ARGV, "--child-processes=1");
101 print "Running new-run-webkit-tests with one child process.\n";
102 print "For more parallelism, run new-run-webkit-tests directly.\n";
103 if (runningOnBuildBot()) {
104 push(@ARGV, "--verbose");
107 # FIXME: We need a cleaner way to do --platform handling.
108 # webkitdirs.pm strips --qt and --gtk from @ARGV when we call isQt/isGtk.
109 # Unfortunately new-run-webkit-tests wouldn't understand --qt/--gtk if we passed it to it anyway,
110 # so we have to convert it to --platform=PORT equivalents.
111 # https://bugs.webkit.org/show_bug.cgi?id=63970
113 push(@ARGV, "--platform=qt");
115 push(@ARGV, "--platform=gtk");
118 # We have to add back any --PORT arguments which may have been removed by isPort() checks above.
122 push(@ARGV, "--gtk");
126 my $harnessPath = File::Spec->catfile(relativeScriptsDir(), $harnessName);
127 exec $harnessPath ($harnessPath, @ARGV) or die "Failed to execute $harnessPath";