diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-02-25 16:28:23 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-25 10:18:17 -0400 |
commit | 18e5103f0f73570e31421e67e54f1693936f5efd (patch) | |
tree | ef2b94302745289885cbe94589f4ebadb1efad68 /testsuite/mk | |
parent | b2721819f391ab49871271283f32df54810c4387 (diff) | |
download | haskell-18e5103f0f73570e31421e67e54f1693936f5efd.tar.gz |
testsuite: More robust library way detection
Previously `test.mk` would try to determine whether the dynamic,
profiling, and vanilla library ways are available by searching for
`PrimOpWrappers.{,dyn_,p_}hi` in directory reported by `ghc-pkg field
ghc-prim library-dirs`. However, this is extremely fragile as
there is no guarantee that there is only one library directory. To
handle the case of multiple `library-dirs` correct we would
have to carry out the delicate task of tokenising the directory list (in
shell, no less).
Since this isn't a task that I am eager to solve, I have rather moved
the detection logic into the testsuite driver and instead perform a test
compilation in each of the ways. This should be more robust than the
previous approach.
I stumbled upon this while fixing #20579.
Diffstat (limited to 'testsuite/mk')
-rw-r--r-- | testsuite/mk/test.mk | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index dbe03286ce..4728ab400e 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -96,10 +96,6 @@ else RUNTEST_OPTS += -e "config.leading_underscore=False" endif -GHC_PRIM_LIBDIR := $(subst library-dirs: ,,"$(shell "$(GHC_PKG)" field ghc-prim library-dirs --simple-output)") -HAVE_VANILLA := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.hi" ]; then echo YES; else echo NO; fi) -HAVE_DYNAMIC := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.dyn_hi" ]; then echo YES; else echo NO; fi) -HAVE_PROFILING := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.p_hi" ]; then echo YES; else echo NO; fi) HAVE_GDB := $(shell if gdb --version > /dev/null 2> /dev/null; then echo YES; else echo NO; fi) HAVE_READELF := $(shell if readelf --version > /dev/null 2> /dev/null; then echo YES; else echo NO; fi) @@ -107,24 +103,6 @@ HAVE_READELF := $(shell if readelf --version > /dev/null 2> /dev/null; then echo # used BIGNUM_GMP := $(shell "$(GHC_PKG)" field ghc-bignum exposed-modules | grep GMP) -ifeq "$(HAVE_VANILLA)" "YES" -RUNTEST_OPTS += -e config.have_vanilla=True -else -RUNTEST_OPTS += -e config.have_vanilla=False -endif - -ifeq "$(HAVE_DYNAMIC)" "YES" -RUNTEST_OPTS += -e config.have_dynamic=True -else -RUNTEST_OPTS += -e config.have_dynamic=False -endif - -ifeq "$(HAVE_PROFILING)" "YES" -RUNTEST_OPTS += -e config.have_profiling=True -else -RUNTEST_OPTS += -e config.have_profiling=False -endif - ifeq "$(filter thr, $(GhcRTSWays))" "thr" RUNTEST_OPTS += -e ghc_with_threaded_rts=True else |