From 7a6c5b6ab502167a966a5418073fcf25b134a8ba Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Thu, 21 Oct 2021 18:34:21 +0200 Subject: [PATCH] test: make the coverage check safer for non-compiled builds --- test/test-functions | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 54be19ffc0..98b60d17f8 100644 --- a/test/test-functions +++ b/test/test-functions @@ -238,8 +238,16 @@ is_built_with_asan() { fi } +is_built_with_coverage() { + if get_bool "${NO_BUILD:=}" || ! command -v meson >/dev/null; then + return 1 + fi + + meson configure "${BUILD_DIR:?}" | grep 'b_coverage' | awk '{ print $2 }' | grep -q 'true' +} + IS_BUILT_WITH_ASAN=$(is_built_with_asan && echo yes || echo no) -IS_BUILT_WITH_COVERAGE=$(meson configure "${BUILD_DIR:?}" | grep 'b_coverage' | awk '{ print $2 }' | grep -q 'true' && echo yes || echo no) +IS_BUILT_WITH_COVERAGE=$(is_built_with_coverage && echo yes || echo no) if get_bool "$IS_BUILT_WITH_ASAN"; then STRIP_BINARIES=no