fix(build): bare 'make test/<bin>' errors instead of linking a broken dylib

The per-binary test rules only exist in the Makefile's TEST_EXPORTS=1
branch.  A bare 'make test/test_cd_hle_boot' fell through to GNU make's
built-in %:%.c rule, which links with the core's -dynamiclib LDFLAGS
and produces an unexecutable shared library.  cd_boot_matrix.sh built
its harnesses exactly that way, so every row of a fresh matrix
regeneration came back '?' with "cannot execute binary file" in the
per-run logs.

Add a loud pattern-rule guard in the non-TEST_EXPORTS branch, and make
cd_boot_matrix.sh build with TEST_EXPORTS=1 and re-link when an
existing file isn't a real executable.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Joseph MattielloandClaude Fable 5 committed 2026-07-16 18:42:30 -04:00
1 parent b63fb7d903
commit ca82c5b03d
2 files changed
+19 -2

No files matched your search

+11
View File
@@ -760,6 +760,17 @@ else ifneq ($(TEST_EXPORTS),1)
test:
@rm -f $(TARGET)
@$(MAKE) TEST_EXPORTS=1 test
# The per-binary rules below only exist in the TEST_EXPORTS=1 branch.
# Without this guard, a bare `make test/<binary>` silently falls through
# to GNU make's built-in %:%.c rule, which links with the core's
# -dynamiclib LDFLAGS and produces an UNEXECUTABLE shared library
# ("cannot execute binary file" at run time -- this broke
# cd_boot_matrix.sh's harness build). Fail loudly instead.
test/test_% test/tools/test_%:
@echo "ERROR: test binaries need the TEST_EXPORTS=1 rule set:" >&2
@echo " make TEST_EXPORTS=1 $@" >&2
@false
else
# Every harness that dlopens the core verifies the binary's embedded git
# rev (+ -dirty) against this before running -- a stale dylib fails loudly
+8 -2
View File
@@ -119,10 +119,16 @@ if [ -n "$VJ_EXPECT_BUILD" ]; then
fi
fi
# TEST_EXPORTS=1 is required: the per-binary rules only exist in that
# Makefile branch. A bare `make test/<bin>` falls through to GNU make's
# built-in %:%.c rule, which links with the core's -dynamiclib LDFLAGS
# and produces an unexecutable shared library (every matrix row then
# reads "cannot execute binary file" -> all '?').
for bin in test/test_cd_hle_boot test/test_cd_bios_boot; do
if [ ! -x "$bin" ]; then
if [ ! -x "$bin" ] || ! file "$bin" 2>/dev/null | grep -q executable; then
echo "Building $bin..." >&2
make "$bin" || { echo "FATAL: failed to build $bin" >&2; exit 1; }
rm -f "$bin"
make TEST_EXPORTS=1 "$bin" || { echo "FATAL: failed to build $bin" >&2; exit 1; }
fi
done