This weekend I tried to upgrade my app to swift 6.1, and I stumb into an error in the pipeline, with a huge stack-trace. After trying it in my local machine I found that this is generates a counter overflow when I run my tests with code-coverage enabled and also in parallel.
This is a small part of the full stacktrace, Seems some case of recursivity at first look.
I can confirm the error comes from the mixed SwiftTesting with XCTest, once I moved everything to swiftTesting, the tests are green again with 6.1 (well, I've got some issue when runing in paralle, but nothing big) Should I create an issue in swift?
Sharing another clue. I am able to reproduce this from within a swift:6.1 linux container with two different packages that do not have mixed test cases, only XCTests cases. The llvm-profdata merge failure seems to be correlated with the presence of the --parallel flag.
I can consistently reproduce this in an internal project that has ~25 test suites (all of which are XCTest cases). Running the test suites individually, I discovered that it reproduced within four of them. This is the furthest I've been able to reduce so far -- at the test suite level.
Regarding a workaround, even though migrating these four suites over to Swift Testing did resolve the issue when running them suite by suite, once I went back to running all tests, the issue reproduced again. Partially migrating to Swift Testing was not successful in this case. Migrating the rest of the test suites over to Swift Testing may be enough to completely avoid the bug, but that is yet to be confirmed.