Blob Blame History Raw
From 1f60829a1fffdcbe268c1998a560fdeb6029407e Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 3 Jan 2022 22:39:31 -0500
Subject: [PATCH 2/7] Skip some cross Linux tests where qemu is broken

The upstream issues will hopefully be fixed soon:

- https://gitlab.com/qemu-project/qemu/-/issues/447
- https://gitlab.com/qemu-project/qemu/-/issues/690

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 main_test.go | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/main_test.go b/main_test.go
index ac204f0c..27344c27 100644
--- a/main_test.go
+++ b/main_test.go
@@ -264,6 +264,13 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
 }
 
 func emuCheck(t *testing.T, options compileopts.Options) {
+	// Skip running the test executable due to bugs in qemu.
+	// https://gitlab.com/qemu-project/qemu/-/issues/447
+	// https://gitlab.com/qemu-project/qemu/-/issues/690
+	if runtime.GOARCH == "arm64" && (options.GOARCH == "386" || options.GOARCH == "arm") {
+		t.Skip("qemu is broken for this host/target architecture combination")
+	}
+
 	// Check if the emulator is installed.
 	spec, err := compileopts.LoadTarget(&options)
 	if err != nil {
@@ -342,6 +349,11 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
 		t.Fatal(err)
 	}
 
+	if runtime.GOARCH == "arm64" && options.GOARCH == "amd64" && name == "reflect.go" {
+		// https://github.com/tinygo-org/tinygo/issues/3888
+		t.Skip("qemu is broken for this host/target architecture combination")
+	}
+
 	// Build the test binary.
 	stdout := &bytes.Buffer{}
 	_, err = buildAndRun("./"+path, config, stdout, cmdArgs, environmentVars, time.Minute, func(cmd *exec.Cmd, result builder.BuildResult) error {
@@ -353,6 +365,13 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
 		return
 	}
 
+	// Skip running the test executable due to bugs in qemu.
+	// https://gitlab.com/qemu-project/qemu/-/issues/447
+	// https://gitlab.com/qemu-project/qemu/-/issues/690
+	if runtime.GOARCH == "arm64" && (options.GOARCH == "386" || options.GOARCH == "arm") {
+		return
+	}
+
 	// putchar() prints CRLF, convert it to LF.
 	actual := bytes.Replace(stdout.Bytes(), []byte{'\r', '\n'}, []byte{'\n'}, -1)
 	expected = bytes.Replace(expected, []byte{'\r', '\n'}, []byte{'\n'}, -1) // for Windows
-- 
2.41.0