[android] Add support for running workitems on specified Android emulator API levels #1469
+422
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for specifying multiple Android API levels when running tests in XHarness, addressing the need for the new Helix "multi" queue that contains pre-installed emulators covering all API levels.
Changes Made
Enhanced
--api-version
ArgumentModified the existing
ApiVersionArgument
to support multiple values by extendingRepeatableArgument
instead ofOptionalIntArgument
:The argument can now be specified multiple times to test across different API levels, with the help text automatically indicating "Can be used more than once".
Emulator Management
Extended
AdbRunner
with new emulator management capabilities:StartEmulator(int apiLevel)
- Starts an emulator for a specific API levelStopEmulator(int apiLevel)
- Stops an emulator for a specific API levelStopEmulators(IEnumerable<int> apiLevels)
- Stops multiple emulatorsThe system automatically starts emulators for specified API levels when using multiple
--api-version
arguments, addressing the requirement that the "multi" queue does not start emulators by default.Distinguishable Results
When running tests on multiple API levels, results are stored in separate directories:
/output/api-28/
for API level 28 results/output/api-29/
for API level 29 resultsThis ensures results are distinguishable when the same workitem runs on multiple API levels.
Backward Compatibility
FirstApiVersion
property toApiVersionArgument
for backward compatibility with existing commands (android test
,android install
,android device
) that only support single API versions--api-version
argument maintains full backward compatibility - when used once, it behaves exactly as beforeComprehensive Testing
Added unit tests covering:
Usage Examples
Fixes #1459.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.