3 # Copyright (C) 2011 Apple Computer, Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 # its contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Script to run the WebKit Open Source Project Regular Expression functional tests.
33 use Getopt::Long qw(:config pass_through);
34 use lib $FindBin::Bin;
38 # determine configuration
40 my $configuration = configuration();
42 my $defaultTestFile = "RegExpTest.data";
44 # These variables are intentionally left undefined.
52 my $programName = basename($0);
53 my $buildJSCDefault = $buildJSC ? "will check" : "will not check";
55 Usage: $programName [options] [options to pass to build system]
56 --help Show this help message
57 --file= File to use instead of default ($defaultTestFile)
58 --root= Path to pre-built root containing jsc
59 --[no-]build Check (or don't check) to see if the jsc build is up-to-date (default: $buildJSCDefault)
60 --verbose Increase test output on failures
64 'verbose' => \$verbose,
66 'file=s' => \$testFile,
67 'build!' => \$buildJSC,
71 # Assume any arguments left over from GetOptions are assumed to be build arguments
72 my @buildArgs = @ARGV;
80 setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
82 if (!defined($root) && $buildJSC) {
85 push(@buildArgs, argumentsForConfiguration());
87 print "Running: build-jsc " . join(" ", @buildArgs) . "\n";
88 my $buildResult = system "perl", "Tools/Scripts/build-jsc", @buildArgs;
90 print STDERR "Compiling jsc failed!\n";
91 exit exitStatus($buildResult);
95 my $productDir = jscProductDir();
96 $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
97 setPathForRunningWebKitApp(\%ENV) if isCygwin();
101 my ($productDir) = @_;
102 my $jscName = "testapi";
103 $jscName .= "_debug" if configurationForVisualStudio() eq "Debug_All";
104 return "$productDir/$jscName";
107 # Find JavaScriptCore directory
108 if (!defined($testFile)) {
109 $testFile = $defaultTestFile;
111 chdir("Source/JavaScriptCore");
112 chdir "tests/regexp" or die;
115 my $command = $productDir . "/testRegExp";
117 if (defined($verbose) && $verbose) {
118 $command .= " --verbose";
121 $command .= " " . $testFile;
123 printf "Running: " . $command . "\n";
124 my $result = system $command;
125 exit exitStatus($result) if $result;