collect-coverage.sh 982 B

123456789101112131415161718192021
  1. #!/bin/bash -x
  2. # This script is meant to be executed on all "slave" machines that run coverage collection.
  3. COV_DIR=coverage
  4. COV_NAME="$(echo $JOB_NAME | sed 's#/#-#g').info"
  5. COV_INFO="$COV_DIR/$COV_NAME"
  6. # Build Mono and collect coverage on the test suite.
  7. CI_TAGS="collect-coverage,monolite,$CI_TAGS" scripts/ci/run-jenkins.sh
  8. # Place the coverage info file into the coverage directory.
  9. # Multiple such files can be assembled to create a unified coverage report that spans multiple architectures and operating systems.
  10. mkdir "$COV_DIR"
  11. scripts/ci/run-step.sh --label=coverage-lcov --timeout=20m lcov --no-external -c -d mono -d support -d tools -o "$COV_INFO"
  12. # Generate HTML coverage report in the lcov directory at the root of the project.
  13. scripts/ci/run-step.sh --label=coverage-genhtml --timeout=20m genhtml -s "$COV_INFO" -o lcov
  14. # Make the paths relative so that they could be assembled from different Jenkins workspaces.
  15. sed -Eie "s#^SF:$WORKSPACE/?#SF:#" "$COV_INFO"