diff --git a/Makefile b/Makefile index a320cac6..66b3b131 100644 --- a/Makefile +++ b/Makefile @@ -482,35 +482,12 @@ wwtest/test/tool/ffivariadic_test.ww: $(OUT)/ffivariadic/libffifix.a # Native library tests execute their source owner directly. The retired C # launchers added no assertion beyond this exit status. -LIBRARY_TESTS = lib/errors/errno_test.ww lib/ascii/ascii_test.ww \ - lib/ww/syntax/tok_test.ww lib/ww/syntax/ast_test.ww \ - lib/ww/syntax/sym_test.ww \ - lib/strconv/test/ftos_test.ww lib/strconv/test/stof_test.ww \ - lib/strconv/test/int_test.ww lib/strings/strings_test.ww \ - lib/strings/suffix_test.ww lib/strings/contains_test.ww \ - lib/strings/index_test.ww lib/strings/compare_test.ww \ - lib/bytes/equal_test.ww lib/bytes/index_test.ww \ - lib/bytes/contains_test.ww lib/bytes/tokenize_test.ww \ - lib/bytes/trim_test.ww lib/encoding/utf8/rune_test.ww \ - lib/encoding/utf8/encode_test.ww lib/encoding/utf8/decode_test.ww \ - lib/encoding/utf8/types_test.ww \ - lib/bufio/stream_test.ww lib/bufio/scanner_test.ww \ - lib/math/random/random_test.ww \ - lib/math/checked/checked_test.ww lib/fmt/fmt_test.ww \ - lib/log/funcs_test.ww lib/log/global_test.ww \ - lib/log/silent_test.ww lib/fnmatch/fnmatch_test.ww \ - lib/shlex/shlex_test.ww lib/time/arithm_test.ww \ - lib/time/duration_test.ww lib/time/instant_test.ww \ - lib/encoding/hex/hex_test.ww lib/memio/memio_test.ww \ - lib/temp/temp_test.ww lib/getopt/getopt_test.ww \ - lib/encoding/base32/base32_test.ww \ - lib/encoding/base64/base64_test.ww \ - lib/hash/adler32/adler32_test.ww lib/hash/crc16/crc16_test.ww \ - lib/hash/crc32/crc32_test.ww lib/hash/crc64/crc64_test.ww \ - lib/path/buffer_test.ww lib/path/posix_test.ww \ - lib/path/stack_test.ww lib/crypto/sha256/sha256_test.ww \ - lib/hash/siphash/siphash_test.ww \ - lib/os/os_test.ww lib/os/stat_test.ww lib/dirs/dirs_test.ww +# Library behavior has ONE owner: the package coordinator's lib/... +# tree walk in test-library (Go's `go test ./...` — the PACKAGE, not +# the file, is the unit of testing; same-package *_test.ww compose +# into one unit). No per-file registration exists: a new lib +# *_test.ww is discovered by the walk, and the libbyteid completeness +# scan still fails loudly on any unenrolled lib/ dir. # These real sources have a standalone-compilation contract that is not # subsumed by a library @test import owner. @@ -541,13 +518,12 @@ test-compiler: $(WWFIXTURE_BIN) $(WRAPPER_TOOLS) $(COMPILER_WRAPPER_BINS) \ echo "compiler artifact $$t"; BIN=$(CURDIR)/$(BIN) $(CURDIR)/$$t; \ 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. +# One phony target per language test file so `make -jN` parallelizes +# the suite, 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/%) $(LANG_TEST_TARGETS): wwtest/%: $(BIN)/ww \ $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a @@ -555,13 +531,6 @@ $(LANG_TEST_TARGETS): wwtest/%: $(BIN)/ww \ @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 $* - $(BYTEID_WW_TARGETS): wwtest/%: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a \ $(BIN)/w6l $(BIN)/wwdump $(LIB)/libwwrt.a \ $(BIN)/ww_ww $(BIN)/w6c_ww @@ -640,16 +609,19 @@ $(TOOL_WW_TARGETS): wwtest/%: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \ test-lang: $(LANG_TEST_TARGETS) -test-library: $(LIBRARY_TEST_TARGETS) $(BIN)/w6c $(BIN)/w6c_ww \ - $(WWTEST_BIN) $(LIBRARY_STANDALONE_SOURCES) +test-library: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \ + $(LIB)/libwwrt.a $(BIN)/w6c_ww $(WWTEST_BIN) \ + $(LIBRARY_STANDALONE_SOURCES) @set -e; for f in $(LIBRARY_STANDALONE_SOURCES); do \ echo "library compile c $$f"; \ $(CURDIR)/$(BIN)/w6c $(CURDIR)/$$f > /dev/null; \ echo "library compile ww $$f"; \ $(CURDIR)/$(BIN)/w6c_ww $(CURDIR)/$$f > /dev/null; \ done - @echo "ww test lib/regex" - @$(CURDIR)/$(BIN)/ww test lib/regex + @echo "ww test -j $(JOBS) lib/..." + @mkdir -p $(WWBUILD)/wwtest-lib + @$(CURDIR)/$(BIN)/ww test -j $(JOBS) -w $(WWBUILD)/wwtest-lib \ + -I $(CURDIR)/lib/ww lib/... test-bootstrap-native: $(WRAPPER_TOOLS) $(BOOTSTRAP_WRAPPER_BINS) @set -e; for t in $(BOOTSTRAP_WRAPPER_BINS); do \ @@ -1000,7 +972,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) $(BYTEID_WW_TARGETS) \ + $(LANG_TEST_TARGETS) $(BYTEID_WW_TARGETS) \ $(SEP_WW_TARGETS) test-data-byteid test-byteid \ test-bootstrap-native test-bootstrap test-incremental \ test-platform test-all install clean bootstrap nocc bootstrap-snapshot diff --git a/cmd/ww/main.c b/cmd/ww/main.c index 45ce516e..1ffc7021 100644 --- a/cmd/ww/main.c +++ b/cmd/ww/main.c @@ -1708,16 +1708,13 @@ do_test(int argc, char **argv) "ww test: -o needs -c for a package target\n"); return 2; } - if (workdir[0]) { - fprintf(stderr, - "ww test: -w needs a single test file\n"); - return 2; - } if (pattern) { fprintf(stderr, "ww test: pattern needs a single test file\n"); return 2; } + /* -w forwards: the coordinator keys one persistent driver + * workdir per package group under the given root. */ return exec_package_tests(argc, argv, src, NULL, 0); } struct stat st; @@ -1742,11 +1739,6 @@ do_test(int argc, char **argv) "ww test: -o needs -c for a package target\n"); return 2; } - if (workdir[0]) { - fprintf(stderr, - "ww test: -w needs a single test file\n"); - return 2; - } if (pattern) { fprintf(stderr, "ww test: pattern needs a single test file\n"); @@ -1882,10 +1874,6 @@ do_test(int argc, char **argv) fprintf(stderr, "ww test: -o needs -c for a package target\n"); return 2; } - if (workdir[0]) { - fprintf(stderr, "ww test: -w needs a single test file\n"); - return 2; - } /* The second bare positional remains the legacy single-file filter form; * package filtering uses explicit -run/-filter options. */ if (pattern) { diff --git a/docs/test-system-v2.md b/docs/test-system-v2.md index 7cc18bfe..421aac74 100644 --- a/docs/test-system-v2.md +++ b/docs/test-system-v2.md @@ -26,7 +26,7 @@ categories out of the ordinary developer target. | Compile success/rejection, stage-routed diagnostics, and runtime exit | `test/wcc/data/*/case.ww`, executed by `wwfixture` | | Package semantics | `test/package` and the native package-test coordinator | | Language behavior | `test/lang/*_test.ww` through the language `@test` runtime | -| Library behavior | Library-owned `@test` sources named by `LIBRARY_TESTS` | +| Library behavior | The package coordinator's `lib/...` tree walk (`ww test -j N -I lib/ww lib/...`) | | Standalone library-source compilation | Four real source paths named by `LIBRARY_STANDALONE_SOURCES`, compiled directly by both frontends | | Compiler-output identity | `test-lang-byteid` and `test-data-byteid` plus residual byte/artifact carriers | | Fixed point and self-host | `test-bootstrap` | @@ -101,7 +101,7 @@ outright; git history is the archive. | `test-compiler` | Complete fixture corpus plus residual compiler/integration carriers | | `test-package` | Package planning, grouping, routing, and package runtime only | | `test-lang` | Language-owned `@test` behavior | -| `test-library` | Library-owned `@test` behavior plus four direct standalone-source C/WW compilation checks | +| `test-library` | The coordinator's `lib/...` walk plus four direct standalone-source C/WW compilation checks | | `test-commit` | Unit + compiler + package + language + library behavior | | `test-byteid` | Compiler-output identity gates | | `test-bootstrap` | Fixed-point bootstrap plus the 950/991–995 native gates | @@ -246,6 +246,16 @@ This is build staleness in the Make/mk/Go sense, not a result cache: tests always run, and the byte-identity and bootstrap gates keep building on fresh scratch. `make clean` reclaims every workdir under `out/`. +On a package or tree target, `ww test -w DIR` forwards to the coordinator, +which keys one persistent driver workdir per package group under `DIR` +(`