Hey, I've been building and testing on linux since earlier this year, specifically on Arch linux. This is the command I use to build and run the Foundation tests:
./swift/utils/build-script -R --no-assertions --llvm-targets-to-build="X86;ARM;AArch64" -j2 --xctest -T --skip-test-swift`
Note that only the
--xctest -T are required- as others have noted XCTest has to be built first, because the Foundation tests run with it- everything else is optional. Take a look at
./swift/utils/build-test --help to get a better idea, I came up with this command after looking at that help info and experimenting a bit.
-R --no-assertions means a Release build without assertions, you may prefer otherwise. I don't bother building several uncommon targets in the LLVM backend, just to save some time on the interminable LLVM build. I skip the Swift tests after the first build, you can find more ways to just run the tests you want in the build-script flags.
This will run the entire test suite, you can iterate on a particular function or test after running this once, by going to the build directory and running
ninja test or invoking the TestFoundation binary directly.
I think the problem with your current approach is that the build-script disables building the tests when you simply build Foundation, then circles back later and enables them before building and running the Foundation tests. That's different than how it works for other Swift repos with the build-script.