Swift 5.1 introduced test discovery to allow tests to be discovered on Linux. This works great but also means that if you use swift build having deleted the LinuxMain.swift it will fail to build without the --enable-test-discovery flag.
Can we make --enable-test-discovery on by default going forward?
swift build shouldn’t fail if LinuxMain.swift is absent. That sounds like a bug. But yeah I think we can make test discovery on by default. Maybe we should emit a warning if there’s a LinuxMain.swift file present unless the flag is explicitly passed.
I might propose that, for the moment, rather than having an empty LinuxMain.swift it might be better to have one that contains an explanatory fatalError. That will ensure both that users who forget to use —enable-test-discovery will get a helpful message and that accidentally configuring a CI tool that forgets to pass this flag won’t lead to a quiet success.
There are some subtle behaviour differences w/ automatic test discovery but IMO it’s worth changing the default. Maybe someone should come up with a small proposal that describes what would be the impact of making this change and how you can use the current LinuxMain.swift method if needed? We can also use this opportunity to rename LinuxMain.swift to something more platform neutral..