Title: [204656] trunk/Tools
Revision
204656
Author
[email protected]
Date
2016-08-19 15:03:31 -0700 (Fri, 19 Aug 2016)

Log Message

Adopt SimServiceContext in LayoutTestRelay
https://bugs.webkit.org/show_bug.cgi?id=161000
<rdar://problem/25765594>

Reviewed by Daniel Bates.

* LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h:
* LayoutTestRelay/LayoutTestRelay/main.m:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (204655 => 204656)


--- trunk/Tools/ChangeLog	2016-08-19 21:55:55 UTC (rev 204655)
+++ trunk/Tools/ChangeLog	2016-08-19 22:03:31 UTC (rev 204656)
@@ -1,3 +1,14 @@
+2016-08-19  Alexey Proskuryakov  <[email protected]>
+
+        Adopt SimServiceContext in LayoutTestRelay
+        https://bugs.webkit.org/show_bug.cgi?id=161000
+        <rdar://problem/25765594>
+
+        Reviewed by Daniel Bates.
+
+        * LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h:
+        * LayoutTestRelay/LayoutTestRelay/main.m:
+
 2016-08-19  Lucas Forschler  <[email protected]>
 
         Remove Yosemite Leaks bot after http://trac.webkit.org/projects/webkit/changeset/204629

Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h (204655 => 204656)


--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h	2016-08-19 21:55:55 UTC (rev 204655)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h	2016-08-19 22:03:31 UTC (rev 204656)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,25 +25,34 @@
 
 #if __has_include(<CoreSimulator/CoreSimulator.h>)
 
+/* FIXME: Remove the below #define once we require Xcode 7.3 with iOS 9.3 SDK or newer. */
 #define __coresim_unavailable_msg(msg)
 #import <CoreSimulator/CoreSimulator.h>
 
+/* FIXME: Always use SimServiceContext once we require Xcode 7.3 with iOS 9.3 SDK or newer. */
+#define USE_SIM_SERVICE_CONTEXT defined(CORESIM_API_MAX_ALLOWED)
+
 #else
 
 #import <Foundation/Foundation.h>
 
+#define USE_SIM_SERVICE_CONTEXT 1
+
 #define kSimDeviceLaunchApplicationArguments @"arguments"
 #define kSimDeviceLaunchApplicationEnvironment @"environment"
 
 @interface SimDevice : NSObject
-- (BOOL)installApplication:(NSURL *)installURL withOptions:(NSDictionary *)options error:(NSError **)error;
-- (pid_t)launchApplicationWithID:(NSString *)bundleID options:(NSDictionary *)options error:(NSError **)error;
+- (BOOL)installApplication:(NSURL *)installURL withOptions:(NSDictionary *)options error:(NSError * __autoreleasing *)error;
+- (pid_t)launchApplicationWithID:(NSString *)bundleID options:(NSDictionary *)options error:(NSError * __autoreleasing *)error;
 @end
 
 @interface SimDeviceSet : NSObject
-+ (SimDeviceSet *)defaultSet;
 @property (readonly, copy) NSDictionary *devicesByUDID;
+@end
 
+@interface SimServiceContext : NSObject
++(SimServiceContext *)sharedServiceContextForDeveloperDir:(NSString *)developerDir error:(NSError * __autoreleasing *)error;
+-(SimDeviceSet *)defaultDeviceSetWithError:(NSError * __autoreleasing *)error;
 @end
 
 #endif

Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m (204655 => 204656)


--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m	2016-08-19 21:55:55 UTC (rev 204655)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m	2016-08-19 22:03:31 UTC (rev 204656)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -91,12 +91,28 @@
             }
         }
 
+        NSString *developerDirectory = getRequiredStringArgument(@"developerDir");
         NSUUID *udid = [[NSUUID alloc] initWithUUIDString:getRequiredStringArgument(@"udid")];
         NSString *appPath = getRequiredStringArgument(@"app");
         NSString *productDirectory = getRequiredStringArgument(@"productDir");
         NSArray *dumpToolArguments = getDumpToolArguments();
 
+#if USE_SIM_SERVICE_CONTEXT
+        NSError *error;
+        SimServiceContext *serviceContext = [SimServiceContext sharedServiceContextForDeveloperDir:developerDirectory error:&error];
+        if (!serviceContext) {
+            NSLog(@"Device context couldn't be found: %@", error);
+            exit(EXIT_FAILURE);
+        }
+        SimDeviceSet *deviceSet = [serviceContext defaultDeviceSetWithError:nil];
+        if (!deviceSet) {
+            NSLog(@"Default device set couldn't be found: %@", error);
+            exit(EXIT_FAILURE);
+        }
+        SimDevice *device = [deviceSet.devicesByUDID objectForKey:udid];
+#else
         SimDevice *device = [SimDeviceSet.defaultSet.devicesByUDID objectForKey:udid];
+#endif
         if (!device) {
             NSLog(@"Device %@ couldn't be found", udid);
             exit(EXIT_FAILURE);

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (204655 => 204656)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2016-08-19 21:55:55 UTC (rev 204655)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2016-08-19 22:03:31 UTC (rev 204656)
@@ -599,6 +599,7 @@
         dump_tool_args = cmd[1:]
         product_dir = self._port._build_path()
         relay_args = [
+            '-developerDir', self._port.developer_dir,
             '-udid', self._port.testing_device(self._worker_number).udid,
             '-productDir', product_dir,
             '-app', dump_tool,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to