6.1 test paralel with code coverage throw an error in llvm-profdata

Helo,

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.

error: terminated(1): /usr/bin/llvm-profdata merge -sparse /__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/XCTest13463496829016464912_0.profraw '/__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/Swift Testing13463496829016464912_0.profraw' -o /__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/default.profdata output:
    /__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/XCTest13463496829016464912_0.profraw: $s7Atomics20AtomicUpdateOrderingV9_rawValueACSi_tcfC: counter overflow
    /__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/XCTest13463496829016464912_0.profraw: $s7Atomics19_AtomicInt64StorageVyACBi64_cfC: counter overflow
    /__w/mr-scrooge/mr-scrooge/.build/aarch64-unknown-linux-gnu/debug/codecov/XCTest13463496829016464912_0.profraw: $s7Atomics20AtomicUpdateOrderingV2eeoiySbAC_ACtFZ: counter overflow

In my tests I've got XC test cases and Swift Testing cases (Just started migrating stuff)

You can see the full Stack Trace here:

Any Idea if this is a known error? Also some workarround to make it working?

Thanks,
Jaume.

1 Like

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?

Just adding a +1 for this issue. We are seeing it as well in various repos with mixed XCTest and SwiftTesting test cases.

1 Like

Then, I will try to create a ticket in swiftlang this afternoon. I think I've got some sample/empty project with mixed tests

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.

Hello,

I was trying to create a sample that repeats this problem, but I did some mixing, with 3 different tests, and doesn't seem to appear.

Can I get some help to find a minimum repeatable code?

Thanks!

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.

1 Like