<http://webkit.org/b/132954>
Reviewed by Darin Adler.
Extract code into setupMacWebKitEnvironment() for setting up
common environment variables so it may be shared. Sets
__XPC_DYLD_FRAMEWORK_PATH consistently and adds support for
using guardmalloc to some scripts.
Also adds support for parsing shared (common) command-line
switches, initially just -g|--guard-malloc.
* Scripts/bisect-builds: Add -g|--guard-malloc support by using
sharedCommandLineOptions() and sharedCommandLineOptionsUsage().
(mountAndRunNightly): Call setupMacWebKitEnvironment(). Use a
local copy of %ENV when launching Safari so we don't have to
restore variables.
* Scripts/run-api-tests: Add -g|--guard-malloc support by using
sharedCommandLineOptions() and sharedCommandLineOptionsUsage().
Check result of GetOptions() to catch invalid command-line
switches.
(runTest): Use a local copy of %ENV when running tests so we
don't have to restore variables.
(prepareEnvironmentForRunningTestTool): Call
setupMacWebKitEnvironment().
* Scripts/run-pageloadtest: Add -g|--guard-malloc support by
using sharedCommandLineOptions() and
sharedCommandLineOptionsUsage(). Call
setupMacWebKitEnvironment().
* Scripts/webkitdirs.pm:
(sharedCommandLineOptions): Return array of common switches to
pass to Getopt::Long::GetOptions().
(sharedCommandLineOptionsUsage): Return formatted string of
common switches for printing usage help text.
(setUpGuardMallocIfNeeded): Support using '-g' for enabling
guardmalloc.
(printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Ditto.
(setupMacWebKitEnvironment): Extracted from runMacWebKitApp()
and changed not to clobber DYLD_FRAMEWORK_PATH if already set.
(runMacWebKitApp): Call setupMacWebKitEnvironment(). Use a
local copy of %ENV when launching Safari so we don't have to
restore variables.
(execMacWebKitAppForDebugging): Call
setupMacWebKitEnvironment().
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169042
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-05-19 David Kilzer <ddkilzer@apple.com>
+
+ webkitdirs.pm: Add setupMacWebKitEnvironment() to set __XPC_DYLD_FRAMEWORK_PATH consistently
+ <http://webkit.org/b/132954>
+
+ Reviewed by Darin Adler.
+
+ Extract code into setupMacWebKitEnvironment() for setting up
+ common environment variables so it may be shared. Sets
+ __XPC_DYLD_FRAMEWORK_PATH consistently and adds support for
+ using guardmalloc to some scripts.
+
+ Also adds support for parsing shared (common) command-line
+ switches, initially just -g|--guard-malloc.
+
+ * Scripts/bisect-builds: Add -g|--guard-malloc support by using
+ sharedCommandLineOptions() and sharedCommandLineOptionsUsage().
+ (mountAndRunNightly): Call setupMacWebKitEnvironment(). Use a
+ local copy of %ENV when launching Safari so we don't have to
+ restore variables.
+
+ * Scripts/run-api-tests: Add -g|--guard-malloc support by using
+ sharedCommandLineOptions() and sharedCommandLineOptionsUsage().
+ Check result of GetOptions() to catch invalid command-line
+ switches.
+ (runTest): Use a local copy of %ENV when running tests so we
+ don't have to restore variables.
+ (prepareEnvironmentForRunningTestTool): Call
+ setupMacWebKitEnvironment().
+
+ * Scripts/run-pageloadtest: Add -g|--guard-malloc support by
+ using sharedCommandLineOptions() and
+ sharedCommandLineOptionsUsage(). Call
+ setupMacWebKitEnvironment().
+
+ * Scripts/webkitdirs.pm:
+ (sharedCommandLineOptions): Return array of common switches to
+ pass to Getopt::Long::GetOptions().
+ (sharedCommandLineOptionsUsage): Return formatted string of
+ common switches for printing usage help text.
+ (setUpGuardMallocIfNeeded): Support using '-g' for enabling
+ guardmalloc.
+ (printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Ditto.
+ (setupMacWebKitEnvironment): Extracted from runMacWebKitApp()
+ and changed not to clobber DYLD_FRAMEWORK_PATH if already set.
+ (runMacWebKitApp): Call setupMacWebKitEnvironment(). Use a
+ local copy of %ENV when launching Safari so we don't have to
+ restore variables.
+ (execMacWebKitAppForDebugging): Call
+ setupMacWebKitEnvironment().
+
2014-05-18 Rik Cabanier <cabanier@adobe.com>
support for navigator.hardwareConcurrency
#!/usr/bin/perl -w
-# Copyright (C) 2007, 2008, 2009, 2011, 2012, 2013 Apple Inc. All rights reserved.
+# Copyright (C) 2007-2009, 2011-2014 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ARGV = map { /^(-r)(.+)$/ ? ($1, $2) : $_ } @ARGV;
my $result = GetOptions(
+ sharedCommandLineOptions(),
"b|branch=s" => \$branch,
"d|download-directory=s" => \$nightlyDownloadDirectory,
"h|help" => \$showHelp,
[--safari-path path] path to Safari application bundle (default: /Applications/Safari.app)
[-s|--sanity-check] verify both starting and ending revisions before bisecting
END
+ print STDERR sharedCommandLineOptionsUsage(brackets => 1, indent => 2, switchWidth => 30);
exit 1;
}
}
$tempFile ||= "";
- `DYLD_FRAMEWORK_PATH=$frameworkPath WEBKIT_UNSET_DYLD_FRAMEWORK_PATH=YES $safari $tempFile`;
+
+ {
+ local %ENV = %ENV;
+ setupMacWebKitEnvironment($frameworkPath);
+
+ `$safari $tempFile`;
+ }
`hdiutil detach '$mountPath' 2> $devNull`;
}
#!/usr/bin/perl -w
-# Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+# Copyright (C) 2010-2012, 2014 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
-d|--dump-tests Dump the names of testcases without running them
--[no-]build Build (or do not build) unit tests prior to running (default: $buildDefault)
--root= Path to the pre-built root containing TestWebKitAPI
-
+@{[ sharedCommandLineOptionsUsage(indent => 2, switchWidth => 21) ]}
Examples
The following command will run a single test:
EOF
-GetOptions(
+my $getOptionsResult = GetOptions(
+ sharedCommandLineOptions(),
'help' => \$showHelp,
'verbose|v' => \$verbose,
'dump|d' => \$dumpTests,
'root=s' => \$root
);
-if ($showHelp) {
+if (!$getOptionsResult || $showHelp) {
print STDERR $usage;
exit 1;
}
die "run-api-tests is not supported on this platform.\n" unless isSupportedPlatform();
+ local %ENV = %ENV;
prepareEnvironmentForRunningTestTool();
local *DEVNULL;
{
return unless isAppleMacWebKit();
- $ENV{DYLD_FRAMEWORK_PATH} = productDir();
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+ setupMacWebKitEnvironment(productDir());
}
sub testToolPath()
#!/usr/bin/perl
# Copyright (C) 2006 Eric Seidel (eric@webkit.org)
+# Copyright (C) 2014 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
my $usage =
"Usage: " . basename($0) . "[options] testName\n" .
- " --help Show this help message\n";
+ " --help Show this help message\n" .
+ sharedCommandLineOptionsUsage(indent => 2, switchWidth => 23);
-my $getOptionsResult = GetOptions('help' => \$showHelp);
+my $getOptionsResult = GetOptions(
+ sharedCommandLineOptions(),
+ 'help' => \$showHelp
+);
if (!$getOptionsResult || $showHelp) {
print STDERR $usage;
# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
-$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-$ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+setupMacWebKitEnvironment($productDir);
my @testCommands = ('activate');
# Autovicki would clear history, we skip that here as this is likely an active user account
-# Copyright (C) 2005, 2006, 2007, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+# Copyright (C) 2005-2007, 2010-2014 Apple Inc. All rights reserved.
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2011 Research In Motion Limited. All rights reserved.
# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
use File::Path qw(mkpath rmtree);
use File::Spec;
use File::stat;
+use List::Util;
use POSIX;
use VCSUtils;
&runMacWebKitApp
&safariPath
&setConfiguration
+ &setupMacWebKitEnvironment
+ &sharedCommandLineOptions
+ &sharedCommandLineOptionsUsage
USE_OPEN_COMMAND
);
%EXPORT_TAGS = ( );
}
}
+sub sharedCommandLineOptions()
+{
+ return (
+ "g|guard-malloc" => \$shouldUseGuardMalloc,
+ );
+}
+
+sub sharedCommandLineOptionsUsage(+@)
+{
+ my %opts = @_;
+
+ my %switches = (
+ '-g|--guard-malloc' => 'Use guardmalloc when running executable',
+ );
+
+ my $indent = " " x ($opts{indent} || 2);
+ my $switchWidth = List::Util::max(int($opts{switchWidth}), List::Util::max(map { length($_) } keys %switches) + ($opts{brackets} ? 2 : 0));
+
+ my $result = "Common switches:\n";
+
+ for my $switch (keys %switches) {
+ my $switchName = $opts{brackets} ? "[" . $switch . "]" : $switch;
+ $result .= sprintf("%s%-" . $switchWidth . "s %s\n", $indent, $switchName, $switches{$switch});
+ }
+
+ return $result;
+}
+
sub setUpGuardMallocIfNeeded
{
if (!isDarwin()) {
}
if (!defined($shouldUseGuardMalloc)) {
- $shouldUseGuardMalloc = checkForArgumentAndRemoveFromARGV("--guard-malloc");
+ $shouldUseGuardMalloc = checkForArgumentAndRemoveFromARGV("-g") || checkForArgumentAndRemoveFromARGV("--guard-malloc");
}
if ($shouldUseGuardMalloc) {
Usage: @{[basename($0)]} [options] [args ...]
--help Show this help message
--no-saved-state Launch the application without state restoration (OS X 10.7 and later)
- --guard-malloc Enable Guard Malloc (OS X only)
+ -g|--guard-malloc Enable Guard Malloc (OS X only)
--use-web-process-xpc-service Launch the Web Process as an XPC Service (OS X only)
EOF
return @args;
}
+sub setupMacWebKitEnvironment($)
+{
+ my ($dyldFrameworkPath) = @_;
+
+ $dyldFrameworkPath = File::Spec->rel2abs($dyldFrameworkPath);
+
+ $ENV{DYLD_FRAMEWORK_PATH} = $ENV{DYLD_FRAMEWORK_PATH} ? join(":", $dyldFrameworkPath, $ENV{DYLD_FRAMEWORK_PATH}) : $dyldFrameworkPath;
+ $ENV{__XPC_DYLD_FRAMEWORK_PATH} = $dyldFrameworkPath;
+ $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+
+ setUpGuardMallocIfNeeded();
+}
+
sub runMacWebKitApp($;$)
{
my ($appPath, $useOpenCommand) = @_;
my $productDir = productDir();
print "Starting @{[basename($appPath)]} with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{__XPC_DYLD_FRAMEWORK_PATH} = File::Spec->rel2abs($productDir);
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- setUpGuardMallocIfNeeded();
+ local %ENV = %ENV;
+ setupMacWebKitEnvironment($productDir);
if (defined($useOpenCommand) && $useOpenCommand == USE_OPEN_COMMAND) {
return system("open", "-W", "-a", $appPath, "--args", argumentsForRunAndDebugMacWebKitApp());
die "Can't find the $debugger executable.\n" unless -x $debuggerPath;
my $productDir = productDir();
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{__XPC_DYLD_FRAMEWORK_PATH} = File::Spec->rel2abs($productDir);
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
-
- setUpGuardMallocIfNeeded();
+ setupMacWebKitEnvironment($productDir);
my @architectureFlags = ($architectureSwitch, architecture());
if (!shouldTargetWebProcess()) {