ci: add more tests for wasm and baremetal

Run a range of tests in CI, to make sure browser wasm and baremetal
don't regress too badly.

I have intentionally filtered out tests, so that newly added tests to
TEST_PACKAGES_FAST will be added here as well (and can be excluded if
needed).
This commit is contained in:
Ayke van Laethem
2025-03-07 11:40:37 +01:00
committed by Ayke
parent 226744a538
commit ebf70ab18e
3 changed files with 49 additions and 13 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ jobs:
run: make tinygo-test
- run: make smoketest
- run: make wasmtest
- run: make tinygo-baremetal
- run: make tinygo-test-baremetal
build-linux-cross:
# Build ARM Linux binaries, ready for release.
# This intentionally uses an older Linux image, so that we compile against
+43 -7
View File
@@ -407,8 +407,45 @@ TEST_PACKAGES_WINDOWS := \
text/template/parse \
$(nil)
TEST_PACKAGES_WASM := \
crypto/sha256
# These packages cannot be tested on wasm, mostly because these tests assume a
# working filesystem. This could perhaps be fixed, by supporting filesystem
# access when running inside Node.js.
TEST_PACKAGES_WASM = $(filter-out $(TEST_PACKAGES_NONWASM), $(TEST_PACKAGES_FAST))
TEST_PACKAGES_NONWASM = \
compress/lzw \
compress/zlib \
crypto/ecdsa \
debug/macho \
embed/internal/embedtest \
go/format \
os \
testing \
$(nil)
# These packages cannot be tested on baremetal.
#
# Some reasons why the tests don't pass on baremetal:
#
# * No filesystem is available, so packages like compress/zlib can't be tested
# (just like wasm).
# * There is no RNG implemented (TODO, I think this is fixable).
# * picolibc math functions apparently are less precise, the math package
# fails on baremetal.
# * Some packages fail or hang for an unknown reason, this should be
# investigated and fixed.
TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL), $(TEST_PACKAGES_FAST))
TEST_PACKAGES_NONBAREMETAL = \
$(TEST_PACKAGES_NONWASM) \
crypto/elliptic \
crypto/md5 \
crypto/sha1 \
math \
reflect \
encoding/asn1 \
encoding/base32 \
go/ast \
$(nil)
# Report platforms on which each standard library package is known to pass tests
jointmp := $(shell echo /tmp/join.$$$$)
@@ -489,6 +526,10 @@ tinygo-bench-wasip2:
tinygo-bench-wasip2-fast:
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_FAST)
# Run tests on riscv-qemu since that one provides a large amount of memory.
tinygo-test-baremetal:
$(TINYGO) test -target riscv-qemu $(TEST_PACKAGES_BAREMETAL)
# Test external packages in a large corpus.
test-corpus:
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
test-corpus-wasip2: wasi-libc
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
tinygo-baremetal:
# Regression tests that run on a baremetal target and don't fit in either main_test.go or smoketest.
# regression test for #2666: e.g. encoding/hex must pass on baremetal
$(TINYGO) test -target cortex-m-qemu encoding/hex
.PHONY: testchdir
testchdir:
# test 'build' command with{,out} -C argument
+5 -5
View File
@@ -1,16 +1,16 @@
/* Memory map:
* https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
* RAM and flash are set to 1MB each. That should be enough for the foreseeable
* future. QEMU does not seem to limit the flash/RAM size and in fact doesn't
* seem to differentiate between it.
* Looks like we can use any address starting from 0x80000000 (so 2GB of space).
* However, using a large space slows down tests.
*/
MEMORY
{
FLASH_TEXT (rw) : ORIGIN = 0x80000000, LENGTH = 0x100000
RAM (xrw) : ORIGIN = 0x80100000, LENGTH = 0x100000
RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 100M
}
REGION_ALIAS("FLASH_TEXT", RAM)
_stack_size = 2K;
INCLUDE "targets/riscv.ld"