@@ -213,14 +213,15 @@ tinygo:
213
213
test : wasi-libc
214
214
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 .
215
215
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
217
217
TEST_PACKAGES_SLOW = \
218
218
compress/bzip2 \
219
219
compress/flate \
220
220
crypto/dsa \
221
221
index/suffixarray \
222
222
223
- TEST_PACKAGES_BASE = \
223
+ # Standard library packages that pass tests quickly on darwin, linux, wasi, and windows
224
+ TEST_PACKAGES_FAST = \
224
225
compress/lzw \
225
226
compress/zlib \
226
227
container/heap \
@@ -264,47 +265,63 @@ TEST_PACKAGES_BASE = \
264
265
unicode/utf16 \
265
266
unicode/utf8 \
266
267
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
272
269
# debug/plan9obj requires os.ReadAt, which is not yet supported on windows
273
270
# io/fs requires os.ReadDir, which is not yet supported on windows or wasi
274
271
# 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 := \
278
275
archive/zip \
279
276
debug/dwarf \
280
277
debug/plan9obj \
281
278
io/fs \
282
279
testing/fstest
283
- endif
284
280
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
288
303
289
304
# Test known-working standard library packages.
290
305
# TODO: parallelize, and only show failing tests (no implied -v flag).
291
306
.PHONY : tinygo-test
292
307
tinygo-test :
293
- $(TINYGO ) test $(TEST_PACKAGES ) $(TEST_PACKAGES_SLOW )
308
+ $(TINYGO ) test $(TEST_PACKAGES_HOST ) $(TEST_PACKAGES_SLOW )
294
309
tinygo-test-fast :
295
- $(TINYGO ) test $(TEST_PACKAGES )
310
+ $(TINYGO ) test $(TEST_PACKAGES_HOST )
296
311
tinygo-bench :
297
- $(TINYGO ) test -bench . $(TEST_PACKAGES ) $(TEST_PACKAGES_SLOW )
312
+ $(TINYGO ) test -bench . $(TEST_PACKAGES_HOST ) $(TEST_PACKAGES_SLOW )
298
313
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.
300
317
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 )
302
319
tinygo-test-wasi-fast :
303
- $(TINYGO ) test -target wasi $(TEST_PACKAGES_WASI )
320
+ $(TINYGO ) test -target wasi $(TEST_PACKAGES_FAST )
304
321
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 )
306
323
tinygo-bench-wasi-fast :
307
- $(TINYGO ) test -target wasi -bench . $(TEST_PACKAGES_WASI )
324
+ $(TINYGO ) test -target wasi -bench . $(TEST_PACKAGES_FAST )
308
325
309
326
# Test external packages in a large corpus.
310
327
test-corpus :
0 commit comments