run-webkit-tests 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. # This file is a temporary hack.
  30. # It will be removed as soon as all platforms are are ready to move to
  31. # new-run-webkit-tests and we can then update the buildbots to explicitly
  32. # call old-run-webkit-tests for any platforms which will never support
  33. # a Python run-webkit-tests.
  34. # This is intentionally written in Perl to guarantee support on
  35. # the same set of platforms as old-run-webkit-tests currently supports.
  36. # The buildbot master.cfg also currently passes run-webkit-tests to
  37. # perl directly instead of executing it in a shell.
  38. use strict;
  39. use warnings;
  40. use File::Spec;
  41. use FindBin;
  42. use lib $FindBin::Bin;
  43. use webkitdirs;
  44. sub runningOnBuildBot()
  45. {
  46. # This is a hack to detect if we're running on the buildbot so we can
  47. # pass --verbose to new-run-webkit-tests. This will be removed when we
  48. # update the buildbot config to call new-run-webkit-tests explicitly.
  49. my %isBuildBotUser = ("apple" => 1, "buildbot" => 1, "webkitbuildbot" => 1, "slave" => 1, "buildslave-1" => 1, "chrome-bot" => 1);
  50. return $isBuildBotUser{$ENV{"USER"}};
  51. }
  52. sub useNewRunWebKitTests()
  53. {
  54. # NRWT does not support qt-arm: https://bugs.webkit.org/show_bug.cgi?id=64086
  55. return 0 if isQt() and isARM();
  56. # All other platforms should use NRWT by default.
  57. return 1;
  58. }
  59. my $script = "perl";
  60. my $harnessName = "old-run-webkit-tests";
  61. if (useNewRunWebKitTests()) {
  62. $script = "python";
  63. $harnessName = "new-run-webkit-tests";
  64. if (runningOnBuildBot()) {
  65. push(@ARGV, "--debug-rwt-logging");
  66. }
  67. }
  68. # webkitdirs.pm strips --qt and --gtk from @ARGV when we call isQt/isGtk.
  69. # We have to add back any --PORT arguments which may have been removed by isPort() checks above.
  70. if (isQt()) {
  71. my $isPlatformSet = 0;
  72. for (@ARGV){
  73. # Pass --qt if platform isn't passed explicitly (eg. qt-5.0, qt-wk2, ...)
  74. if(/^--platform.*/){
  75. $isPlatformSet = 1;
  76. }
  77. }
  78. push(@ARGV, "--qt") if(!$isPlatformSet);
  79. } elsif (isGtk()) {
  80. push(@ARGV, "--gtk");
  81. } elsif (isEfl()) {
  82. push(@ARGV, "--efl");
  83. } elsif (isWinCairo()) {
  84. push(@ARGV, "--wincairo");
  85. }
  86. my $harnessPath = File::Spec->catfile(relativeScriptsDir(), $harnessName);
  87. unshift(@ARGV, $harnessPath);
  88. unshift(@ARGV, $script);
  89. system(@ARGV) == 0 or die "Failed to execute $harnessPath";