+2015-11-12 Daniel Bates <dabates@apple.com>
+
+ run-api-tests fails to run with public iOS SDK
+ https://bugs.webkit.org/show_bug.cgi?id=151076
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use the command line tool simctl as the sim tool was removed from the public iOS 9 SDK.
+
+ A side benefit of this change it is sufficient to run the tests without launching Simulator.app
+ to boot the simulator device beforehand because simctl will boot the device for us.
+
+ Additionally, use Perl pragma sigtrap to install signal handlers to catch SIG{HUP, INT, PIPE, TERM}
+ signals and ultimately run our END block so that we shutdown the simulator device (if applicable).
+ This makes Control-C terminate the app gracefully.
+
+ * Scripts/run-api-tests:
+ (runTest):
+ (listAllTests):
+ (prepareEnvironmentForRunningTestTool): When running for iOS Simulator use setupIOSWebKitEnvironment()
+ to setup the environment variables for iOS instead of using setupMacWebKitEnvironment(). We also
+ prefix the name of these environment variables with "SIMCTL_CHILD_" so that simctl sets these environment
+ variables in the simulator environment.
+ * Scripts/webkitdirs.pm:
+ (shutDownIOSSimulatorDevice): Added.
+ (restartIOSSimulatorDevice): Added.
+
2015-11-12 KwangHyuk Kim <hyuki.kim@samsung.com>
[EFL] fix EvasGL configuration error
#!/usr/bin/perl -w
-# Copyright (C) 2010-2012, 2014 Apple Inc. All rights reserved.
+# Copyright (C) 2010-2012, 2014-2015 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
use Getopt::Long qw(:config pass_through);
use IPC::Open3;
use lib $FindBin::Bin;
+use sigtrap qw(die normal-signals);
use webkitdirs;
use VCSUtils;
buildTestTool() if $build && !defined($root);
setPathForRunningWebKitApp(\%ENV);
-# FIXME: We launch (and quit) iOS Simulator as a workaround for <rdar://problem/22388812>.
-relaunchIOSSimulator(findOrCreateSimulatorForIOSDevice(SIMULATOR_DEVICE_SUFFIX_FOR_WEBKIT_DEVELOPMENT)) if willUseIOSSimulatorSDKWhenBuilding();
+my $simulatorDevice;
+if (willUseIOSSimulatorSDKWhenBuilding()) {
+ $simulatorDevice = findOrCreateSimulatorForIOSDevice(SIMULATOR_DEVICE_SUFFIX_FOR_WEBKIT_DEVELOPMENT);
+ restartIOSSimulatorDevice($simulatorDevice);
+}
my @testsToRun = listAllTests();
@testsToRun = grep { my $test = $_; grep { $test =~ m/^\Q$_\E/ } @ARGV; } @testsToRun if @ARGV;
exit 0;
}
-# FIXME: We launch (and quit) iOS Simulator as a workaround for <rdar://problem/22388812>.
-END { quitIOSSimulator() if willUseIOSSimulatorSDKWhenBuilding(); }
+END { shutDownIOSSimulatorDevice($simulatorDevice) if $simulatorDevice; }
exit runTestsBySuite(@testsToRun);
foreach(testToolPaths()) {
my $pid;
my @commonArguments = ($_, $gtestArg, @ARGV);
- if (isIOSWebKit()) {
- $pid = open3($childIn, $childOut, $childErr, qw(xcrun -sdk iphonesimulator sim --environment=merge), @commonArguments) or die "Failed to run test: $test.";
+ if (willUseIOSSimulatorSDKWhenBuilding()) {
+ $pid = open3($childIn, $childOut, $childErr, qw(xcrun --sdk iphonesimulator simctl spawn), $simulatorDevice->{UDID}, @commonArguments) or die "Failed to run test: $test.";
} elsif (isAppleMacWebKit() && architecture()) {
$pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), archCommandLineArgumentsForRestrictedEnvironmentVariables(), @commonArguments) or die "Failed to run test: $test.";
} else {
my $pid;
my @commonArguments = ($_, "--gtest_list_tests");
if (isIOSWebKit()) {
- $pid = open3($childIn, $childOut, $childErr, qw(xcrun -sdk iphonesimulator sim --environment=merge), @commonArguments) or die "Failed to build list of tests!";
+ $pid = open3($childIn, $childOut, $childErr, qw(xcrun --sdk iphonesimulator simctl spawn), $simulatorDevice->{UDID}, @commonArguments) or die "Failed to build list of tests!";
} elsif (isAppleMacWebKit() && architecture()) {
$pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), archCommandLineArgumentsForRestrictedEnvironmentVariables(), @commonArguments) or die "Failed to build list of tests!";
} else {
{
return unless isAppleMacWebKit();
+ if (willUseIOSSimulatorSDKWhenBuilding()) {
+ my %simulatorENV;
+ {
+ local %ENV;
+ setupIOSWebKitEnvironment(productDir());
+ %simulatorENV = %ENV;
+ }
+ # Prefix the environment variables with SIMCTL_CHILD_ per `xcrun simctl help launch`.
+ foreach my $key (keys %simulatorENV) {
+ $ENV{"SIMCTL_CHILD_$key"} = $simulatorENV{$key};
+ }
+ return;
+ }
setupMacWebKitEnvironment(productDir());
}
&productDir
&quitIOSSimulator
&relaunchIOSSimulator
+ &restartIOSSimulatorDevice
&runIOSWebKitApp
&runMacWebKitApp
&safariPath
&setupMacWebKitEnvironment
&sharedCommandLineOptions
&sharedCommandLineOptionsUsage
+ &shutDownIOSSimulatorDevice
SIMULATOR_DEVICE_SUFFIX_FOR_WEBKIT_DEVELOPMENT
USE_OPEN_COMMAND
);
}
}
+sub shutDownIOSSimulatorDevice($)
+{
+ my ($simulatorDevice) = @_;
+ system("xcrun --sdk iphonesimulator simctl shutdown $simulatorDevice->{UDID} > /dev/null 2>&1");
+}
+
+sub restartIOSSimulatorDevice($)
+{
+ my ($simulatorDevice) = @_;
+ shutDownIOSSimulatorDevice($simulatorDevice);
+
+ exitStatus(system("xcrun", "--sdk", "iphonesimulator", "simctl", "boot", $simulatorDevice->{UDID})) == 0 or die "Failed to boot simulator device $simulatorDevice->{UDID}";
+}
+
sub relaunchIOSSimulator($)
{
my ($simulatedDevice) = @_;