Skip to content

Commit 0791603

Browse files
dkegel-fastlydeadprogram
authored andcommitted
Makefile: add report-stdlib-tests-pass
1 parent 095312f commit 0791603

File tree

1 file changed

+39
-22
lines changed

1 file changed

+39
-22
lines changed

Makefile

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,15 @@ tinygo:
213213
test: wasi-libc
214214
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=20m -buildmode exe -tags byollvm ./builder ./cgo ./compileopts ./compiler ./interp ./transform .
215215

216-
# Tests that take over a minute in wasi
216+
# Standard library packages that pass tests on darwin, linux, wasi, and windows, but take over a minute in wasi
217217
TEST_PACKAGES_SLOW = \
218218
compress/bzip2 \
219219
compress/flate \
220220
crypto/dsa \
221221
index/suffixarray \
222222

223-
TEST_PACKAGES_BASE = \
223+
# Standard library packages that pass tests quickly on darwin, linux, wasi, and windows
224+
TEST_PACKAGES_FAST = \
224225
compress/lzw \
225226
compress/zlib \
226227
container/heap \
@@ -264,47 +265,63 @@ TEST_PACKAGES_BASE = \
264265
unicode/utf16 \
265266
unicode/utf8 \
266267

267-
# Standard library packages that pass tests natively
268-
TEST_PACKAGES := \
269-
$(TEST_PACKAGES_BASE)
270-
271-
# archive/zip requires ReadAt, which is not yet supported on windows
268+
# archive/zip requires os.ReadAt, which is not yet supported on windows
272269
# debug/plan9obj requires os.ReadAt, which is not yet supported on windows
273270
# io/fs requires os.ReadDir, which is not yet supported on windows or wasi
274271
# testing/fstest requires os.ReadDir, which is not yet supported on windows or wasi
275-
ifneq ($(OS),Windows_NT)
276-
TEST_PACKAGES := \
277-
$(TEST_PACKAGES) \
272+
273+
# Additional standard library packages that pass tests on individual platforms
274+
TEST_PACKAGES_LINUX := \
278275
archive/zip \
279276
debug/dwarf \
280277
debug/plan9obj \
281278
io/fs \
282279
testing/fstest
283-
endif
284280

285-
# Standard library packages that pass tests on wasi
286-
TEST_PACKAGES_WASI = \
287-
$(TEST_PACKAGES_BASE)
281+
TEST_PACKAGES_DARWIN := $(TEST_PACKAGES_LINUX)
282+
283+
# Report platforms on which each standard library package is known to pass tests
284+
jointmp := $(shell echo /tmp/join.$$$$)
285+
report-stdlib-tests-pass:
286+
@for t in $(TEST_PACKAGES_DARWIN); do echo "$$t darwin"; done | sort > $(jointmp).darwin
287+
@for t in $(TEST_PACKAGES_LINUX); do echo "$$t linux"; done | sort > $(jointmp).linux
288+
@for t in $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW); do echo "$$t darwin linux wasi windows"; done | sort > $(jointmp).portable
289+
@join -a1 -a2 $(jointmp).darwin $(jointmp).linux | \
290+
join -a1 -a2 - $(jointmp).portable
291+
@rm $(jointmp).*
292+
293+
# Standard library packages that pass tests quickly on the current platform
294+
ifeq ($(shell uname),Darwin)
295+
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_DARWIN)
296+
endif
297+
ifeq ($(shell uname),Linux)
298+
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_LINUX)
299+
endif
300+
ifeq ($(OS),Windows_NT)
301+
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST)
302+
endif
288303

289304
# Test known-working standard library packages.
290305
# TODO: parallelize, and only show failing tests (no implied -v flag).
291306
.PHONY: tinygo-test
292307
tinygo-test:
293-
$(TINYGO) test $(TEST_PACKAGES) $(TEST_PACKAGES_SLOW)
308+
$(TINYGO) test $(TEST_PACKAGES_HOST) $(TEST_PACKAGES_SLOW)
294309
tinygo-test-fast:
295-
$(TINYGO) test $(TEST_PACKAGES)
310+
$(TINYGO) test $(TEST_PACKAGES_HOST)
296311
tinygo-bench:
297-
$(TINYGO) test -bench . $(TEST_PACKAGES) $(TEST_PACKAGES_SLOW)
312+
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST) $(TEST_PACKAGES_SLOW)
298313
tinygo-bench-fast:
299-
$(TINYGO) test -bench . $(TEST_PACKAGES)
314+
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST)
315+
316+
# Same thing, except for wasi rather than the current platform.
300317
tinygo-test-wasi:
301-
$(TINYGO) test -target wasi $(TEST_PACKAGES_WASI) $(TEST_PACKAGES_SLOW)
318+
$(TINYGO) test -target wasi $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW)
302319
tinygo-test-wasi-fast:
303-
$(TINYGO) test -target wasi $(TEST_PACKAGES_WASI)
320+
$(TINYGO) test -target wasi $(TEST_PACKAGES_FAST)
304321
tinygo-bench-wasi:
305-
$(TINYGO) test -target wasi -bench . $(TEST_PACKAGES_WASI) $(TEST_PACKAGES_SLOW)
322+
$(TINYGO) test -target wasi -bench . $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW)
306323
tinygo-bench-wasi-fast:
307-
$(TINYGO) test -target wasi -bench . $(TEST_PACKAGES_WASI)
324+
$(TINYGO) test -target wasi -bench . $(TEST_PACKAGES_FAST)
308325

309326
# Test external packages in a large corpus.
310327
test-corpus:

0 commit comments

Comments
 (0)