@@ -407,8 +407,45 @@ TEST_PACKAGES_WINDOWS := \
407407 text/template/parse \
408408 $(nil )
409409
410- TEST_PACKAGES_WASM := \
411- crypto/sha256
410+
411+ # These packages cannot be tested on wasm, mostly because these tests assume a
412+ # working filesystem. This could perhaps be fixed, by supporting filesystem
413+ # access when running inside Node.js.
414+ TEST_PACKAGES_WASM = $(filter-out $(TEST_PACKAGES_NONWASM ) , $(TEST_PACKAGES_FAST ) )
415+ TEST_PACKAGES_NONWASM = \
416+ compress/lzw \
417+ compress/zlib \
418+ crypto/ecdsa \
419+ debug/macho \
420+ embed/internal/embedtest \
421+ go/format \
422+ os \
423+ testing \
424+ $(nil )
425+
426+ # These packages cannot be tested on baremetal.
427+ #
428+ # Some reasons why the tests don't pass on baremetal:
429+ #
430+ # * No filesystem is available, so packages like compress/zlib can't be tested
431+ # (just like wasm).
432+ # * There is no RNG implemented (TODO, I think this is fixable).
433+ # * picolibc math functions apparently are less precise, the math package
434+ # fails on baremetal.
435+ # * Some packages fail or hang for an unknown reason, this should be
436+ # investigated and fixed.
437+ TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL ) , $(TEST_PACKAGES_FAST ) )
438+ TEST_PACKAGES_NONBAREMETAL = \
439+ $(TEST_PACKAGES_NONWASM ) \
440+ crypto/elliptic \
441+ crypto/md5 \
442+ crypto/sha1 \
443+ math \
444+ reflect \
445+ encoding/asn1 \
446+ encoding/base32 \
447+ go/ast \
448+ $(nil )
412449
413450# Report platforms on which each standard library package is known to pass tests
414451jointmp := $(shell echo /tmp/join.$$$$)
@@ -489,6 +526,10 @@ tinygo-bench-wasip2:
489526tinygo-bench-wasip2-fast :
490527 $(TINYGO ) test -target wasip2 -bench . $(TEST_PACKAGES_FAST )
491528
529+ # Run tests on riscv-qemu since that one provides a large amount of memory.
530+ tinygo-test-baremetal :
531+ $(TINYGO ) test -target riscv-qemu $(TEST_PACKAGES_BAREMETAL )
532+
492533# Test external packages in a large corpus.
493534test-corpus :
494535 CGO_CPPFLAGS=" $( CGO_CPPFLAGS) " CGO_CXXFLAGS=" $( CGO_CXXFLAGS) " CGO_LDFLAGS=" $( CGO_LDFLAGS) " $(GO ) test $(GOTESTFLAGS ) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml
@@ -499,11 +540,6 @@ test-corpus-wasi: wasi-libc
499540test-corpus-wasip2 : wasi-libc
500541 CGO_CPPFLAGS=" $( CGO_CPPFLAGS) " CGO_CXXFLAGS=" $( CGO_CXXFLAGS) " CGO_LDFLAGS=" $( CGO_LDFLAGS) " $(GO ) test $(GOTESTFLAGS ) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip2
501542
502- tinygo-baremetal :
503- # Regression tests that run on a baremetal target and don't fit in either main_test.go or smoketest.
504- # regression test for #2666: e.g. encoding/hex must pass on baremetal
505- $(TINYGO ) test -target cortex-m-qemu encoding/hex
506-
507543.PHONY : testchdir
508544testchdir :
509545 # test 'build' command with{,out} -C argument
0 commit comments