Commit 5e21d42a
5e21d42ac90fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~1 modified · -1 deleted
Description
Revert "build: bundled-test mechanism (Step 1, 15-test sample)"
This reverts commit b676017cc7b6b21254aba8ddd57a0ca901b7d279.
Details
- Commit
- 5e21d42ac90f
- Parent
- fea5369dddb0
MakefilemodifiedView file
@@ -193,18 +193,8 @@
193193
194194
# ---- Test ----195195
196-
# Bundles: groups of small collision-free tests compiled and run as a197-
# single binary to amortize cc/link/spawn cost (the per-test cc -c on198-
# sp_runtime.h dominates wall time, ~88% of per-test cost; bundling 15199-
# tests turns 15× that fixed cost into 1×). See test/bundles/*.bundle200-
# for the lists and the constraints. Tests listed in any bundle are201-
# excluded from individual runs so we don't double-execute them.202-
BUNDLE_FILES := $(wildcard test/bundles/*.bundle)203-
BUNDLED_TESTS := $(shell cat $(BUNDLE_FILES) 2>/dev/null | sed -e 's/\#.*//' -e 's/[[:space:]]*$$//' -e '/^$$/d')204-
BUNDLE_TARGETS := $(patsubst test/bundles/%.bundle,build/test-results/bundle__%.ok,$(BUNDLE_FILES))205-
206-
TESTS := $(filter-out $(BUNDLED_TESTS),$(wildcard test/*.rb))207-
TEST_TARGETS := $(patsubst test/%.rb,build/test-results/%.ok,$(TESTS)) $(BUNDLE_TARGETS)196+
TESTS := $(wildcard test/*.rb)197+
TEST_TARGETS := $(patsubst test/%.rb,build/test-results/%.ok,$(TESTS))208198
209199
test: clean-test-results210200
@$(MAKE) --no-print-directory test-run@@ -254,54 +244,6 @@
254244
fi; \255245
$(TIMEOUT10) "$$bin" >"$$act" 2>/dev/null; \256246
LC_ALL=C sed 's/\r$$//' "$$act" >"$$act.n"; \257-
if cmp -s "$$exp.n" "$$act.n"; then \258-
echo PASS > "$@"; \259-
if [ -t 1 ]; then printf .; fi; \260-
else \261-
echo FAIL > "$@"; \262-
diff -u "$$exp.n" "$$act.n" > "[email protected]" 2>&1 || true; \263-
if [ -t 1 ]; then printf F; fi; \264-
fi; \265-
else \266-
echo ERR > "$@"; \267-
if [ -t 1 ]; then printf E; fi; \268-
fi; \269-
rm -rf "$$tmpdir"270-
271-
# Bundle test rule. Concatenates the listed tests into one .rb (each272-
# wrapped in `def _t_<name>; ... end; _t_<name>` for local-var scope273-
# isolation and a `puts "@@@ <name>"` separator), then compiles + runs274-
# the combined .rb once. Output is split by the markers and diffed275-
# against the concatenation of each test's .expected. The original276-
# per-test .rb files stay in test/ for individual debugging — bundling277-
# is purely a CI / wall-time optimization.278-
build/test-results/bundle__%.ok: test/bundles/%.bundle spinel_parse$(EXE) $(SP_RT_LIB) spinel_codegen$(EXE)279-
@mkdir -p build/test-results280-
@tmpdir=$$(mktemp -d /tmp/spinel-bundle.XXXXXX); \281-
rb=$$tmpdir/bundle.rb; \282-
exp=$$tmpdir/bundle.expected; \283-
ast=$$tmpdir/bundle.ast; \284-
cfile=$$tmpdir/bundle.c; \285-
bin=$$tmpdir/bundle$(EXE); \286-
act=$$tmpdir/actual; \287-
rm -f "[email protected]"; \288-
: > "$$rb"; : > "$$exp"; \289-
sed -e 's/#.*//' -e 's/[[:space:]]*$$//' -e '/^$$/d' "$<" | while IFS= read -r tf; do \290-
name=$$(basename "$$tf" .rb | sed 's/[^a-zA-Z0-9]/_/g'); \291-
printf 'def _t_%s\n' "$$name" >> "$$rb"; \292-
cat "$$tf" >> "$$rb"; \293-
printf '\nend\nputs "@@@ %s"\n_t_%s\n\n' "$$name" "$$name" >> "$$rb"; \294-
printf '@@@ %s\n' "$$name" >> "$$exp"; \295-
cat "$$tf.expected" >> "$$exp"; \296-
done; \297-
./spinel_parse$(EXE) "$$rb" "$$ast" 2>/dev/null && \298-
./spinel_codegen$(EXE) "$$ast" "$$cfile" 2>/dev/null && \299-
$(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib -c "$$cfile" -o "$$cfile.o" 2>/dev/null && \300-
$(CC) $(CFLAGS) "$$cfile.o" $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o "$$bin" 2>/dev/null; \301-
if [ $$? -eq 0 ]; then \302-
$(TIMEOUT60) "$$bin" >"$$act" 2>/dev/null; \303-
LC_ALL=C sed 's/\r$$//' "$$act" >"$$act.n"; \304-
LC_ALL=C sed 's/\r$$//' "$$exp" >"$$exp.n"; \305247
if cmp -s "$$exp.n" "$$act.n"; then \306248
echo PASS > "$@"; \307249
if [ -t 1 ]; then printf .; fi; \test/bundles/array_small.bundledeleted
Loading diff…