[Git][ghc/ghc][wip/req_smp] 4 commits: add flag to separate bootstrapper

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Sat Dec 17 13:39:06 UTC 2022



doyougnu pushed to branch wip/req_smp at Glasgow Haskell Compiler / GHC


Commits:
71e78713 by doyougnu at 2022-12-17T07:54:52-05:00
add flag to separate bootstrapper

- - - - -
6023f924 by doyougnu at 2022-12-17T07:55:13-05:00
split req_smp -> req_target_smp and req_ghc_smp

- - - - -
fd8809fa by doyougnu at 2022-12-17T08:38:14-05:00
update tests smp flags

- - - - -
11e90c50 by doyougnu at 2022-12-17T08:38:41-05:00
cleanup and add some docstrings

- - - - -


13 changed files:

- hadrian/src/Oracles/Flag.hs
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/base/tests/all.T
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/tests/codeGen/should_run/all.T
- testsuite/tests/concurrent/should_run/all.T
- testsuite/tests/driver/T20030/test1/all.T
- testsuite/tests/driver/j-space/all.T
- testsuite/tests/driver/t22391/all.T
- testsuite/tests/ffi/should_run/all.T
- testsuite/tests/rts/all.T
- testsuite/tests/typecheck/should_fail/all.T


Changes:

=====================================
hadrian/src/Oracles/Flag.hs
=====================================
@@ -4,6 +4,7 @@ module Oracles.Flag (
     Flag (..), flag, getFlag,
     platformSupportsSharedLibs,
     platformSupportsGhciObjects,
+    bootstrapperSupportsSMP,
     targetSupportsThreadedRts,
     targetSupportsSMP,
     useLibffiForAdjustors,
@@ -105,6 +106,10 @@ targetSupportsThreadedRts = do
     bad_arch <- anyTargetArch [ "wasm32", "js" ]
     return $ not bad_arch
 
+bootstrapperSupportsSMP :: Action Bool
+bootstrapperSupportsSMP = flag BootstrapThreadedRts
+
+
 -- | Does the target support the -N RTS flag?
 targetSupportsSMP :: Action Bool
 targetSupportsSMP = do


=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -68,8 +68,9 @@ data TestCompilerArgs = TestCompilerArgs{
  ,   withInterpreter   :: Bool
  ,   unregisterised    :: Bool
  ,   tables_next_to_code :: Bool
- ,   withSMP           :: Bool
- ,   debugAssertions   :: Bool
+ ,   targetWithSMP       :: Bool
+ ,   bootstrapperWithSMP :: Bool
+ ,   debugAssertions     :: Bool
       -- ^ Whether the compiler has debug assertions enabled,
       -- corresponding to the -DDEBUG option.
  ,   profiled          :: Bool
@@ -101,7 +102,7 @@ inTreeCompilerArgs stg = do
     unregisterised      <- flag GhcUnregisterised
     tables_next_to_code <- flag TablesNextToCode
     targetWithSMP       <- targetSupportsSMP
-    ghcWithSMP          <- threadedBootstrapper
+    bootstrapperWithSMP <- bootstrapperSupportsSMP
     debugAssertions     <- ($ stg) . ghcDebugAssertions <$> flavour
     profiled            <- ghcProfiled        <$> flavour <*> pure stg
 
@@ -263,7 +264,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 "ghc_with_smp=" ghcWithSMP
+            , arg "-e", arg $ asBool "ghc_with_smp="    bootstrapperWithSMP
             , arg "-e", arg $ asBool "target_with_smp=" targetWithSMP
 
             , arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic


=====================================
libraries/base/tests/all.T
=====================================
@@ -240,7 +240,7 @@ test('T11555', normal, compile_and_run, [''])
 test('T12494', normal, compile_and_run, [''])
 test('T12852', [when(opsys('mingw32'), skip), js_broken(22374)], compile_and_run, [''])
 test('lazySTexamples', normal, compile_and_run, [''])
-test('T11760', req_smp, compile_and_run, ['-threaded -with-rtsopts=-N2'])
+test('T11760', [req_ghc_smp, req_target_smp], compile_and_run, ['-threaded -with-rtsopts=-N2'])
 test('T12874', normal, compile_and_run, [''])
 test('T13191',
         [ collect_stats('bytes allocated', 5)


=====================================
testsuite/driver/testglobals.py
=====================================
@@ -147,8 +147,11 @@ class TestConfig:
         # Is the compiler dynamically linked?
         self.ghc_dynamic = False
 
-        # Do we have SMP support?
-        self.have_smp = False
+        # Does the bootstrapping ghc  we have SMP support?
+        self.ghc_has_smp = False
+
+        # Does the target have SMP support?
+        self.target_with_smp = False
 
         # Is gdb available?
         self.have_gdb = False


=====================================
testsuite/driver/testlib.py
=====================================
@@ -296,8 +296,21 @@ def req_th( name, opts ):
     if ghc_dynamic():
         return _omit_ways(name, opts, ['profasm', 'profthreaded'])
 
-def req_smp( name, opts ):
-    if not config.have_smp:
+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 skip the test. Use this when the test needs to run with
+    smp support.
+    """
+    if not config.target_with_smp:
+        opts.skip = True
+
+def req_ghc_smp( name, opts ):
+    """
+    Mark a test as requiring smp to compile. Use this when the test needs to
+    be compiled with smp support, but may not necessarily be run.
+    """
+    if not config.ghc_has_smp:
         opts.expect = 'fail'
 
 def ignore_stdout(name, opts):


=====================================
testsuite/tests/codeGen/should_run/all.T
=====================================
@@ -156,7 +156,7 @@ test('T10246', normal, compile_and_run, [''])
 test('T9533', normal, compile_and_run, [''])
 test('T9533b', normal, compile_and_run, [''])
 test('T9533c', normal, compile_and_run, [''])
-test('T10414', [only_ways(['threaded2']), extra_ways(['threaded2']), req_smp],
+test('T10414', [only_ways(['threaded2']), extra_ways(['threaded2']), req_target_smp],
      compile_and_run, ['-feager-blackholing'])
 test('T10521', normal, compile_and_run, [''])
 test('T10521b', normal, compile_and_run, [''])


=====================================
testsuite/tests/concurrent/should_run/all.T
=====================================
@@ -240,7 +240,7 @@ test('setnumcapabilities001',
      [ only_ways(['threaded1','threaded2', 'nonmoving_thr', 'profthreaded']),
        extra_run_opts('8 12 2000'),
        when(have_thread_sanitizer(), expect_broken(18808)),
-       req_smp ],
+       req_target_smp ],
      compile_and_run, [''])
 
 test('T21651',
@@ -248,7 +248,7 @@ test('T21651',
        when(opsys('mingw32'),skip), # uses POSIX pipes
        when(opsys('darwin'),extra_run_opts('8 12 2000 100')),
        unless(opsys('darwin'),extra_run_opts('8 12 2000 200')), # darwin runners complain of too many open files
-       req_smp ],
+       req_target_smp ],
      compile_and_run, [''])
 
 test('hs_try_putmvar001',


=====================================
testsuite/tests/driver/T20030/test1/all.T
=====================================
@@ -9,6 +9,6 @@ test('T20030_test1j',
      [ extra_files([ 'A.hs-boot' , 'A.hs' , 'B.hs' , 'C.hs-boot' , 'C.hs'
                    , 'D.hs' , 'E.hs-boot' , 'E.hs' , 'F.hs' , 'G.hs' , 'H.hs'
                    , 'I.hs', 'J.hs-boot', 'J.hs', 'K.hs' ])
-     , req_smp
+     , req_ghc_smp
      ],
      multimod_compile, ['I.hs K.hs', '-v1 -j'])


=====================================
testsuite/tests/driver/j-space/all.T
=====================================
@@ -1 +1 @@
-test('jspace', [extra_files(['genJspace']), req_smp], makefile_test, ['jspace'])
+test('jspace', [extra_files(['genJspace']), req_ghc_smp], makefile_test, ['jspace'])


=====================================
testsuite/tests/driver/t22391/all.T
=====================================
@@ -1,5 +1,5 @@
 test('t22391', [extra_files(['src'])],
      multimod_compile, ['Lib', '-v1 -Wall -fhide-source-paths -isrc -fdefer-diagnostics'])
 
-test('t22391j', [req_smp, extra_files(['src'])],
+test('t22391j', [req_ghc_smp, extra_files(['src'])],
      multimod_compile, ['Lib', '-v1 -Wall -fhide-source-paths -isrc -fdefer-diagnostics -j2'])


=====================================
testsuite/tests/ffi/should_run/all.T
=====================================
@@ -235,7 +235,7 @@ test('T17471', [omit_ways(['ghci']), req_c], compile_and_run,
      ['T17471_c.c -optc-D -optcFOO'])
 
 test('IncallAffinity',
-     [req_smp, only_ways(['threaded1', 'threaded2']),
+     [req_target_smp, req_ghc_smp, only_ways(['threaded1', 'threaded2']),
       # Unregisterised build doesn't support
       when(unregisterised(), skip),
       req_c],


=====================================
testsuite/tests/rts/all.T
=====================================
@@ -286,7 +286,7 @@ test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
 
 test('T7815', [ multi_cpu_race,
                 extra_run_opts('50000 +RTS -N2 -RTS'),
-                req_smp,
+                req_target_smp, req_ghc_smp,
                 only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
 
 # ignore_stderr because it contains a unique:
@@ -305,10 +305,10 @@ test('T7919', [ when(fast(), skip)
 
 test('T8035', normal, compile_and_run, [''])
 
-test('T8209', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
+test('T8209', [ req_target_smp, req_ghc_smp, only_ways(threaded_ways), ignore_stdout ],
               compile_and_run, [''])
 
-test('T8242', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
+test('T8242', [ req_target_smp, req_ghc_smp, only_ways(threaded_ways), ignore_stdout ],
               compile_and_run, [''])
 
 test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
@@ -329,7 +329,8 @@ test('T9078', only_ways(['threaded1']), compile_and_run, [''])
 
 test('T10017', [ when(opsys('mingw32'), skip)
                , when(unregisterised(), skip)
-               , req_smp
+               , req_target_smp
+               , req_ghc_smp
                , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, [''])
 
 test('T11108', normal, compile_and_run, [''])
@@ -402,7 +403,7 @@ test('T11788', [ when(ghc_dynamic(), skip)
                , req_interp
                ], makefile_test, ['T11788'])
 
-test('T10296a', [req_smp], makefile_test, ['T10296a'])
+test('T10296a', [req_ghc_smp], makefile_test, ['T10296a'])
 
 test('T10296b', [only_ways(['threaded2'])], compile_and_run, [''])
 
@@ -456,7 +457,8 @@ test('alloccounter1', js_broken(22261), compile_and_run,
 
 test('nursery-chunks1',
   [ extra_run_opts('4 100 +RTS -n32k -A1m -RTS')
-  , req_smp
+  , req_ghc_smp
+  , req_target_smp
   , only_ways(['threaded1','threaded2'])
   ],
   compile_and_run,


=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -412,7 +412,7 @@ test('T11990a', normal, compile_fail, [''])
 test('T11990b', normal, compile_fail, [''])
 test('T12035', [], multimod_compile_fail, ['T12035', '-v0'])
 test('T12035j', [ extra_files(['T12035.hs', 'T12035a.hs', 'T12035.hs-boot'])
-                , req_smp
+                , req_ghc_smp
                 , js_broken(22261)
                 ], multimod_compile_fail, ['T12035', '-j2 -v0'])
 test('T12045b', normal, compile_fail, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c79b966c76d74c747638eae1fade4b47f38caa7...11e90c509191a89f001a4b49b02c641e3fecf273

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c79b966c76d74c747638eae1fade4b47f38caa7...11e90c509191a89f001a4b49b02c641e3fecf273
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221217/446693a4/attachment-0001.html>


More information about the ghc-commits mailing list