diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/config/ghc | 49 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 7 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 16 | ||||
-rw-r--r-- | testsuite/mk/test.mk | 4 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/concurrent/T13615/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/concurrent/should_run/all.T | 8 | ||||
-rw-r--r-- | testsuite/tests/driver/T14075/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/T20030/test1/all.T | 3 | ||||
-rw-r--r-- | testsuite/tests/driver/j-space/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/t22391/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/all.T | 14 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 2 |
14 files changed, 80 insertions, 35 deletions
diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 8916ffa3a9..85c8b27c9e 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -43,10 +43,12 @@ if ghc_with_native_codegen: if config.have_interp: config.run_ways.append('ghci') +# we read the 'Support SMP' setting from the ghcconfig file. This dictates +# whether the target supports smp if ghc_with_threaded_rts: config.run_ways.append('threaded1') - if ghc_with_smp: - config.have_smp = True + if target_with_smp: + config.target_has_smp = True config.run_ways.append('threaded2') if config.speed == 0: config.run_ways.append('nonmoving_thr') @@ -210,31 +212,52 @@ def get_compiler_info(): # See Note [Replacing backward slashes in config.libdir]. config.libdir = config.libdir.replace('\\', '/') - def test_compile(flags) -> bool: + def test_compile(flags): """ - Check whether GHC can compile in the given way. - This is used as a proxy to determine, e.g., whether - profiled libraries were built. + Check whether GHC can compile in the given way. This is used as a + proxy to determine, e.g., whether profiled libraries were built, or + whether the host RTS supports smp. """ import tempfile import textwrap + + res = False + with tempfile.TemporaryDirectory() as d: src = Path(d) / 'test.hs' src.write_text(textwrap.dedent(''' module Main where main = putStrLn "Hello World!" ''')) - p = subprocess.run( + try: + p = subprocess.run( '{} -v0 {} -o test '.format(config.compiler, src) + ' '.join(flags), shell=True, cwd=d, - stderr=None if config.verbose >= 3 else subprocess.DEVNULL) - res = p.returncode - return res == 0 + stderr=None if config.verbose >= 3 else subprocess.DEVNULL + ) + + except Exception as err: + print("Exception thrown in testsuite/config/ghc.get_compiler_info: %s", err) + + else: + res = p.returncode == 0 + + return res + + def compiler_supports_way(flags): + return test_compile(flags) + + # Test the Host RTS to determine if it supports SMP. For cross compilers the + # Host /= Target, so we cannot determine from the ghcconfig file if the host + # itself supports smp. To support smp the host must be linked with an RTS + # built with 'defined(THREADED_RTS) && !defined(NO_SMP)'. Thus we directly + # query the RTS the host is linked with. + config.ghc_has_smp = test_compile(["+RTS", "-N"]) - config.have_vanilla = test_compile([]) - config.have_dynamic = test_compile(['-dynamic']) - config.have_profiling = test_compile(['-prof']) + config.have_vanilla = compiler_supports_way([]) + config.have_dynamic = compiler_supports_way(['-dynamic']) + config.have_profiling = compiler_supports_way(['-prof']) if config.have_profiling: config.compile_ways.append('profasm') diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index ea0b03b3c1..8c52f7f148 100644 --- a/testsuite/driver/testglobals.py +++ b/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 host RTS have SMP support? + self.ghc_has_smp = True + + # Does the target have SMP support? + self.target_has_smp = True # Is gdb available? self.have_gdb = False diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index aa738e96e2..bc83038d2b 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -296,8 +296,20 @@ 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_ghc_smp( name, opts ): + """ + Mark a test as requiring GHC to be linked with an RTS that supports smp. + """ + if not config.ghc_has_smp: + opts.skip = True + +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 + test needs to run with smp support. + """ + if not config.target_has_smp: opts.expect = 'fail' def ignore_stdout(name, opts): diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 201d52d1dd..7c654df9ae 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 ghc_with_smp=True +RUNTEST_OPTS += -e target_with_smp=True else -RUNTEST_OPTS += -e ghc_with_smp=False +RUNTEST_OPTS += -e target_with_smp=False endif ifeq "$(GhcWithRtsLinker)" "YES" diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 416eb4ecfd..de68abcd44 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/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, req_ghc_smp], compile_and_run, ['-feager-blackholing']) test('T10521', normal, compile_and_run, ['']) test('T10521b', normal, compile_and_run, ['']) diff --git a/testsuite/tests/concurrent/T13615/all.T b/testsuite/tests/concurrent/T13615/all.T index a6541d2a23..243ef8549f 100644 --- a/testsuite/tests/concurrent/T13615/all.T +++ b/testsuite/tests/concurrent/T13615/all.T @@ -1,7 +1,7 @@ test('T13615', [when(fast(), skip), when(unregisterised(), skip), - req_smp, # needs -N support + req_target_smp, # needs -N support only_ways(threaded_ways), extra_files(['Parallel.hs', 'Memo.hs']), # Decrease stack chunk size and lots of capabilities to increase failure diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index 3631cc8e88..047f70e6d8 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -240,7 +240,9 @@ 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, + req_ghc_smp + ], compile_and_run, ['']) test('T21651', @@ -248,7 +250,9 @@ 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, + req_ghc_smp + ], compile_and_run, ['']) test('hs_try_putmvar001', diff --git a/testsuite/tests/driver/T14075/all.T b/testsuite/tests/driver/T14075/all.T index 16f0e482f9..b7f7a39072 100644 --- a/testsuite/tests/driver/T14075/all.T +++ b/testsuite/tests/driver/T14075/all.T @@ -1,6 +1,6 @@ test('T14075', [ extra_files(['F.hs', 'F.hs-boot', 'O.hs', 'V.hs', 'V.hs-boot']) - , req_smp # uses ghc --make -j2 + , req_ghc_smp # uses ghc --make -j2 , js_broken(22261) ], makefile_test, []) diff --git a/testsuite/tests/driver/T20030/test1/all.T b/testsuite/tests/driver/T20030/test1/all.T index b1d4309065..2e121dbded 100644 --- a/testsuite/tests/driver/T20030/test1/all.T +++ b/testsuite/tests/driver/T20030/test1/all.T @@ -9,6 +9,7 @@ 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_target_smp + , req_ghc_smp ], multimod_compile, ['I.hs K.hs', '-v1 -j']) diff --git a/testsuite/tests/driver/j-space/all.T b/testsuite/tests/driver/j-space/all.T index 7864ebf73a..9d7e4c89f0 100644 --- a/testsuite/tests/driver/j-space/all.T +++ b/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_target_smp, req_ghc_smp], makefile_test, ['jspace']) diff --git a/testsuite/tests/driver/t22391/all.T b/testsuite/tests/driver/t22391/all.T index f8a3d2fb3c..a1769856ad 100644 --- a/testsuite/tests/driver/t22391/all.T +++ b/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_target_smp, req_ghc_smp, extra_files(['src'])], multimod_compile, ['Lib', '-v1 -Wall -fhide-source-paths -isrc -fdefer-diagnostics -j2']) diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index 3cece482b2..f2270fc2ab 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/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], diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 2b8ce66e3e..21114cb3de 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -287,7 +287,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: @@ -306,10 +306,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']), @@ -330,7 +330,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, ['']) @@ -403,7 +404,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, ['']) @@ -457,7 +458,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, diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 61514e725b..bfb7b311a0 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/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, ['']) |