kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit e5ae84b06a498b7da427ad94d04cf816ac1a6f63
parent b8f536ed61f21edb813cdb1fbc20e6ff7c435cfa
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Mon,  1 Jun 2026 17:44:00 -0700

test: fix asm corpus all-n/a and make test-asm a multi-arch aggregate

The shared corpus engine documented CF_TARGETS_EXT="" as disabling the
whole-case tuple matcher, but defaulted it with the colon form
${CF_TARGETS_EXT:=.targets}, which clobbers a caller's explicit empty
back to .targets. The asm harness is the lone victim: it ships .targets
sidecars with bare arch tokens and uses a synthetic aa64-asm tuple,
delegating real applicability to its own cf_read_case. The re-enabled
engine matcher then compared aa64-asm against the token aa64, never
matched, and marked every case SKIP-NA -- test-asm reported 0/0/0/81 and
exited green. Switch to the no-colon form so an explicit empty is honored
(test-asm now 27/0/51/57 on aa64).

Make test-asm an aggregate over per-arch lanes test-asm-aa64/-x64/-rv64
so make test covers all three archs through one target, and drop the now
-redundant -x64/-rv64 entries from DEFAULT_TEST_TARGETS. Arch-qualify the
cached start.o path so the lanes are safe to run in parallel under -j.

Diffstat:
Mtest/asm/run.sh | 5+++--
Mtest/lib/cf_corpus.sh | 5++++-
Mtest/test.mk | 41++++++++++++++++++++++++-----------------
3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/test/asm/run.sh b/test/asm/run.sh @@ -172,8 +172,9 @@ if [ $is_native_target -eq 1 ]; then fi # Cached start.o — same trick as parse/cg harnesses; build once for the -# whole run. -START_OBJ="$BUILD_DIR/asm_start.o" +# whole run. Arch-qualified so concurrent per-arch lanes (the test-asm aggregate +# under `make -j`) don't race on one path with arch-specific content. +START_OBJ="$BUILD_DIR/asm_start.$TEST_ARCH.o" have_start_obj=0 if [ $have_clang_cross -eq 1 ]; then if clang $CLANG_TARGET -O1 -ffreestanding -fno-stack-protector \ diff --git a/test/lib/cf_corpus.sh b/test/lib/cf_corpus.sh @@ -225,7 +225,10 @@ cf_corpus_run() { : "${CF_OPT0ONLY:=}" : "${CF_PARALLELIZABLE:=1}" : "${CF_EXPECTED_EXT:=.expected}" - : "${CF_TARGETS_EXT:=.targets}" + # No-colon `=`: only default when UNSET. A caller-supplied empty value means + # "disable the whole-case tuple matcher" (see CONTRACT above) — the colon form + # `:=` would wrongly clobber that empty back to .targets and re-enable it. + : "${CF_TARGETS_EXT=.targets}" if [ -z "${CF_SIDECAR_DIR:-}" ]; then set -- $CF_CORPUS_GLOBS; CF_SIDECAR_DIR=$(dirname "$1") fi diff --git a/test/test.mk b/test/test.mk @@ -24,11 +24,12 @@ # - test-parse-ok: file-driven C parser success harness in test/parse/; each # case is a .c source file. Built against the public cfree.h surface; # reuses cfree-roundtrip, link-exe-runner, and jit-runner. -# - test-asm: file-driven assembler/disassembler harness in test/asm/. -# Three sub-corpora (encode/, decode/, listing/), one mode per -# sub-dir. Phase 1: every smoke case carries a .skip sidecar because -# asm_parse / cfree_disasm_iter_* are still stubs; the harness builds -# and runs end-to-end so the wiring stays exercised. See doc/ASM.md. +# - test-asm: aggregate alias over the per-arch asm lanes test-asm-aa64, +# test-asm-x64 and test-asm-rv64. The file-driven assembler/disassembler +# harness in test/asm/ runs one arch per invocation (CFREE_TEST_ARCH) over +# three sub-corpora (encode/, decode/, listing/), one mode per sub-dir. +# aa64 runs the full path set (incl. native exec on aa64 hosts); x64/rv64 +# run the host-independent encode/decode/listing lanes only. See doc/ASM.md. TEST_TARGETS = \ test-cf-corpus-selftest \ @@ -36,6 +37,7 @@ TEST_TARGETS = \ test-abi-classify \ test-ar \ test-asm \ + test-asm-aa64 \ test-asm-x64 \ test-asm-rv64 \ test-disasm-complete \ @@ -120,8 +122,6 @@ DEFAULT_TEST_TARGETS = \ test-debug \ test-parse \ test-asm \ - test-asm-x64 \ - test-asm-rv64 \ test-asm-roundtrip \ test-isa \ test-aa64-inline \ @@ -664,16 +664,23 @@ test-parse-ok: lib $(TEST_RT_DEP) $(PARSE_RUNNER) $(ROUNDTRIP_BIN) $(LINK_EXE_RU test-parse-err: lib $(PARSE_RUNNER) sh test/parse/run_errors.sh -# test-asm: the Makefile owns harness binaries so they inherit host flags -# consistently with the rest of the test suite. -test-asm: lib $(TEST_RT_DEP) $(ASM_RUNNER) $(LINK_EXE_RUNNER) $(JIT_RUNNER) - bash test/asm/run.sh - -# The asm harness runs one arch per invocation (CFREE_TEST_ARCH, default aa64), -# so x64/rv64 encode (H), decode (T) and listing (L) corpora otherwise never -# run under `make test`. These lanes exercise them on any host: H/T/L need no -# native execution (they only produce/compare bytes), so the exec paths -# (D/E/J) are deliberately excluded and left to the smoke/qemu targets. +# test-asm: aggregate alias running every per-arch asm lane (aa64 + x64 + rv64) +# so `make test` covers all three through one target. The harness runs one arch +# per invocation (CFREE_TEST_ARCH); each lane scopes its scratch per arch, so +# the prerequisites are safe to run in parallel under `make -j`. +test-asm: test-asm-aa64 test-asm-x64 test-asm-rv64 + +# test-asm-aa64: the reference lane. aa64 is the default cross-target, and on +# aa64 hosts the exec paths (D/E/J) run natively, so it uses the full default +# path set (HTLDJE). The Makefile owns the harness binaries so they inherit host +# flags consistently with the rest of the test suite. +test-asm-aa64: lib $(TEST_RT_DEP) $(ASM_RUNNER) $(LINK_EXE_RUNNER) $(JIT_RUNNER) + @CFREE_TEST_ARCH=aa64 bash test/asm/run.sh + +# x64/rv64 exercise the encode (H), decode (T) and listing (L) corpora on any +# host: H/T/L need no native execution (they only produce/compare bytes), so the +# exec paths (D/E/J) are deliberately excluded and left to the smoke/qemu +# targets. test-asm-x64: lib $(ASM_RUNNER) @CFREE_TEST_ARCH=x64 CFREE_TEST_PATHS=HTL bash test/asm/run.sh test-asm-rv64: lib $(ASM_RUNNER)