make: per-file lang/library test targets in -w workdirs
One phony target per test file so -jN parallelizes both suites, each file building in its own persistent workdir so only changed packages recompile. Tests always execute — the workdir caches builds, never results. Lang tests keep their exact historical invocation (no -I); library tests keep -I lib/ww. Warm -j4: test-library 19.0s -> 1.0s, test-lang 19.8s -> 2.0s.
This commit is contained in:
35
Makefile
35
Makefile
@@ -434,17 +434,31 @@ test-compiler: $(WWFIXTURE_BIN) $(WRAPPER_TOOLS) $(COMPILER_WRAPPER_BINS)
|
||||
echo "compiler artifact $$t"; BIN=$(CURDIR)/$(BIN) $(CURDIR)/$$t; \
|
||||
done
|
||||
|
||||
test-lang: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a
|
||||
@set -e; for f in $(wildcard test/lang/*_test.ww); do \
|
||||
echo "ww test $$f"; $(BIN)/ww test $$f; \
|
||||
done
|
||||
# One phony target per language/library test file so `make -jN`
|
||||
# parallelizes the suites, each in its own persistent -w workdir so only
|
||||
# changed packages rebuild. Tests always execute — the workdir caches
|
||||
# builds, never results.
|
||||
LANG_TEST_FILES = $(wildcard test/lang/*_test.ww)
|
||||
LANG_TEST_TARGETS = $(LANG_TEST_FILES:%=wwtest/%)
|
||||
LIBRARY_TEST_TARGETS = $(LIBRARY_TESTS:%=wwtest/%)
|
||||
|
||||
test-library: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(LIB)/libwwrt.a $(BIN)/w6c_ww $(LIBRARY_STANDALONE_SOURCES)
|
||||
@set -e; for f in $(LIBRARY_TESTS); do \
|
||||
echo "ww test $$f"; \
|
||||
$(BIN)/ww test -I $(CURDIR)/lib/ww $$f; \
|
||||
done
|
||||
$(LANG_TEST_TARGETS): wwtest/%: $(BIN)/ww \
|
||||
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a
|
||||
@echo "ww test $*"
|
||||
@mkdir -p $(WWBUILD)/wwtest/$(subst /,_,$*)
|
||||
@$(BIN)/ww test -w $(WWBUILD)/wwtest/$(subst /,_,$*) $*
|
||||
|
||||
$(LIBRARY_TEST_TARGETS): wwtest/%: $(BIN)/ww \
|
||||
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a
|
||||
@echo "ww test $*"
|
||||
@mkdir -p $(WWBUILD)/wwtest/$(subst /,_,$*)
|
||||
@$(BIN)/ww test -w $(WWBUILD)/wwtest/$(subst /,_,$*) \
|
||||
-I $(CURDIR)/lib/ww $*
|
||||
|
||||
test-lang: $(LANG_TEST_TARGETS)
|
||||
|
||||
test-library: $(LIBRARY_TEST_TARGETS) $(BIN)/w6c $(BIN)/w6c_ww \
|
||||
$(LIBRARY_STANDALONE_SOURCES)
|
||||
@set -e; for f in $(LIBRARY_STANDALONE_SOURCES); do \
|
||||
echo "library compile c $$f"; \
|
||||
$(CURDIR)/$(BIN)/w6c $(CURDIR)/$$f > /dev/null; \
|
||||
@@ -807,6 +821,7 @@ nocc:
|
||||
.PHONY: all cstage wwstage wwfixture test-wwfixture-process test-wwfixture \
|
||||
test test-unit test-compiler-smoke test-compiler test-package \
|
||||
test-lang test-library test-commit test-lang-byteid \
|
||||
$(LANG_TEST_TARGETS) $(LIBRARY_TEST_TARGETS) \
|
||||
test-data-byteid test-native-byteid test-byteid \
|
||||
test-bootstrap-native test-bootstrap test-incremental \
|
||||
test-platform test-all install clean bootstrap nocc bootstrap-snapshot
|
||||
|
||||
Reference in New Issue
Block a user