summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/runtests.py1
-rw-r--r--testsuite/driver/testglobals.py24
-rw-r--r--testsuite/driver/testlib.py17
3 files changed, 35 insertions, 7 deletions
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: