swift-package-manager: `swift build --build-tests` doesn't allow disabling tests with `--skip` or `--filter`

Description

This is particularly useful when cross-compiling the test runner for a package, as I do for Android:

swift build --build-tests --enable-test-discovery --destination ~/swift-android-sdk/android-aarch64.json

The idea here is to be able to cross-compile the test runner and skip some tests: ~an alternative would be to add a --skip-run flag to swift test, so it builds but won’t run the tests.~ (that alternative won’t work, see next comment). @grynspan informs me that the new swift-testing tests can be filtered/skipped easily by passing these flags to the test runner, so this issue only deals with XCTest tests.

Expected behavior

Be able to skip or filter certain tests when cross-compiling the tests

Actual behavior

> ~/swift-DEVELOPMENT-SNAPSHOT-2022-09-24-a-ubuntu20.04/usr/bin/swift build --build-tests --enable-test-discovery --filter Contended
error: Unknown option '--filter'

Steps to reproduce

  1. ~/swift-DEVELOPMENT-SNAPSHOT-2022-09-24-a-ubuntu20.04/usr/bin/swift build --build-tests --enable-test-discovery --filter Contended

Swift Package Manager version/commit hash

5.7 and 5.8

Swift & OS version (output of swift --version && uname -a)

Never worked in Swift on Ubuntu 20.04 x86_64

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 34 (34 by maintainers)

Most upvoted comments

@grynspan, alright, let me see if I can get this working when cross-compiling tests for non-Darwin platforms at some point, then we can see what you all want to do about Darwin.

not sure what “it’s not going to make any progress” refers to: nobody is asking you or any other Apple dev to implement this new feature.

Of course. I look forward to community contributions here.