From 41b260e507e648d3aacb9d0385fcecd39a4c5ca2 Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Thu, 16 May 2024 18:27:25 +0000
Subject: [PATCH] testsuite: don't attempt to detect host cpu features when
 testing cross ghc

The testsuite driver CPU feature detection logic only detects host CPU
and only makes sense when we are not testing a cross GHC.

(cherry picked from commit c4c6d714b93e65052c872df0c3b700302adaba97)
(cherry picked from commit 07641012e879fb7f2f493c2b8a80b9784176e43a)
(cherry picked from commit 68bc5d72e99f1f4681ee9f8a1e48fbf7f24b6d4a)
---
 testsuite/driver/cpu_features.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testsuite/driver/cpu_features.py b/testsuite/driver/cpu_features.py
index 6e32d3b4459..b4b373c48b7 100644
--- a/testsuite/driver/cpu_features.py
+++ b/testsuite/driver/cpu_features.py
@@ -16,6 +16,11 @@ SUPPORTED_CPU_FEATURES = {
 cpu_feature_cache = None
 
 def get_cpu_features():
+    # we're testing a cross ghc, don't attempt to detect host cpu
+    # configuration
+    if config.target_wrapper is not None:
+        return {}
+
     if config.os in ['mingw32', 'linux'] and os.path.exists('/proc/cpuinfo'):
         f = open('/proc/cpuinfo').read()
         flags = re.search(r'flags\s*:\s*.*$', f, re.M)
-- 
GitLab