Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fallback to iphonesimulator #1

Closed
wants to merge 1 commit into from
Closed

Conversation

tombooth
Copy link
Owner

In libgit2#484 more flags were
added into the variable sdkflag, which then caused the following
execution of run_xctool to always fail. This means that iOS tests have
not been running as part of the TravisCI run, they have only been built.
You can see this if you look at the final run for the PR:
https://travis-ci.org/libgit2/objective-git/builds/78334551#L192

Bash does some great things when trying to interpret variables in
commands. Initially the $sdkflag didn't have any quotes around it as
can be seen in commit 15f906c. When the
second flag was added this would have caused the command to fail because
of the way Bash would interpret the whitespace. Without the surrounding
quotes the command would have been executed as follows:

xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO -sdk iphonesimulator -destination '"platform=iOS' Simulator,name=iPhone '5"' -scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

You can see in the above that the white space was split in the middle of
the -destination parameter and it causes xctool to spout out an
error. When the surrounding quotes were added it caused xctool to run
but $sdkflag would be interpretted as a single argument, as it is
executed as follows:

xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO '-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"' -scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

Notice in the above that the entire argument is still surrounded by
single quotes.

This can be solved by switching $sdkflag for an array of strings, this
can then be correctly expanded in the command getting around the issues
highlighted above.

You can read more about these issues with Bash in the following links:

In libgit2#484 more flags were
added into the variable `sdkflag`, which then caused the following
execution of run_xctool to always fail. This means that iOS tests have
not been running as part of the TravisCI run, they have only been built.
You can see this if you look at the final run for the PR:
https://travis-ci.org/libgit2/objective-git/builds/78334551#L192

Bash does some great things when trying to interpret variables in
commands. Initially the `$sdkflag` didn't have any quotes around it as
can be seen in commit 15f906c. When the
second flag was added this would have caused the command to fail because
of the way Bash would interpret the whitespace. Without the surrounding
quotes the command would have been executed as follows:

```
xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO
-sdk iphonesimulator -destination '"platform=iOS' Simulator,name=iPhone
'5"' -scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY=
CODE_SIGNING_REQUIRED=NO
```

You can see in the above that the white space was split in the middle of
the `-destination` parameter and it causes `xctool` to spout out an
error. When the surrounding quotes were added it caused xctool to run
but `$sdkflag` would be interpretted as a single argument, as it is
executed as follows:

```
xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO
'-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"'
-scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY=
CODE_SIGNING_REQUIRED=NO
```

Notice in the above that the entire argument is still surrounded by
single quotes.

This can be solved by switching `$sdkflag` for an array of strings, this
can then be correctly expanded in the command getting around the issues
highlighted above.

You can read more about these issues with Bash in the following links:

  - http://mywiki.wooledge.org/BashFAQ/050
  - http://mywiki.wooledge.org/BashFAQ/073
@tombooth tombooth closed this Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant