blob: 631c22b97ce56c53216222543459757d4ffab0d1 [file] [log] [blame]
eseidel5ad4e6b2006-12-27 00:12:23 +00001#!/usr/bin/perl
2
3# Copyright (C) 2006 Eric Seidel (eric@webkit.org)
ddkilzer@apple.combe2485c2014-05-19 09:17:53 +00004# Copyright (C) 2014 Apple Inc. All rights reserved.
eseidel5ad4e6b2006-12-27 00:12:23 +00005#
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.com92047332014-03-15 04:08:27 +000015# 3. Neither the name of Apple Inc. ("Apple") nor the names of
eseidel5ad4e6b2006-12-27 00:12:23 +000016# 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
34use strict;
35use warnings;
36
37use File::Basename;
ddkilzer6ad720d2007-05-29 18:41:38 +000038use File::Spec;
eseidel5ad4e6b2006-12-27 00:12:23 +000039use FindBin;
40use Getopt::Long;
41
42use lib $FindBin::Bin;
43use webkitdirs;
44
45# Argument handling
46my $testName = 'svg';
47my $showHelp = 0;
48
49my $usage =
50 "Usage: " . basename($0) . "[options] testName\n" .
ddkilzer@apple.combe2485c2014-05-19 09:17:53 +000051 " --help Show this help message\n" .
52 sharedCommandLineOptionsUsage(indent => 2, switchWidth => 23);
eseidel5ad4e6b2006-12-27 00:12:23 +000053
ddkilzer@apple.combe2485c2014-05-19 09:17:53 +000054my $getOptionsResult = GetOptions(
55 sharedCommandLineOptions(),
56 'help' => \$showHelp
57);
eseidel5ad4e6b2006-12-27 00:12:23 +000058
59if (!$getOptionsResult || $showHelp) {
60 print STDERR $usage;
61 exit 1;
62}
63
ddkilzer6ad720d2007-05-29 18:41:38 +000064$testName = shift @ARGV if (@ARGV);
65
66my $safariExecutablePath = safariPath();
67my $safariResourcePath = File::Spec->catdir(dirname(dirname($safariExecutablePath)), "Resources");
68
eseidel5ad4e6b2006-12-27 00:12:23 +000069# Check to see that all the frameworks are built.
70checkFrameworks();
71
72chdirWebKit();
73
ddkilzer6ad720d2007-05-29 18:41:38 +000074if ($testName eq 'svg') {
abarth@webkit.orgc871a7f2010-12-31 09:51:18 +000075 my $suiteFile = "PerformanceTests/PageLoad/$testName/$testName.pltsuite";
ddkilzer6ad720d2007-05-29 18:41:38 +000076 my $webkitPath = sourceDir();
77 `cat "$suiteFile" | perl -pe 's|WEBKIT_PATH|$webkitPath|' > $safariResourcePath/$testName.pltsuite`
78}
eseidel5ad4e6b2006-12-27 00:12:23 +000079
ddkilzer6ad720d2007-05-29 18:41:38 +000080die "Please copy ${testName}.pltsuite to ${safariResourcePath}/${testName}.pltsuite"
81 if (! -f "${safariResourcePath}/${testName}.pltsuite");
eseidel5ad4e6b2006-12-27 00:12:23 +000082
83setConfiguration();
84
85my $productDir = productDir();
eseidel5ad4e6b2006-12-27 00:12:23 +000086
87# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
88print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
ddkilzer@apple.combe2485c2014-05-19 09:17:53 +000089setupMacWebKitEnvironment($productDir);
eseidel5ad4e6b2006-12-27 00:12:23 +000090
91my @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));
95my $testCommandsString = join('; ', @testCommands);
ddkilzer6ad720d2007-05-29 18:41:38 +000096exec $safariExecutablePath, '--test-commands', $testCommandsString or die;