From 9335c28e1f8ae8b2f27577b6b759c995835b4299 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Sat, 24 Oct 2026 23:09:51 -0300 Subject: [PATCH] Fix MC/DC report Signed-off-by: Juan Cruz Viotti --- .github/workflows/website.yml | 7 +++++-- contrib/website.sh | 32 +++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index d0fe023f2..eb8ae5688 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -51,13 +51,16 @@ jobs: - name: Build the website # Every function that the published report measures has to be called by # the test suite, so that a change cannot quietly lower it, and each of - # the other three shares has a floor the project has already cleared. + # the other four shares has a floor the project has already cleared. # Branches sit lower than the rest because an exhaustive switch over an - # enumeration carries an edge out of it that nothing can take + # enumeration carries an edge out of it that nothing can take, and + # conditions lower still because taking both outcomes of a condition is + # not the same as showing that condition decide an outcome on its own env: REQUIRE_FULL_FUNCTION_COVERAGE: "1" REQUIRE_MINIMUM_COVERAGE: "97" REQUIRE_MINIMUM_BRANCH_COVERAGE: "92" + REQUIRE_MINIMUM_CONDITION_COVERAGE: "82" run: | useradd --create-home builder chown -R builder . diff --git a/contrib/website.sh b/contrib/website.sh index 51a5f6d83..890c656e2 100755 --- a/contrib/website.sh +++ b/contrib/website.sh @@ -79,15 +79,29 @@ export CTEST_PARALLEL_LEVEL # So it is asked for by the one module whose programs die that way, over the # handful of translation units that module builds, rather than here across the # project. Those programs ask for it by name themselves, having been built to -# honour it, which is why nothing of the sort is set below. +# honour it, which is why nothing of the sort is set below +PROFILE_FLAGS="-fprofile-instr-generate -fcoverage-mapping" + +# Every decision written out of more than one condition records which +# combinations of those conditions the suite tried, which is what the fourth +# measure below is read out of. It costs a bitmap per decision in each program +# and an update to it wherever one is decided, and what a decision may be made +# of is bounded, so a wider one than the bound allows is left uninstrumented +# rather than refused. # -# The last of the three asks for every decision written out of more than one -# condition to record which combinations of those conditions the suite tried, -# which is what the fourth measure below is read out of. It costs a bitmap per -# decision in each program and an update to it wherever one is decided, and -# what a decision may be made of is bounded, so a wider one than the bound -# allows is left uninstrumented rather than refused -PROFILE_FLAGS="-fprofile-instr-generate -fcoverage-mapping -fcoverage-mcdc" +# Only the C++ compilation asks for it. Every source this report measures is +# C++, while the C this build also compiles is vendored and left out of the +# report, where the measurement would be paid for and never read. +# +# A decision that nests a boolean expression inside another operation is left +# uninstrumented too, and the compiler says so wherever it meets one. That is +# a limit of the measurement rather than anything wrong with the code, so it +# stays a warning here instead of failing a build that asks for warnings to be +# errors. It is accompanied by the one option that keeps a compiler which +# instruments this without carrying that warning from refusing a name it does +# not know +DECISION_FLAGS="-fcoverage-mcdc -Wno-unknown-warning-option" +DECISION_FLAGS="$DECISION_FLAGS -Wno-error=pgo-coverage" # Assertions are compiled out, which is a measurement decision rather than an # instrumentation one. The branch an assertion takes when it fails is @@ -112,7 +126,7 @@ cmake -S "$SOURCE_DIRECTORY" -B "$BUILD_DIRECTORY" \ -DSOURCEMETA_CORE_CRYPTO_USE_REFERENCE:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_C_FLAGS:STRING="$PROFILE_FLAGS $ASSERTION_FLAGS" \ - -DCMAKE_CXX_FLAGS:STRING="$PROFILE_FLAGS $ASSERTION_FLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$PROFILE_FLAGS $DECISION_FLAGS $ASSERTION_FLAGS" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="-fprofile-instr-generate" \ -DCMAKE_SHARED_LINKER_FLAGS:STRING="-fprofile-instr-generate"