mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
test: support non-host tests
For example, for running tests with -target=wasm or -target=cortex-m-qemu. It looks at the output to determine whether tests were successful in the absence of a status code.
This commit is contained in:
committed by
Ron Evans
parent
1096596b69
commit
b713001313
@@ -39,4 +39,9 @@ func libc_free(ptr unsafe.Pointer) {
|
||||
free(ptr)
|
||||
}
|
||||
|
||||
//go:linkname syscall_Exit syscall.Exit
|
||||
func syscall_Exit(code int) {
|
||||
abort()
|
||||
}
|
||||
|
||||
const baremetal = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build cortexm,!nxp
|
||||
// +build cortexm,!nxp,!qemu
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ func postinit() {}
|
||||
func main() {
|
||||
preinit()
|
||||
run()
|
||||
|
||||
// Signal successful exit.
|
||||
arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingApplicationExit)
|
||||
abort()
|
||||
}
|
||||
@@ -54,3 +56,13 @@ func putchar(c byte) {
|
||||
func waitForEvents() {
|
||||
arm.Asm("wfe")
|
||||
}
|
||||
|
||||
func abort() {
|
||||
// Signal an abnormal exit.
|
||||
arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingRunTimeErrorUnknown)
|
||||
|
||||
// Lock up forever (should be unreachable).
|
||||
for {
|
||||
arm.Asm("wfi")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user