Llvm-cov not working in docker in some environments

I'm trying to use the llvm-cov report command to gather code coverage results in CI builds.

When using the swiftlang/swift:nightly-5.2 image locally, I get the expected output.

However, when running the exact same invocation of llvm-cov report in the exact same image in GitLab CI, I get no results. (reports no sources and 0 code coverage in the table).

GitLab CI reports:

Using docker image sha256:85d532e49acb8a1baeb0c0078459858c777769ab080cc114d9cb1bfb652294f2...
...

$ swift --version
Swift version 5.2-dev (Swift 66c06abcc8)
Target: x86_64-unknown-linux-gnu

$ llvm-cov --version
LLVM (http://llvm.org/):
  LLVM version 7.0.0svn
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: haswell

Docker reports the following locally:

REPOSITORY         TAG            IMAGE ID
swiftlang/swift    nightly-5.2    85d532e49acb

Locally, the digest SHA is 7e39bbfe840780d0dcffad0d9881cfc9b2fdca74dbdbb743f5a5c777a2271074, which matches the digest of the image as reported by Docker Hub.

What could be causing this?

For completeness, here's the invocation of llvm-cov report:

    swift test --enable-code-coverage

    BINARY_PATH=".build/x86_64-unknown-linux-gnu/debug/redi-stackPackageTests.xctest"
    PROF_DATA_PATH=".build/x86_64-unknown-linux-gnu/debug/codecov/default.profdata"
    IGNORE_FILENAME_REGEX="(.build|TestUtils|Tests)"

    llvm-cov report \
      $BINARY_PATH \
      --format=text \
      -instr-profile="$PROF_DATA_PATH" \
      -ignore-filename-regex="$IGNORE_FILENAME_REGEX"
1 Like

Follow up: It looks like there's a difference in GitLab CI's docker host from my local machine.

llvm-cov --version in the swift:5.1 docker image:

  • GitLab CI reports haswell CPU
  • GitHub Actions reports skylake-avx512
  • Local reports skylake