mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
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:
@@ -278,7 +278,7 @@ jobs:
|
|||||||
run: make tinygo-test
|
run: make tinygo-test
|
||||||
- run: make smoketest
|
- run: make smoketest
|
||||||
- run: make wasmtest
|
- run: make wasmtest
|
||||||
- run: make tinygo-baremetal
|
- run: make tinygo-test-baremetal
|
||||||
build-linux-cross:
|
build-linux-cross:
|
||||||
# Build ARM Linux binaries, ready for release.
|
# Build ARM Linux binaries, ready for release.
|
||||||
# This intentionally uses an older Linux image, so that we compile against
|
# This intentionally uses an older Linux image, so that we compile against
|
||||||
|
|||||||
+43
-7
@@ -407,8 +407,45 @@ TEST_PACKAGES_WINDOWS := \
|
|||||||
text/template/parse \
|
text/template/parse \
|
||||||
$(nil)
|
$(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
|
# Report platforms on which each standard library package is known to pass tests
|
||||||
jointmp := $(shell echo /tmp/join.$$$$)
|
jointmp := $(shell echo /tmp/join.$$$$)
|
||||||
@@ -489,6 +526,10 @@ tinygo-bench-wasip2:
|
|||||||
tinygo-bench-wasip2-fast:
|
tinygo-bench-wasip2-fast:
|
||||||
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_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 external packages in a large corpus.
|
||||||
test-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
|
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
|
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
|
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
|
.PHONY: testchdir
|
||||||
testchdir:
|
testchdir:
|
||||||
# test 'build' command with{,out} -C argument
|
# test 'build' command with{,out} -C argument
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
/* Memory map:
|
/* Memory map:
|
||||||
* https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
|
* 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
|
* Looks like we can use any address starting from 0x80000000 (so 2GB of space).
|
||||||
* future. QEMU does not seem to limit the flash/RAM size and in fact doesn't
|
* However, using a large space slows down tests.
|
||||||
* seem to differentiate between it.
|
|
||||||
*/
|
*/
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH_TEXT (rw) : ORIGIN = 0x80000000, LENGTH = 0x100000
|
RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 100M
|
||||||
RAM (xrw) : ORIGIN = 0x80100000, LENGTH = 0x100000
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_TEXT", RAM)
|
||||||
|
|
||||||
_stack_size = 2K;
|
_stack_size = 2K;
|
||||||
|
|
||||||
INCLUDE "targets/riscv.ld"
|
INCLUDE "targets/riscv.ld"
|
||||||
|
|||||||
Reference in New Issue
Block a user