spaxel/firmware/test/test_sanity.c
jedarden c66f62e616
Some checks are pending
CI Benchmark - Fusion Loop Timing / Fusion Loop Timing Benchmark (push) Waiting to run
test: land firmware host-test build scaffolding (Makefile, .gitignore, sanity)
The per-test setjmp/longjmp recovery loop in test_runner.c (main()) was
already delivered by sibling bead bf-bq9 (commit 549dc1f) and verified to
satisfy bf-53ut's contract: a failing assertion longjmps back to main()'s
setjmp, which falls through to advance the loop, so a failure in test N
never blocks tests N+1..end (proven with a temp failing-test followed by a
passing test — both ran and the process completed without aborting).

This commit lands the three harness files that were staged but absent from
HEAD (Makefile, .gitignore, test_sanity.c) so that 'make -C firmware/test
test' — the command bf-53ut's acceptance invokes — actually builds and runs
against the committed tree. Without them the committed test_runner.c could
not be built from a fresh clone.

Verified against the bf-53ut acceptance criteria:
- gcc -std=c11 -Wall -Wextra (-Werror): clean; no -Wclobbered/setjmp warnings
- normal suite: PASS, exit 0
- failing test + later passing test: both per-test lines print, process
  completes (non-fatal assertions)
- no changes to firmware/main/* or firmware/CMakeLists.txt

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-03 11:56:34 -04:00

23 lines
878 B
C

/*
* Sanity test for the Spaxel firmware host test harness.
*
* This is the minimal passing test that proves the harness wires up end to end:
* the TEST() macro self-registers via its GCC constructor, the runner drives the
* registered test, and ASSERT_EQ reports correctly.
*
* Real module tests (nvs/csi/prov logic extractions + binary-format contracts)
* are deliberately NOT here — they are added by the sibling beads that follow.
* Keeping this bead (bf-56v) to scaffolding + a single sanity test is what lets
* the "compiles + runs + exits non-zero on failure" contract be verified in
* isolation before any module behavior is exercised.
*/
#include "test_runner.h"
/*
* 1 + 1 == 2: the smallest possible assertion. If this fails, the harness itself
* is broken, not the firmware logic under test.
*/
TEST(arithmetic_sanity)
{
ASSERT_EQ(1 + 1, 2);
}