From b83c00c48373fca6c976a44e0ff9db0c9a00762a Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Tue, 30 Apr 2024 14:17:50 +0000
Subject: [PATCH] testsuite: fix req_target_smp predicate

(cherry picked from commit a580722ecb716b917a16521d5185c1dbc24d0ab9)
(cherry picked from commit 4f317bfdc47e609fc26f1e1483a71b581ebcccbb)
(cherry picked from commit d94d0176ce53aecb71cd79b90ae81b2801ec4ae7)
---
 hadrian/src/Settings/Builders/RunTest.hs | 2 +-
 testsuite/config/ghc                     | 3 +--
 testsuite/driver/testglobals.py          | 2 +-
 testsuite/driver/testlib.py              | 4 ++--
 testsuite/mk/test.mk                     | 4 ++--
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs
index 4a18f676eb5..26feb2b0667 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -263,7 +263,7 @@ runTestBuilderArgs = builder Testsuite ? do
             , arg "-e", arg $ asBool "ghc_with_dynamic_rts="  (hasDynamicRts)
             , arg "-e", arg $ asBool "ghc_with_threaded_rts=" (hasThreadedRts)
             , arg "-e", arg $ asBool "config.have_fast_bignum=" (bignumBackend /= "native" && not bignumCheck)
-            , arg "-e", arg $ asBool "target_with_smp=" targetWithSMP
+            , arg "-e", arg $ asBool "config.target_has_smp=" targetWithSMP
             , arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic
             , arg "-e", arg $ "config.leading_underscore=" ++ show leadingUnderscore
 
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index ccd89a2348e..8ac07a24f77 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -47,8 +47,7 @@ if config.have_interp:
 # whether the target supports smp
 if ghc_with_threaded_rts:
     config.run_ways.append('threaded1')
-    if target_with_smp:
-        config.target_has_smp = True
+    if config.target_has_smp:
         config.run_ways.append('threaded2')
         if config.speed == 0:
             config.run_ways.append('nonmoving_thr')
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 76532b4b884..16251d14247 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -157,7 +157,7 @@ class TestConfig:
         self.ghc_has_smp = True
 
         # Does the target have SMP support?
-        self.target_has_smp = True
+        self.target_has_smp = False
 
         # Is gdb available?
         self.have_gdb = False
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 6dc10f5988e..3708c165878 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -304,11 +304,11 @@ def req_ghc_smp( name, opts ):
 def req_target_smp( name, opts ):
     """
     Mark a test as requiring smp when run on the target. If the target does
-    not support smp, then mark the test as an expected fail. Use this when the
+    not support smp, then skip the test. Use this when the
     test needs to run with smp support.
     """
     if not config.target_has_smp:
-        opts.expect = 'fail'
+        opts.skip = True
 
 def req_process( name, opts ):
     if not config.have_process:
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 7c654df9ae7..64dd78ecb26 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -164,9 +164,9 @@ CABAL_PLUGIN_BUILD = --enable-library-vanilla --disable-shared
 endif
 
 ifeq "$(GhcWithSMP)" "YES"
-RUNTEST_OPTS += -e target_with_smp=True
+RUNTEST_OPTS += -e config.target_has_smp=True
 else
-RUNTEST_OPTS += -e target_with_smp=False
+RUNTEST_OPTS += -e config.target_has_smp=False
 endif
 
 ifeq "$(GhcWithRtsLinker)" "YES"
-- 
GitLab