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