Blame 0003-Skip-some-cross-Linux-tests-where-qemu-is-broken.patch

9b32d8b
From 2a2e35e4565e8ea7f7ac2d34cb9da24000bb6474 Mon Sep 17 00:00:00 2001
6cc5380
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
6cc5380
Date: Mon, 3 Jan 2022 22:39:31 -0500
9b16b76
Subject: [PATCH 03/26] Skip some cross Linux tests where qemu is broken
6cc5380
6cc5380
The upstream issues will hopefully be fixed soon:
6cc5380
6cc5380
- https://gitlab.com/qemu-project/qemu/-/issues/447
6cc5380
- https://gitlab.com/qemu-project/qemu/-/issues/690
6cc5380
6cc5380
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
6cc5380
---
6ba7946
 main_test.go | 28 ++++++++++++++++++++++++++++
6ba7946
 1 file changed, 28 insertions(+)
6cc5380
6cc5380
diff --git a/main_test.go b/main_test.go
9b32d8b
index 79ae2cf2..9359ef0c 100644
6cc5380
--- a/main_test.go
6cc5380
+++ b/main_test.go
9b32d8b
@@ -252,6 +252,20 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
6ba7946
 }
6ba7946
 
6ba7946
 func emuCheck(t *testing.T, options compileopts.Options) {
6ba7946
+	// Skip running the test executable due to bugs in qemu.
6ba7946
+	// https://gitlab.com/qemu-project/qemu/-/issues/447
6ba7946
+	// https://gitlab.com/qemu-project/qemu/-/issues/690
6ba7946
+	switch runtime.GOARCH {
6ba7946
+	case "arm64":
6ba7946
+		if options.GOARCH == "386" || options.GOARCH == "arm" {
6ba7946
+			t.Skipf("qemu is broken for this host/target architecture combination")
6ba7946
+		}
6ba7946
+	case "386":
6ba7946
+		if options.GOARCH == "arm" {
6ba7946
+			t.Skipf("qemu is broken for this host/target architecture combination")
6ba7946
+		}
6ba7946
+	}
6ba7946
+
6ba7946
 	// Check if the emulator is installed.
6ba7946
 	spec, err := compileopts.LoadTarget(&options)
6ba7946
 	if err != nil {
9b32d8b
@@ -341,6 +355,20 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
6cc5380
 		return
6cc5380
 	}
6cc5380
 
6cc5380
+	// Skip running the test executable due to bugs in qemu.
6cc5380
+	// https://gitlab.com/qemu-project/qemu/-/issues/447
6cc5380
+	// https://gitlab.com/qemu-project/qemu/-/issues/690
6cc5380
+	switch runtime.GOARCH {
6cc5380
+	case "arm64":
6cc5380
+		if options.GOARCH == "386" || options.GOARCH == "arm" {
6cc5380
+			return
6cc5380
+		}
6cc5380
+	case "386":
6cc5380
+		if options.GOARCH == "arm" {
6cc5380
+			return
6cc5380
+		}
6cc5380
+	}
6cc5380
+
b22e370
 	// putchar() prints CRLF, convert it to LF.
b22e370
 	actual := bytes.Replace(stdout.Bytes(), []byte{'\r', '\n'}, []byte{'\n'}, -1)
b22e370
 	expected = bytes.Replace(expected, []byte{'\r', '\n'}, []byte{'\n'}, -1) // for Windows
6cc5380
-- 
9b16b76
2.38.1
6cc5380