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

Time to remove using default test entry point files like LinuxMain.swift? #7394

Closed
1 task done
finagolfin opened this issue Mar 5, 2024 · 3 comments
Closed
1 task done
Labels

Comments

@finagolfin
Copy link
Contributor

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI.

Description

Many repos that had this file could be overridden by passing in --enable-test-discovery, particularly when they were trying to push users to add that flag, apple/swift-numerics#280, but now that that flag has been removed, #7391, this default test entry file will again be forced on users, with no automated test discovery override but manually removing it.

Expected behavior

warning: '--enable-test-discovery' was specified so the 'LinuxMain.swift' entry point file for 'swift-numericsPackageTests' will be ignored and an entry point will be generated automatically. To use test discovery with a custom entry point file, pass '--experimental-test-entry-point-path '.
Building for debugging...

Actual behavior

Using these commands instead, as a trunk snapshot build after #7391 has not been released yet but the flag was already partially disabled, eg for this command:

> ../swift-DEVELOPMENT-SNAPSHOT-2024-03-04-a-ubi9/usr/bin/swift build --build-tests --enable-test-discovery
> .build/x86_64-unknown-linux-gnu/debug/swift-numericsPackageTests.xctest
swift_numericsPackageTests/LinuxMain.swift:12: Fatal error: Use --enable-test-discovery to run Swift Numerics tests on Linux.

Steps to reproduce

  1. cd swift-numerics/
  2. swift test --enable-test-discovery

Swift Package Manager version/commit hash

The March 1 trunk snapshot started showing the above error

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

Swift 6.0 on linux x86_64

@finagolfin finagolfin added the bug label Mar 5, 2024
@MaxDesiatov
Copy link
Member

MaxDesiatov commented Mar 5, 2024

this default test entry file will again be forced on users

There's no default test entry file in SwiftPM and it's not forced on users in any way, especially since none of our swift package init templates contain these entrypoint files (if they do, that's worth a separate bug report). The default since Swift 5.4 has been automated test discovery. The current expected behavior is for users to remove these entrypoint files if they don't want to use them. @grynspan can clarify if support for custom test entrypoint files should be maintained long term. If not, we should deprecate them altogether.

@MaxDesiatov MaxDesiatov closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2024
@grynspan
Copy link
Contributor

grynspan commented Mar 5, 2024

@stmontgomery is probably more knowledgeable than I am as he added the option in question. Custom test entry point files are an experimental feature and I don't think we intended to keep them around forever.

@finagolfin
Copy link
Contributor Author

There's no default test entry file in SwiftPM

Take a look at the source.

and it's not forced on users in any way

Swift-numerics cited above is a counter-example, ironically because it was trying to get people to use --enable-test-discovery back when that flag wasn't required.

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

No branches or pull requests

3 participants