diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/config/ghc | 7 | ||||
-rw-r--r-- | testsuite/driver/runtests.py | 1 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 24 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 17 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal01/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal04/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/T20348/all.T | 5 | ||||
-rw-r--r-- | testsuite/tests/driver/recompChangedPackage/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/recompPluginPackage/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/recompTHpackage/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/dynlibs/Makefile | 12 | ||||
-rw-r--r-- | testsuite/tests/dynlibs/T19350/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/dynlibs/all.T | 31 | ||||
-rw-r--r-- | testsuite/tests/ghci/linking/all.T | 4 | ||||
-rw-r--r-- | testsuite/tests/ghci/linking/dyn/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/profiling/should_compile/all.T | 3 | ||||
-rw-r--r-- | testsuite/tests/rts/linker/all.T | 7 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/check/pkg01/all.T | 2 |
18 files changed, 83 insertions, 44 deletions
diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 6d90e83397..aed4c22fb0 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -53,11 +53,12 @@ if ghc_with_threaded_rts: config.run_ways.append('nonmoving_thr') if ghc_with_dynamic_rts: - config.have_shared_libs = True - -if ghc_with_dynamic_rts: + config.supports_dynamic_libs = True config.run_ways.append('dyn') +if windows: + config.supports_dynamic_hs = False + if (config.have_profiling and ghc_with_threaded_rts): config.run_ways.append('profthreaded') diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 98d6c134b9..2c76661184 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -42,6 +42,7 @@ ghc_env['TERM'] = 'vt100' global config config = getConfig() # get it from testglobals +config.validate() def signal_handler(signal, frame): stopNow() diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index f52aec281c..adb2109923 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -134,8 +134,16 @@ class TestConfig: # Do we have interpreter support? self.have_interp = False - # Do we have shared libraries? - self.have_shared_libs = False + # Does the platform support loading of dynamic shared libraries? e.g. + # some musl-based environments do not. + self.supports_dynamic_libs = True + + # Does GHC support dynamic linking of Haskell objects (i.e. the dynamic + # way)? + self.supports_dynamic_hs = True + + # Is the compiler dynamically linked? + self.ghc_dynamic = False # Do we have SMP support? self.have_smp = False @@ -152,9 +160,6 @@ class TestConfig: # Are we testing an in-tree compiler? self.in_tree_compiler = True - # Is the compiler dynamically linked? - self.ghc_dynamic = False - # Are we running in a ThreadSanitizer-instrumented build? self.have_thread_sanitizer = False @@ -205,6 +210,15 @@ class TestConfig: # I have no idea what this does self.package_conf_cache_file = None # type: Optional[Path] + def validate(self) -> None: + """ Check the TestConfig for self-consistency """ + def assert_implies(a: bool, b: bool): + if a: + assert(b) + + assert_implies(self.supports_dynamic_hs, self.supports_dynamic_libs) + assert_implies(self.have_dynamic, self.supports_dynamic_hs) + assert_implies(self.ghc_dynamic, self.have_dynamic) global config config = TestConfig() diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 1a12f5c086..3202bab65c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -206,8 +206,20 @@ def req_profiling( name, opts ): if not config.have_profiling: opts.expect = 'fail' -def req_shared_libs( name, opts ): - if not config.have_shared_libs: +def req_dynamic_lib_support( name, opts ): + ''' + Require that the platform have shared object support (N.B. this doesn't + necessary imply that GHC supports the dynamic way). + ''' + if not config.supports_dynamic_libs: + opts.expect = 'fail' + +def req_dynamic_hs( name, opts ): + ''' + Require that the GHC supports dynamic linking of Haskell objects on the + platform + ''' + if not config.supports_dynamic_hs: opts.expect = 'fail' def req_interp( name, opts ): @@ -571,6 +583,7 @@ def have_ncg( ) -> bool: return config.have_ncg def have_dynamic( ) -> bool: + ''' Were libraries built in the dynamic way? ''' return config.have_dynamic def have_profiling( ) -> bool: diff --git a/testsuite/tests/cabal/cabal01/all.T b/testsuite/tests/cabal/cabal01/all.T index 9bf2eb13d5..4a17490f18 100644 --- a/testsuite/tests/cabal/cabal01/all.T +++ b/testsuite/tests/cabal/cabal01/all.T @@ -8,7 +8,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if config.have_shared_libs: +if config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' diff --git a/testsuite/tests/cabal/cabal04/all.T b/testsuite/tests/cabal/cabal04/all.T index 3a4756026a..d84acf98b3 100644 --- a/testsuite/tests/cabal/cabal04/all.T +++ b/testsuite/tests/cabal/cabal04/all.T @@ -8,7 +8,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if not config.compiler_profiled and config.have_shared_libs: +if not config.compiler_profiled and config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' diff --git a/testsuite/tests/driver/T20348/all.T b/testsuite/tests/driver/T20348/all.T index cd888b0105..935c8efa8c 100644 --- a/testsuite/tests/driver/T20348/all.T +++ b/testsuite/tests/driver/T20348/all.T @@ -1,2 +1,3 @@ -test('T20348', [extra_files(['A.hs']), - when(opsys('mingw32'), skip)], makefile_test, []) +# N.B. this package requires a dynamically-linked ghc-bin, since it assumes +# that TH evaluation will build dynamic objects. +test('T20348', [extra_files(['A.hs']), unless(have_dynamic(), skip)], makefile_test, []) diff --git a/testsuite/tests/driver/recompChangedPackage/all.T b/testsuite/tests/driver/recompChangedPackage/all.T index 8acd1655b9..f08a2534f6 100644 --- a/testsuite/tests/driver/recompChangedPackage/all.T +++ b/testsuite/tests/driver/recompChangedPackage/all.T @@ -8,7 +8,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if not config.compiler_profiled and config.have_shared_libs: +if not config.compiler_profiled and config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' diff --git a/testsuite/tests/driver/recompPluginPackage/all.T b/testsuite/tests/driver/recompPluginPackage/all.T index ea6cce4baa..08271d9c46 100644 --- a/testsuite/tests/driver/recompPluginPackage/all.T +++ b/testsuite/tests/driver/recompPluginPackage/all.T @@ -8,7 +8,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if not config.compiler_profiled and config.have_shared_libs: +if not config.compiler_profiled and config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' diff --git a/testsuite/tests/driver/recompTHpackage/all.T b/testsuite/tests/driver/recompTHpackage/all.T index 6e2826300c..78de429b70 100644 --- a/testsuite/tests/driver/recompTHpackage/all.T +++ b/testsuite/tests/driver/recompTHpackage/all.T @@ -8,7 +8,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if not config.compiler_profiled and config.have_shared_libs: +if not config.compiler_profiled and config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' diff --git a/testsuite/tests/dynlibs/Makefile b/testsuite/tests/dynlibs/Makefile index 19009605ea..3de7571f27 100644 --- a/testsuite/tests/dynlibs/Makefile +++ b/testsuite/tests/dynlibs/Makefile @@ -67,9 +67,9 @@ T18072: $(RM) -rf T18072/ mkdir T18072 '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072 \ - -dynamic -fPIC -c T18072.hs + -dynamic -fPIC -c T18072.hs '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072 \ - -dynamic -shared -flink-rts T18072/T18072.o -o T18072/T18072.so + -dynamic -shared -flink-rts T18072/T18072.o -o T18072/T18072.so ldd T18072/T18072.so | grep libHSrts >/dev/null .PHONY: T18072debug @@ -77,9 +77,9 @@ T18072debug: $(RM) -rf T18072debug/ mkdir T18072debug '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072debug \ - -dynamic -fPIC -c T18072.hs + -dynamic -fPIC -c T18072.hs '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072debug \ - -dynamic -shared -flink-rts -debug T18072debug/T18072.o -o T18072debug/T18072.so + -dynamic -shared -flink-rts -debug T18072debug/T18072.o -o T18072debug/T18072.so ldd T18072debug/T18072.so | grep libHSrts | grep _debug >/dev/null .PHONY: T18072static @@ -87,7 +87,7 @@ T18072static: $(RM) -rf T18072static/ mkdir T18072static '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072static \ - -c T18072.hs + -c T18072.hs '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 -outputdir T18072static \ - -staticlib -fno-link-rts T18072static/T18072.o -o T18072static/T18072.a + -staticlib -fno-link-rts T18072static/T18072.o -o T18072static/T18072.a ar t T18072static/T18072.a | grep RtsSymbols.o > /dev/null && exit 1 || exit 0 diff --git a/testsuite/tests/dynlibs/T19350/all.T b/testsuite/tests/dynlibs/T19350/all.T index c8915bde1f..19a34edfdb 100644 --- a/testsuite/tests/dynlibs/T19350/all.T +++ b/testsuite/tests/dynlibs/T19350/all.T @@ -13,4 +13,4 @@ # into libhello. # -test('T19350', [req_shared_libs, expect_broken(19350), extra_files(['clib', 'lib'])], makefile_test, []) +test('T19350', [req_dynamic_lib_support, expect_broken(19350), extra_files(['clib', 'lib'])], makefile_test, []) diff --git a/testsuite/tests/dynlibs/all.T b/testsuite/tests/dynlibs/all.T index 622bcab6a7..569962761a 100644 --- a/testsuite/tests/dynlibs/all.T +++ b/testsuite/tests/dynlibs/all.T @@ -1,24 +1,31 @@ test('T3807', - [req_shared_libs, - when(have_thread_sanitizer(), expect_broken(18883)), - when(opsys('mingw32'), - skip)], makefile_test, []) + [unless(have_dynamic(), skip), + when(have_thread_sanitizer(), expect_broken(18883))], + makefile_test, []) -test('T4464', [req_shared_libs, unless(opsys('mingw32'), skip)], makefile_test, []) +test('T4464', [req_dynamic_hs, unless(opsys('mingw32'), skip)], makefile_test, []) -test('T5373', [req_shared_libs], makefile_test, []) +test('T5373', [unless(have_dynamic(), skip)], makefile_test, []) # It's not clear exactly what platforms we can expect this to succeed on. test('T13702', [when(have_thread_sanitizer(), expect_broken(18884)), - req_shared_libs, unless(opsys('linux'), skip)], + unless(have_dynamic(), skip), + unless(opsys('linux'), skip)], makefile_test, []) -# test that -shared and -flink-rts actually links the rts -test('T18072', [req_shared_libs, unless(opsys('linux'), skip)], makefile_test, []) +# test that -shared and -flink-rts actually links the RTS +test('T18072', [unless(have_dynamic(), skip), unless(opsys('linux'), skip)], makefile_test, []) # test that -shared and -flink-rts respects alternative RTS flavours -test('T18072debug', [extra_files(['T18072.hs']), req_shared_libs, unless(opsys('linux'), skip)], makefile_test, []) +test('T18072debug', + [unless(have_dynamic(), skip), + extra_files(['T18072.hs']), + unless(opsys('linux'), skip)], + makefile_test, []) -# check that -staticlib and -fno-link-rts results in an archive without the RTR library -test('T18072static', [extra_files(['T18072.hs']), unless(opsys('linux'), skip)], makefile_test, []) +# check that -staticlib and -fno-link-rts results in an archive without the RTS library +test('T18072static', + [extra_files(['T18072.hs']), + unless(opsys('linux'), skip)], + makefile_test, []) diff --git a/testsuite/tests/ghci/linking/all.T b/testsuite/tests/ghci/linking/all.T index 655941d145..574ff9308c 100644 --- a/testsuite/tests/ghci/linking/all.T +++ b/testsuite/tests/ghci/linking/all.T @@ -8,7 +8,7 @@ test('ghcilink001', test('ghcilink002', [extra_files(['TestLink.hs', 'f.c']), when(unregisterised(), fragile(16085)), unless(doing_ghci, skip), - req_shared_libs], + unless(have_dynamic(), skip)], makefile_test, ['ghcilink002']) test('ghcilink003', @@ -32,7 +32,7 @@ test('ghcilink005', [extra_files(['TestLink.hs', 'f.c']), when(unregisterised(), fragile(16085)), unless(doing_ghci, skip), - req_shared_libs], + req_dynamic_lib_support], makefile_test, ['ghcilink005']) test('ghcilink006', diff --git a/testsuite/tests/ghci/linking/dyn/all.T b/testsuite/tests/ghci/linking/dyn/all.T index e2593ded9b..0092f7febe 100644 --- a/testsuite/tests/ghci/linking/dyn/all.T +++ b/testsuite/tests/ghci/linking/dyn/all.T @@ -1,4 +1,4 @@ -setTestOpts(req_shared_libs) +setTestOpts(req_dynamic_lib_support) test('load_short_name', [extra_files(['A.c']), unless(doing_ghci, skip)], diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T index d91cf9c666..a6a6d50c7c 100644 --- a/testsuite/tests/profiling/should_compile/all.T +++ b/testsuite/tests/profiling/should_compile/all.T @@ -6,8 +6,7 @@ test('prof002', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fprof-cafs']) test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0']) test('T12790', [only_ways(['normal']), req_profiling], compile, ['-O -prof']) -# -dynamic-too not supported on Windows -test('T14931', [when(opsys('mingw32'), skip), only_ways(['normal']), req_profiling, req_shared_libs], +test('T14931', [only_ways(['normal']), req_profiling, unless(have_dynamic(), skip)], makefile_test, ['T14931']) test('T15108', [only_ways(['normal']), req_profiling], compile, ['-O -prof -fprof-auto']) test('T19894', [only_ways(['normal']), req_profiling, extra_files(['T19894'])], multimod_compile, ['Main', '-v0 -O2 -prof -fprof-auto -iT19894']) diff --git a/testsuite/tests/rts/linker/all.T b/testsuite/tests/rts/linker/all.T index 32827de494..728a592b4e 100644 --- a/testsuite/tests/rts/linker/all.T +++ b/testsuite/tests/rts/linker/all.T @@ -82,11 +82,14 @@ test('T5435_dyn_gcc', extra_files(['T5435.hs', 'T5435_gcc.c']) , makefile_test, ###################################### test('linker_unload', - [extra_files(['LinkerUnload.hs', 'Test.hs']), req_rts_linker], + [extra_files(['LinkerUnload.hs', 'Test.hs']), + req_rts_linker], makefile_test, ['linker_unload']) test('linker_unload_native', - [extra_files(['LinkerUnload.hs', 'Test.hs']), req_rts_linker, + [extra_files(['LinkerUnload.hs', 'Test.hs']), + req_rts_linker, + unless(have_dynamic(), skip), when(opsys('darwin') or opsys('mingw32'), skip)], makefile_test, ['linker_unload_native']) diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T index 511c458815..fd23b2d362 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/all.T +++ b/testsuite/tests/safeHaskell/check/pkg01/all.T @@ -17,7 +17,7 @@ if config.have_profiling: else: prof = '--disable-library-profiling' -if config.have_shared_libs: +if config.have_dynamic: dyn = '--enable-shared' else: dyn = '--disable-shared' |