drivers/relays: hardened + 100% MC/DC (Tier-1, first driver)

Bring relays.c into warden-sdk/drivers/ behind a relay_io seam (ADR-0005): the
sysfs plumbing is an injectable backend, the gpio root is $WARDEN_GPIO_ROOT-
overridable. Host harness (drivers/relays/test/) reaches 100% MC/DC (40/40
conditions, 100% lines) by combining fake-io unit tests (logic branches incl.
export->node-appears) with real-sysfs integration tests over a scratch tree
(backend fopen/stat branches). CI `mcdc` job enforces 100% across drivers/*/test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wB8KB3MMQztRDXCMCkPrf
This commit is contained in:
BFE Engineering
2026-08-25 14:01:29 -06:00
co-authored by Claude Opus 4.8
parent d4acc9f3b3
commit 1752dea7b6
7 changed files with 516 additions and 0 deletions
+19
View File
@@ -49,6 +49,25 @@ jobs:
echo "coverage=$pct" >> "$GITHUB_OUTPUT"
echo "tests passed: $passed | sim line coverage: ${pct}%"
mcdc:
# 100% MC/DC (condition coverage) enforced on every Tier-1 driver harness.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install gcc-14
run: sudo apt-get update -qq && sudo apt-get install -y -qq gcc-14
- name: enforce 100% MC/DC on drivers/*/test
run: |
fail=0; ran=0
for t in drivers/*/test; do
[ -f "$t/Makefile" ] || continue
ran=1
echo "== MC/DC: $t =="
make -C "$t" check CC=gcc-14 GCOV=gcov-14 || fail=1
done
[ "$ran" = 1 ] || { echo "no driver MC/DC harnesses found"; exit 1; }
exit $fail
badges:
needs: [test]
if: github.event_name == 'push' && github.ref == 'refs/heads/bringup'