Support command-line arguments and XCTest filters without forcing xcodebuild in ios_xctestrun_runner
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- build-system, testing
Research direction
Start by locating ios_xctestrun_runner and comparing the direct xctest and xcodebuild test-without-building branches. Check how command_line_args and test filters are parsed, then find the runner tests that cover backend selection. Done means representable arguments and XCTest selections use direct execution while cases it cannot handle still select xcodebuild; add or update tests for both paths.
Written by the indexing model from the issue text.
Description
Allow hostless iOS simulator XCTest bundles to continue using direct xctest execution when supplying command-line arguments or test selections that xctest can handle.
Currently, ios_xctestrun_runner switches to xcodebuild test-without-building whenever command_line_args or a test filter is supplied. The direct execution branch always invokes:
xcrun simctl spawn <simulator-udid> <xctest-binary> \
-XCTest All <test-bundle>
However, direct xctest execution supports useful arguments and test selection, so these inputs do not always require switching execution backends.
Use cases
1. Language, locale, and text-direction overrides
-AppleLanguages '(en_GB)' -AppleLocale en_US -AppleTextDirection NO
Apple documents these launch arguments in Testing Your Internationalized App, alongside arguments for testing right-to-left layouts, double-length localized strings, and detecting non-localized strings.
Passing preferences per invocation avoids changing persistent simulator preferences.
2. Custom test configuration
Test code or its dependencies may read startup arguments through CommandLine.arguments, ProcessInfo, or argument-domain preferences-for example, to select fixtures or enable test-specific behavior.
3. Running selected XCTest classes or methods
The documented xctest -XCTest option supports class and method identifiers, including comma-separated selections. Running one test, one class, or several selected tests should be able to retain direct execution where the selection is representable.
These cases are particularly useful for short hostless test bundles, where switching to xcodebuild introduces additional startup and orchestration work.
Example
Given an otherwise directly executable hostless XCTest target:
bazel test //tests:ExampleTests \
--test_arg="--command_line_args=-AppleLanguages,(en_GB),-AppleLocale,en_US"
Or:
bazel test //tests:ExampleTests \
--test_filter=ExampleTests/testExample
Both currently select xcodebuild, even when no other requested feature requires it.
- Dominant language
- Starlark
- Stars
- 600
- Forks
- 354
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_apple
-
`ios_xctestrun_runner` skips the simulator cleanup action on early exits and signalsPossibly taken @katre claimed this 2 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 67/100
bazelbuild/rules_apple#3163 ·
Maintainers usually reply within 1 day
-
register_binary_linking_action links with the GCC coverage map format under coveragePossibly taken @TrapsterDK claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
bazelbuild/rules_apple#3160 ·
Maintainers usually reply within 1 day
-
Registered toolchains load //apple/internal and its dependencies in every buildMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
bazelbuild/rules_apple#3158 ·
Maintainers usually reply within 1 day
-
Simulator cleanup is skipped when the post-action failsPossibly taken @vakhidbetrakhmadov claimed this 14 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
bazelbuild/rules_apple#3147 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
bazelbuild/rules_apple#3139 ·
Maintainers usually reply within 1 day
All issues in bazelbuild/rules_apple
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
bazelbuild/apple_support#707 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
out-of-date
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CachyOS/CachyOS-PKGBUILDS#2232 ·
Maintainers usually reply within 1 day
-
blast/large refactor risk/low spend-dem
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
chriskelly/MusicWall#87 · 2 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 77/100