From a580722ecb716b917a16521d5185c1dbc24d0ab9 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

---
 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 1cccfd04b561..c0e7724c9de1 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -282,7 +282,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 f22fb392e9f9..01d1fcf14e9d 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 9c2d59701dfd..5b2e59b7ba5e 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -154,7 +154,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 b73518679685..35c97581a2f5 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -328,11 +328,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 c3a1ddb0e1b6..0d8899fe51b9 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -167,9 +167,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