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

force otest-query for application tests to use the i386 flavor of the TEST_HOST #200

Closed
wants to merge 1 commit into from

Conversation

fpotter
Copy link
Contributor

@fpotter fpotter commented Oct 11, 2013

This fixes the problem where xctool would fail to query the list of
tests cases in the best bundle. i.e. --

failed: Failed to query the list of test cases in the test bundle: dyld:
could not load inserted library:
/usr/local/Cellar/xctool/0.1.13/libexec/lib/otest-query-ios-dylib.dylib

The problem was that, if the .app was built using ONLY_ACTIVE_ARCH=NO,
the .app would actually be Universal with x86_64 and i386 versions.
When we would launch the app with otest-query-ios-dylib injected, it
would crash since the x86_64 flavor of the .app was being launched, but
the dylib is i386 only.

The right thing to do here is just force the .app launch to be
i386-only. Even though you CAN trick Xcode/xcodebuild/xctool into
building Universal versions of simulator apps, Xcode.app will only ever
run the i386 versions of your .apps and test bundles. It does not care
if your binary is universal - xctool should follow suit.

Test Plan:
Created a test project as per @sandervandenbrink's comment --
@#170 (comment)

Ran the following and observed things crashed --

xctool -project foo.xcodeproj -scheme foo -sdk iphonesimulator7.0 ONLY_ACTIVE_ARCH=NO clean test

Applied the fix, and ran the same command and observed things now
worked.

… TEST_HOST

This fixes the problem where xctool would fail to query the list of
tests cases in the best bundle.  i.e. --

```
failed: Failed to query the list of test cases in the test bundle: dyld:
could not load inserted library:
/usr/local/Cellar/xctool/0.1.13/libexec/lib/otest-query-ios-dylib.dylib
```

The problem was that, if the .app was built using ONLY_ACTIVE_ARCH=NO,
the .app would actually be Universal with x86_64 and i386 versions.
When we would launch the app with otest-query-ios-dylib injected, it
would crash since the x86_64 flavor of the .app was being launched, but
the dylib is i386 only.

The right thing to do here is just force the .app launch to be
i386-only.  Even though you CAN trick Xcode/xcodebuild/xctool into
building Universal versions of simulator apps, Xcode.app will only ever
run the i386 versions of your .apps and test bundles.  It does not care
if your binary is universal - xctool should follow suit.

Test Plan:
Created a test project as per @sandervandenbrink's comment --
@#170 (comment)

Ran the following and observed things crashed --

```
xctool -project foo.xcodeproj -scheme foo -sdk iphonesimulator7.0 ONLY_ACTIVE_ARCH=NO clean test
```

Applied the fix, and ran the same command and observed things now
worked.
@fpotter fpotter mentioned this pull request Oct 11, 2013
@fpotter
Copy link
Contributor Author

fpotter commented Oct 11, 2013

Hrm. I had a flawed assumption.

When you set your simulator device type to "iPhone Retina (4-inch 64-bit)", it actually does run the x86_64 flavor of the app.

This means that otest-shim + otest-query really do need to go Universal.

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

Successfully merging this pull request may close these issues.

None yet

1 participant