From aa6afe8ab48b5fbe09d332a25ce6af4719c5cb44 Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Sat, 1 Apr 2023 19:48:31 +0000 Subject: testsuite: add the req_ghc_with_threaded_rts predicate This patch adds the req_ghc_with_threaded_rts predicate to the testsuite to assert the platform has threaded RTS, and mark some tests as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a config field instead of a global variable. --- testsuite/config/ghc | 4 ++-- testsuite/driver/testglobals.py | 3 +++ testsuite/driver/testlib.py | 4 ++++ testsuite/mk/test.mk | 4 ++-- testsuite/tests/codeGen/should_run/all.T | 2 +- testsuite/tests/concurrent/should_run/all.T | 2 +- testsuite/tests/lib/base/all.T | 2 +- testsuite/tests/rts/all.T | 8 ++++---- 8 files changed, 18 insertions(+), 11 deletions(-) (limited to 'testsuite') diff --git a/testsuite/config/ghc b/testsuite/config/ghc index bff98d0598..46b897bef0 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -45,7 +45,7 @@ if config.have_interp: # we read the 'Support SMP' setting from the ghcconfig file. This dictates # whether the target supports smp -if ghc_with_threaded_rts: +if config.ghc_with_threaded_rts: config.run_ways.append('threaded1') if target_with_smp: config.target_has_smp = True @@ -265,7 +265,7 @@ def get_compiler_info(): config.compile_ways.append('profasm') config.run_ways.append('profasm') - if config.have_profiling and ghc_with_threaded_rts: + if config.have_profiling and config.ghc_with_threaded_rts: config.run_ways.append('profthreaded') ghc_env['HAVE_PROFILING'] = 'YES' diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 6604036c12..6688d961d2 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -142,6 +142,9 @@ class TestConfig: # Do we have RTS linker? self.have_RTS_linker = False + # Do we have threaded RTS? + self.ghc_with_threaded_rts = False + # Does the platform support loading of dynamic shared libraries? e.g. # some musl-based environments do not. self.supports_dynamic_libs = True diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8ab42e4508..43aab6f0da 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -313,6 +313,10 @@ def req_target_smp( name, opts ): if not config.target_has_smp: opts.expect = 'fail' +def req_ghc_with_threaded_rts( name, opts ): + if not config.ghc_with_threaded_rts: + opts.skip = True + def ignore_stdout(name, opts): opts.ignore_stdout = True diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index bb5d138856..7b346376aa 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -110,9 +110,9 @@ HAVE_READELF := $(shell if readelf --version > /dev/null 2> /dev/null; then echo BIGNUM_GMP := $(shell "$(GHC_PKG)" field ghc-bignum exposed-modules | grep GMP) ifeq "$(filter thr, $(GhcRTSWays))" "thr" -RUNTEST_OPTS += -e ghc_with_threaded_rts=True +RUNTEST_OPTS += -e config.ghc_with_threaded_rts=True else -RUNTEST_OPTS += -e ghc_with_threaded_rts=False +RUNTEST_OPTS += -e config.ghc_with_threaded_rts=False endif ifeq "$(filter dyn, $(GhcRTSWays))" "dyn" diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 87ff271296..0e11ac8628 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_target_smp, req_ghc_smp], +test('T10414', [only_ways(['threaded2']), extra_ways(['threaded2']), req_target_smp, req_ghc_smp, req_ghc_with_threaded_rts], compile_and_run, ['-feager-blackholing']) test('T10521', normal, compile_and_run, ['']) test('T10521b', normal, compile_and_run, ['']) diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index 3a2b211402..3e238e7cff 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -35,6 +35,7 @@ test('T3279', normal, compile_and_run, ['']) # This test takes a long time with the default context switch interval test('T3429', [ extra_run_opts('+RTS -C0.001 -RTS'), + req_ghc_with_threaded_rts, unless(unregisterised(), extra_ways(['debug_numa'])) ], compile_and_run, ['']) @@ -289,4 +290,3 @@ test('hs_try_putmvar003', # Check forkIO exception determinism under optimization test('T13330', normal, compile_and_run, ['-O']) - diff --git a/testsuite/tests/lib/base/all.T b/testsuite/tests/lib/base/all.T index bd8d7dc486..e04bb27eae 100644 --- a/testsuite/tests/lib/base/all.T +++ b/testsuite/tests/lib/base/all.T @@ -1,7 +1,7 @@ test('DataTypeOrd', normal, compile_and_run, ['']) test('T16586', normal, compile_and_run, ['-O2']) # Event-manager not supported on Windows -test('T16916', [when(opsys('mingw32'), skip), js_broken(22261), fragile(16966)], compile_and_run, ['-O2 -threaded -with-rtsopts="-I0" -rtsopts']) +test('T16916', [when(opsys('mingw32'), skip), js_broken(22261), fragile(16966), req_ghc_with_threaded_rts], compile_and_run, ['-O2 -threaded -with-rtsopts="-I0" -rtsopts']) test('T17310', normal, compile, ['']) test('T19691', normal, compile, ['']) test('executablePath', [extra_run_opts(config.os), js_broken(22261)], compile_and_run, ['']) diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 6042a52e02..aab8c6908c 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -409,7 +409,7 @@ test('T10296a', [req_ghc_smp, req_c], makefile_test, ['T10296a']) test('T10296b', [only_ways(['threaded2'])], compile_and_run, ['']) -test('numa001', [ extra_run_opts('8'), unless(unregisterised(), extra_ways(['debug_numa'])) ] +test('numa001', [ extra_run_opts('8'), unless(unregisterised(), extra_ways(['debug_numa'])), req_ghc_with_threaded_rts ] , compile_and_run, ['']) test('T12497', [ unless(opsys('mingw32'), skip), expect_broken(22694) @@ -425,7 +425,7 @@ test('T12903', [ fragile(21184) , js_broken(22374)] , compile_and_run, ['']) -test('T13832', exit_code(1), compile_and_run, ['-threaded']) +test('T13832', [exit_code(1), req_ghc_with_threaded_rts], compile_and_run, ['-threaded']) # js_skip T13894 because the JS backend only allocates pinned arrays so this # test will always fail test('T13894', js_skip, compile_and_run, ['']) @@ -549,7 +549,7 @@ test('cloneMyStack2', test('cloneMyStack_retBigStackFrame', [req_c, extra_files(['cloneStackLib.c']), ignore_stdout], compile_and_run, ['cloneStackLib.c']) -test('cloneThreadStack', [req_c, only_ways(['threaded1']), extra_ways(['threaded1']), extra_files(['cloneStackLib.c'])], compile_and_run, ['cloneStackLib.c -threaded']) +test('cloneThreadStack', [req_c, only_ways(['threaded1']), extra_ways(['threaded1']), extra_files(['cloneStackLib.c']), req_ghc_with_threaded_rts], compile_and_run, ['cloneStackLib.c -threaded']) test('decodeMyStack', [ js_broken(22261) # cloneMyStack# not yet implemented @@ -570,7 +570,7 @@ test('decodeMyStack_emptyListForMissingFlag', ], compile_and_run, ['']) # Skip for JS platform as the JS RTS is always single threaded -test('T22795a', [only_ways(['normal']), js_skip], compile_and_run, ['-threaded']) +test('T22795a', [only_ways(['normal']), js_skip, req_ghc_with_threaded_rts], compile_and_run, ['-threaded']) test('T22795b', [only_ways(['normal']), js_skip], compile_and_run, ['-single-threaded']) test('T22795c', [only_ways(['normal']), js_skip], compile_and_run, ['-threaded -single-threaded']) -- cgit v1.2.1