summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorjustincohen@chromium.org <justincohen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 15:44:55 +0000
committerjustincohen@chromium.org <justincohen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 15:44:55 +0000
commit6c98afc0cb35d188d73b8b93f567fffdb19503d2 (patch)
tree902f723bfa139dee1f5b91af1d6645a60c0dcbce /testing
parentbd0a3bc73862409ab408362f1a6e44c0eff72daf (diff)
downloadchromium_src-6c98afc0cb35d188d73b8b93f567fffdb19503d2.zip
chromium_src-6c98afc0cb35d188d73b8b93f567fffdb19503d2.tar.gz
chromium_src-6c98afc0cb35d188d73b8b93f567fffdb19503d2.tar.bz2
Move iossim to DVTiPhoneSimulatorRemoteClient.
Future versions of Xcode might not work with iPhoneSimulatorRemoteClient.framework. Moving to DVTiPhoneSimulatorRemoteClient.framework seems to be better supported. DVTiPhoneSimulatorRemoteClient's API for launching the simulator is mostly the same, and allows for setting the deviceName string directly instead of via a preference. BUG=328874 NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/113403002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing')
-rw-r--r--testing/iossim/iossim.gyp17
-rw-r--r--testing/iossim/iossim.mm84
-rwxr-xr-xtesting/iossim/redirect-stdout.sh9
3 files changed, 73 insertions, 37 deletions
diff --git a/testing/iossim/iossim.gyp b/testing/iossim/iossim.gyp
index a78f024..af80adb 100644
--- a/testing/iossim/iossim.gyp
+++ b/testing/iossim/iossim.gyp
@@ -30,26 +30,29 @@
],
'actions': [
{
- 'action_name': 'generate_iphone_sim_header',
+ 'action_name': 'generate_dvt_iphone_sim_header',
'inputs': [
- '<(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework/Versions/Current/iPhoneSimulatorRemoteClient',
+ '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework/Versions/Current/DVTiPhoneSimulatorRemoteClient',
'<(PRODUCT_DIR)/class-dump',
],
'outputs': [
- '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h'
+ '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h'
],
'action': [
# Actions don't provide a way to redirect stdout, so a custom
- # script is invoked that will execute the first argument and write
- # the output to the file specified as the second argument.
+ # script is invoked that will execute the first argument and
+ # write the output to the file specified as the second argument.
+ # -I sorts classes, categories, and protocols by inheritance.
+ # -C <regex> only displays classes matching regular expression.
'./redirect-stdout.sh',
- '<(PRODUCT_DIR)/class-dump -CiPhoneSimulator <(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework',
- '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h',
+ '<(PRODUCT_DIR)/class-dump -I -CiPhoneSimulator <(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework',
+ '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h',
],
'message': 'Generating header',
},
],
'xcode_settings': {
+ 'ARCHS': ['x86_64'],
'WARNING_CFLAGS': [
'-Wno-objc-property-no-attribute',
],
diff --git a/testing/iossim/iossim.mm b/testing/iossim/iossim.mm
index 152f2bea..6187973 100644
--- a/testing/iossim/iossim.mm
+++ b/testing/iossim/iossim.mm
@@ -28,6 +28,19 @@
@class DTiPhoneSimulatorSession;
@class DTiPhoneSimulatorSessionConfig;
@class DTiPhoneSimulatorSystemRoot;
+@class DVTiPhoneSimulatorMessenger;
+
+@interface DVTPlatform : NSObject
++ (BOOL)loadAllPlatformsReturningError:(id*)arg1;
+@end
+
+@protocol OS_dispatch_source
+@end
+@protocol OS_dispatch_queue
+@end
+@class DVTDispatchLock;
+@class DVTConfinementServiceConnection;
+@class DVTTask;
@protocol DTiPhoneSimulatorSessionDelegate
- (void)session:(DTiPhoneSimulatorSession*)session
@@ -37,7 +50,7 @@
withError:(NSError*)error;
@end
-#import "iPhoneSimulatorRemoteClient.h"
+#import "DVTiPhoneSimulatorRemoteClient.h"
// An undocumented system log key included in messages from launchd. The value
// is the PID of the process the message is about (as opposed to launchd's PID).
@@ -73,7 +86,9 @@ const NSTimeInterval kOutputPollIntervalSeconds = 0.1;
// The path within the developer dir of the private Simulator frameworks.
NSString* const kSimulatorFrameworkRelativePath =
@"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/"
- @"iPhoneSimulatorRemoteClient.framework";
+ @"DVTiPhoneSimulatorRemoteClient.framework";
+NSString* const kDVTFoundationRelativePath =
+ @"../SharedFrameworks/DVTFoundation.framework";
NSString* const kDevToolsFoundationRelativePath =
@"../OtherFrameworks/DevToolsFoundation.framework";
NSString* const kSimulatorRelativePath =
@@ -300,9 +315,12 @@ void LogWarning(NSString* format, ...) {
aslmsg query = asl_new(ASL_TYPE_QUERY);
asl_set_query(query, ASL_KEY_SENDER, "launchd",
ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING);
- asl_set_query(query, ASL_KEY_REF_PID,
- [[[session simulatedApplicationPID] stringValue] UTF8String],
- ASL_QUERY_OP_EQUAL);
+ char session_id[20];
+ if (snprintf(session_id, 20, "%d", [session simulatedApplicationPID]) < 0) {
+ LogError(@"Failed to get [session simulatedApplicationPID]");
+ exit(kExitFailure);
+ }
+ asl_set_query(query, ASL_KEY_REF_PID, session_id, ASL_QUERY_OP_EQUAL);
asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL);
// Log any messages found, and take note of any messages that may indicate
@@ -393,16 +411,43 @@ NSString* FindDeveloperDir() {
return output;
}
+// Helper to find a class by name and die if it isn't found.
+Class FindClassByName(NSString* nameOfClass) {
+ Class theClass = NSClassFromString(nameOfClass);
+ if (!theClass) {
+ LogError(@"Failed to find class %@ at runtime.", nameOfClass);
+ exit(kExitInitializationFailure);
+ }
+ return theClass;
+}
+
// Loads the Simulator framework from the given developer dir.
NSBundle* LoadSimulatorFramework(NSString* developerDir) {
// The Simulator framework depends on some of the other Xcode private
// frameworks; manually load them first so everything can be linked up.
+ NSString* dvtFoundationPath = [developerDir
+ stringByAppendingPathComponent:kDVTFoundationRelativePath];
+ NSBundle* dvtFoundationBundle =
+ [NSBundle bundleWithPath:dvtFoundationPath];
+ if (![dvtFoundationBundle load])
+ return nil;
+
NSString* devToolsFoundationPath = [developerDir
stringByAppendingPathComponent:kDevToolsFoundationRelativePath];
NSBundle* devToolsFoundationBundle =
[NSBundle bundleWithPath:devToolsFoundationPath];
if (![devToolsFoundationBundle load])
return nil;
+
+ // Prime DVTPlatform.
+ NSError* error;
+ Class DVTPlatformClass = FindClassByName(@"DVTPlatform");
+ if (![DVTPlatformClass loadAllPlatformsReturningError:&error]) {
+ LogError(@"Unable to loadAllPlatformsReturningError. Error: %@",
+ [error localizedDescription]);
+ return nil;
+ }
+
NSString* simBundlePath = [developerDir
stringByAppendingPathComponent:kSimulatorFrameworkRelativePath];
NSBundle* simBundle = [NSBundle bundleWithPath:simBundlePath];
@@ -411,16 +456,6 @@ NSBundle* LoadSimulatorFramework(NSString* developerDir) {
return simBundle;
}
-// Helper to find a class by name and die if it isn't found.
-Class FindClassByName(NSString* nameOfClass) {
- Class theClass = NSClassFromString(nameOfClass);
- if (!theClass) {
- LogError(@"Failed to find class %@ at runtime.", nameOfClass);
- exit(kExitInitializationFailure);
- }
- return theClass;
-}
-
// Converts the given app path to an application spec, which requires an
// absolute path.
DTiPhoneSimulatorApplicationSpecifier* BuildAppSpec(NSString* appPath) {
@@ -454,7 +489,8 @@ DTiPhoneSimulatorSessionConfig* BuildSessionConfig(
NSString* stderrPath,
NSArray* appArgs,
NSDictionary* appEnv,
- NSNumber* deviceFamily) {
+ NSNumber* deviceFamily,
+ NSString* deviceName) {
Class sessionConfigClass = FindClassByName(@"DTiPhoneSimulatorSessionConfig");
DTiPhoneSimulatorSessionConfig* sessionConfig =
[[[sessionConfigClass alloc] init] autorelease];
@@ -465,6 +501,7 @@ DTiPhoneSimulatorSessionConfig* BuildSessionConfig(
sessionConfig.simulatedApplicationStdOutPath = stdoutPath;
sessionConfig.simulatedApplicationLaunchArgs = appArgs;
sessionConfig.simulatedApplicationLaunchEnvironment = appEnv;
+ sessionConfig.simulatedDeviceInfoName = deviceName;
sessionConfig.simulatedDeviceFamily = deviceFamily;
return sessionConfig;
}
@@ -529,18 +566,10 @@ BOOL CreateHomeDirSubDirs(NSString* userHomePath) {
// path, then sets the path in the appropriate environment variable.
// Returns YES if successful, NO if unable to create or initialize the given
// directory.
-BOOL InitializeSimulatorUserHome(NSString* userHomePath, NSString* deviceName) {
+BOOL InitializeSimulatorUserHome(NSString* userHomePath) {
if (!CreateHomeDirSubDirs(userHomePath))
return NO;
- // Set the device to simulate. Note that the iOS Simulator must not be running
- // for this setting to take effect.
- CFStringRef iPhoneSimulatorAppID = CFSTR("com.apple.iphonesimulator");
- CFPreferencesSetAppValue(CFSTR("SimulateDevice"),
- deviceName,
- iPhoneSimulatorAppID);
- CFPreferencesAppSynchronize(iPhoneSimulatorAppID);
-
// Update the environment to use the specified directory as the user home
// directory.
// Note: the third param of setenv specifies whether or not to overwrite the
@@ -728,7 +757,7 @@ int main(int argc, char* const argv[]) {
exit(kExitInitializationFailure);
}
}
- if (!InitializeSimulatorUserHome(simHomePath, deviceName)) {
+ if (!InitializeSimulatorUserHome(simHomePath)) {
LogError(@"Unable to initialize home directory for simulator: %@",
simHomePath);
exit(kExitInitializationFailure);
@@ -741,7 +770,8 @@ int main(int argc, char* const argv[]) {
stdioPath,
appArgs,
appEnv,
- deviceFamily);
+ deviceFamily,
+ deviceName);
SimulatorDelegate* delegate =
[[[SimulatorDelegate alloc] initWithStdioPath:stdioPath
developerDir:developerDir
diff --git a/testing/iossim/redirect-stdout.sh b/testing/iossim/redirect-stdout.sh
index feff2c9..d6c3cf8 100755
--- a/testing/iossim/redirect-stdout.sh
+++ b/testing/iossim/redirect-stdout.sh
@@ -3,18 +3,21 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
-# This script executes the command given as the first argument and redirects
-# the command's stdout to the file given as the second argument.
+# This script executes the command given as the first argument, strips
+# cxx_destruct from stdout, and redirects the remaining stdout to the file given
+# as the second argument.
#
# Example: Write the text 'foo' to a file called out.txt:
# RedirectStdout.sh "echo foo" out.txt
#
# This script is invoked from iossim.gyp in order to redirect the output of
# class-dump to a file (because gyp actions don't support redirecting output).
+# This script also removes all lines with cxx_destruct. Perhaps newer versions
+# of class-dump will fix this issue. As of 3.5, 'cxx_destruct' still exists.
if [ ${#} -ne 2 ] ; then
echo "usage: ${0} <command> <output file>"
exit 2
fi
-exec $1 > $2 \ No newline at end of file
+$1 | sed /cxx_destruct/d > $2