summaryrefslogtreecommitdiffstats
path: root/test/run-integration-tests.sh
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-10-03 17:50:38 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2021-10-04 17:40:49 +0200
commitc82dc15b9fcc8fde17d48d3beaec650ecda5bbbf (patch)
treed245c91271e162d33e812ee7841d74583a793853 /test/run-integration-tests.sh
parentman/glib-event-glue example: relicense to CC0-1.0 (diff)
downloadsystemd-c82dc15b9fcc8fde17d48d3beaec650ecda5bbbf.tar.xz
systemd-c82dc15b9fcc8fde17d48d3beaec650ecda5bbbf.zip
test: create and merge code coverage reports in integration tests
If -Db_coverage=true is used at build time, then ARTIFACT_DIRECTORY/TEST-XX-FOO.coverage-info files are created with code coverage data, and run-integration-test.sh also merges them into ARTIFACT_DIRECTORY/merged.coverage-info since the coveralls.io helpers accept only a single file.
Diffstat (limited to 'test/run-integration-tests.sh')
-rwxr-xr-xtest/run-integration-tests.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/run-integration-tests.sh b/test/run-integration-tests.sh
index 89058f4aca..6746d94ffe 100755
--- a/test/run-integration-tests.sh
+++ b/test/run-integration-tests.sh
@@ -116,4 +116,17 @@ else
echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
fi
+# If we have coverage files, merge them into a single report for upload
+if [ -n "${ARTIFACT_DIRECTORY}" ]; then
+ lcov_args=()
+
+ while read -r info_file; do
+ lcov_args+=(--add-tracefile "${info_file}")
+ done < <(find "${ARTIFACT_DIRECTORY}" -maxdepth 1 -name "*.coverage-info")
+
+ if [ ${#lcov_args[@]} -gt 1 ]; then
+ lcov "${lcov_args[@]}" --output-file "${ARTIFACT_DIRECTORY}/merged.coverage-info"
+ fi
+fi
+
exit "$FAILURES"