Blob Blame History Raw
From 8c931c99e52b8dc080bdcb0a062f9ed189f4286d 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 4/6] 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 | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/main_test.go b/main_test.go
index d9f440b0..d3daddc3 100644
--- a/main_test.go
+++ b/main_test.go
@@ -246,6 +246,20 @@ 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
+	switch runtime.GOARCH {
+	case "arm64":
+		if options.GOARCH == "386" || options.GOARCH == "arm" {
+			t.Skipf("qemu is broken for this host/target architecture combination")
+		}
+	case "386":
+		if options.GOARCH == "arm" {
+			t.Skipf("qemu is broken for this host/target architecture combination")
+		}
+	}
+
 	// Check if the emulator is installed.
 	spec, err := compileopts.LoadTarget(&options)
 	if err != nil {
@@ -367,6 +381,20 @@ 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
+	switch runtime.GOARCH {
+	case "arm64":
+		if options.GOARCH == "386" || options.GOARCH == "arm" {
+			return
+		}
+	case "386":
+		if options.GOARCH == "arm" {
+			return
+		}
+	}
+
 	// Reserve CPU time for the test to run.
 	// This attempts to ensure that the test is not CPU-starved.
 	options.Semaphore <- struct{}{}
-- 
2.31.1