Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

xctool fails to launch tests under Xcode 8.1 #718

Closed
ExtremeMan opened this issue Oct 27, 2016 · 10 comments
Closed

xctool fails to launch tests under Xcode 8.1 #718

ExtremeMan opened this issue Oct 27, 2016 · 10 comments
Assignees

Comments

@ExtremeMan
Copy link
Contributor

Subscribe if you want to follow a progress on this issue.

@ExtremeMan ExtremeMan self-assigned this Oct 27, 2016
@aaronclarke
Copy link

aaronclarke commented Oct 30, 2016

Is this for the crash referred to by @cegona in #704 (comment) and me in #704 (comment) ?

since EM confirmed that, I'm editing in quotes of those comments here so people can find this issue more easily.

cegona said:

I'm using xctool 0.2.10 (from master) and Xcode 8.1 Beta 1 and got this error:

2016-10-04 18:50:31.047 xctool[5019:1134172] +[SimDeviceType supportedDeviceTypesByAlias]: unrecognized selector sent to class 0x10866ffe0
2016-10-04 18:50:31.180 xctool[5019:1134172] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimDeviceType supportedDeviceTypesByAlias]: unrecognized selector sent to class 0x10866ffe0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff910d44f2 exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8922ef7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff9113e0ad +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff91044571 __forwarding + 1009
4 CoreFoundation 0x00007fff910440f8 _CF_forwarding_prep_0 + 120
5 xctool 0x0000000107d63e18 +[SimulatorInfo deviceNameForAlias:] + 58
6 xctool 0x0000000107d49122 -[Options _validateDestinationWithErrorMessage:] + 365
7 xctool 0x0000000107d47b6c -[Options validateAndReturnXcodeSubjectInfo:errorMessage:] + 104
8 xctool 0x0000000107d394ca -[XCTool run] + 2858
9 xctool 0x0000000107d37ebd main + 1151
10 xctool 0x0000000107d328f4 start + 52
11 ??? 0x0000000000000009 0x0 + 9
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

using this command:

xctool -configuration Test -destination 'platform=iOS Simulator,OS=10.1,name=iPhone 7' -showTasks test OBJROOT=./Build

anyone with the same problem?

aaronclarke said:

@cegonya I've seen similar with our own projects, also on 0.2.10 and Xcode 8.1 beta 3.

I'm new to reverse engineering Xcode frameworks, but from my debugging with otool -ov /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/CoreSimulator it looks like a lot of functionality related to getting all devicetypes / runtimes / devices has moved from their respective classes to being accessible from an instance of "SimServiceContext"

Where before there was:
-[SimDeviceType supportedDeviceTypesByAlias]
+[SimDeviceSet defaultSet]
+[SimRuntime supportedRuntimes]

There is now:
-[SimServiceContext supportedDeviceTypesByAlias]
-[SimServiceContext defaultDeviceSetWithError:]
-[SimServiceContext supportedRuntimes]

The class can be initialized with something like this:
[SimServiceContext sharedServiceContextForDeveloperDir:XcodeDeveloperDir() error:nil]

@ExtremeMan
Copy link
Contributor Author

@aaronclarke, yes. There might be other issues too.

@ExtremeMan
Copy link
Contributor Author

I have quickly written up a fix for Xcode 8.1. I will appreciate some help with testing. Can someone checkout https://github.com/facebook/xctool/tree/xcode81 and confirm if it works for them under Xcode 8.1 and Xcode 8.0?

@aaronclarke
Copy link

I have Xcode 8.0 and Xcode 8.1 beta 3 side-by-side, so I tried it out and it looks good to me.

command:
./xctool.sh -showTasks -sdk iphonesimulator run-tests -test-sdk iphonesimulator -testTimeout 5 -logicTest /foo/bar.xctest -only /foo/bar.xctest

Switched between Xcode versions with sudo xcode-select -switch <path/to/Xcode.app>

master + Xcode 8.0 --- pass
master + Xcode 8.1 --- crash

xcode81 + Xcode 8.0 --- pass
xcode81 + Xcode 8.1 --- pass

@ExtremeMan
Copy link
Contributor Author

Thanks, @aaronclarke! Travis CI is satisfied with xctool as well (Xcode 8). I need to look into xctool tests undex Xcode 8.1 this week before making a release. Also another homebrew patch is pending approval.

@alanzeino
Copy link
Contributor

I'll test this on our CI in staging and let you know how it goes

@ExtremeMan
Copy link
Contributor Author

@alanzeion, thanks!

@ExtremeMan
Copy link
Contributor Author

Fixes are on master. Pushing to homebrew.

@alanzeino
Copy link
Contributor

Stress tested 0.3.1 on our CI for a day, no issues to report. Thanks for the quick turnaround!

@ExtremeMan
Copy link
Contributor Author

Awesome! Thanks for your feedback, @alanzeino!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants