From 5e79f8b4d2dd1086cc25d9f76da0e508c61c8bb0 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)
---
 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 07991656d9f..2ce79da05a6 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -280,7 +280,7 @@ runTestBuilderArgs = builder Testsuite ? do
             , arg "-e", arg $ asBool "ghc_with_dynamic_rts="  (hasDynamicRts)
             , arg "-e", arg $ asBool "config.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 f22fb392e9f..01d1fcf14e9 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -48,8 +48,7 @@ if config.have_interp:
 # whether the target supports smp
 if config.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 c1748f0b9f5..e709ad9738e 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -163,7 +163,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 8eed26529d1..7d41384ea66 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -346,11 +346,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_ghc_with_threaded_rts( name, opts ):
     if not config.ghc_with_threaded_rts:
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 7b346376aa7..d2cda3d3d90 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