eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | |
| 3 | # Copyright (C) 2006 Eric Seidel (eric@webkit.org) |
ddkilzer@apple.com | be2485c | 2014-05-19 09:17:53 +0000 | [diff] [blame] | 4 | # Copyright (C) 2014 Apple Inc. All rights reserved. |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 5 | # |
| 6 | # Redistribution and use in source and binary forms, with or without |
| 7 | # modification, are permitted provided that the following conditions |
| 8 | # are met: |
| 9 | # |
| 10 | # 1. Redistributions of source code must retain the above copyright |
| 11 | # notice, this list of conditions and the following disclaimer. |
| 12 | # 2. Redistributions in binary form must reproduce the above copyright |
| 13 | # notice, this list of conditions and the following disclaimer in the |
| 14 | # documentation and/or other materials provided with the distribution. |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 15 | # 3. Neither the name of Apple Inc. ("Apple") nor the names of |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 16 | # its contributors may be used to endorse or promote products derived |
| 17 | # from this software without specific prior written permission. |
| 18 | # |
| 19 | # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 20 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 | # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | |
| 30 | # Script to run the WebKit Open Source Project page load tests (PLTs). |
| 31 | |
| 32 | # Run all the tests passed in on the command line. |
| 33 | |
| 34 | use strict; |
| 35 | use warnings; |
| 36 | |
| 37 | use File::Basename; |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 38 | use File::Spec; |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 39 | use FindBin; |
| 40 | use Getopt::Long; |
| 41 | |
| 42 | use lib $FindBin::Bin; |
| 43 | use webkitdirs; |
| 44 | |
| 45 | # Argument handling |
| 46 | my $testName = 'svg'; |
| 47 | my $showHelp = 0; |
| 48 | |
| 49 | my $usage = |
| 50 | "Usage: " . basename($0) . "[options] testName\n" . |
ddkilzer@apple.com | be2485c | 2014-05-19 09:17:53 +0000 | [diff] [blame] | 51 | " --help Show this help message\n" . |
| 52 | sharedCommandLineOptionsUsage(indent => 2, switchWidth => 23); |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 53 | |
ddkilzer@apple.com | be2485c | 2014-05-19 09:17:53 +0000 | [diff] [blame] | 54 | my $getOptionsResult = GetOptions( |
| 55 | sharedCommandLineOptions(), |
| 56 | 'help' => \$showHelp |
| 57 | ); |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 58 | |
| 59 | if (!$getOptionsResult || $showHelp) { |
| 60 | print STDERR $usage; |
| 61 | exit 1; |
| 62 | } |
| 63 | |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 64 | $testName = shift @ARGV if (@ARGV); |
| 65 | |
| 66 | my $safariExecutablePath = safariPath(); |
| 67 | my $safariResourcePath = File::Spec->catdir(dirname(dirname($safariExecutablePath)), "Resources"); |
| 68 | |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 69 | # Check to see that all the frameworks are built. |
| 70 | checkFrameworks(); |
| 71 | |
| 72 | chdirWebKit(); |
| 73 | |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 74 | if ($testName eq 'svg') { |
abarth@webkit.org | c871a7f | 2010-12-31 09:51:18 +0000 | [diff] [blame] | 75 | my $suiteFile = "PerformanceTests/PageLoad/$testName/$testName.pltsuite"; |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 76 | my $webkitPath = sourceDir(); |
| 77 | `cat "$suiteFile" | perl -pe 's|WEBKIT_PATH|$webkitPath|' > $safariResourcePath/$testName.pltsuite` |
| 78 | } |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 79 | |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 80 | die "Please copy ${testName}.pltsuite to ${safariResourcePath}/${testName}.pltsuite" |
| 81 | if (! -f "${safariResourcePath}/${testName}.pltsuite"); |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 82 | |
| 83 | setConfiguration(); |
| 84 | |
| 85 | my $productDir = productDir(); |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 86 | |
| 87 | # Set up DYLD_FRAMEWORK_PATH to point to the product directory. |
| 88 | print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; |
ddkilzer@apple.com | be2485c | 2014-05-19 09:17:53 +0000 | [diff] [blame] | 89 | setupMacWebKitEnvironment($productDir); |
eseidel | 5ad4e6b | 2006-12-27 00:12:23 +0000 | [diff] [blame] | 90 | |
| 91 | my @testCommands = ('activate'); |
| 92 | # Autovicki would clear history, we skip that here as this is likely an active user account |
| 93 | @testCommands = (@testCommands, ("run $testName", 'emptyCache', 'wait 30')); |
| 94 | @testCommands = (@testCommands, (("run $testName", 'wait 10') x 3)); |
| 95 | my $testCommandsString = join('; ', @testCommands); |
ddkilzer | 6ad720d | 2007-05-29 18:41:38 +0000 | [diff] [blame] | 96 | exec $safariExecutablePath, '--test-commands', $testCommandsString or die; |