summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-09 16:55:45 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-22 20:21:11 -0400
commitff1b7710c9975a3cc1025cb5b9d29197a5f1a98a (patch)
tree080f2bef5be139ff47efb1823fe4ca9ef890ea78
parent15ce1804d2b87ac7bd55632957a4cb897decbbee (diff)
downloadhaskell-ff1b7710c9975a3cc1025cb5b9d29197a5f1a98a.tar.gz
Add test for #18064
It has been fixed by 0effc57d48ace6b719a9f4cbeac67c95ad55010b
-rw-r--r--testsuite/driver/testglobals.py3
-rw-r--r--testsuite/driver/testlib.py5
-rw-r--r--testsuite/mk/ghc-config.hs1
-rw-r--r--testsuite/mk/test.mk6
-rw-r--r--testsuite/tests/ghci/should_run/T18064.script2
-rw-r--r--testsuite/tests/ghci/should_run/T18064.stderr2
-rw-r--r--testsuite/tests/ghci/should_run/T18064.stdout1
-rw-r--r--testsuite/tests/ghci/should_run/all.T9
8 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 13e22d5329..c358a660d9 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -148,6 +148,9 @@ class TestConfig:
# Is the compiler dynamically linked?
self.ghc_dynamic = False
+ # Do symbols use leading underscores?
+ self.leading_underscore = False
+
# the timeout program
self.timeout_prog = ''
self.timeout = 300
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 9d6fc27b95..a6ff229c06 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -501,6 +501,11 @@ def doing_ghci() -> bool:
def ghc_dynamic() -> bool:
return config.ghc_dynamic
+# Symbols have a leading underscore
+def leading_underscore() -> bool:
+ return config.leading_underscore
+
+
def fast() -> bool:
return config.speed == 2
diff --git a/testsuite/mk/ghc-config.hs b/testsuite/mk/ghc-config.hs
index b0278bcfae..cfd6147cd0 100644
--- a/testsuite/mk/ghc-config.hs
+++ b/testsuite/mk/ghc-config.hs
@@ -23,6 +23,7 @@ main = do
getGhcFieldOrFail fields "GhcUnregisterised" "Unregisterised"
getGhcFieldOrFail fields "GhcWithSMP" "Support SMP"
getGhcFieldOrFail fields "GhcRTSWays" "RTS ways"
+ getGhcFieldOrFail fields "GhcLeadingUnderscore" "Leading underscore"
getGhcFieldOrDefault fields "GhcDynamicByDefault" "Dynamic by default" "NO"
getGhcFieldOrDefault fields "GhcDynamic" "GHC Dynamic" "NO"
getGhcFieldOrDefault fields "GhcProfiled" "GHC Profiled" "NO"
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index b2cdf78f5f..35d3122903 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -93,6 +93,12 @@ else
RUNTEST_OPTS += -e ghc_with_native_codegen=False
endif
+ifeq "$(GhcLeadingUnderscore)" "YES"
+RUNTEST_OPTS += -e "config.leading_underscore=True"
+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)
diff --git a/testsuite/tests/ghci/should_run/T18064.script b/testsuite/tests/ghci/should_run/T18064.script
new file mode 100644
index 0000000000..da98c8e8ac
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T18064.script
@@ -0,0 +1,2 @@
+import GHCi.ObjLink
+lookupClosure "blah"
diff --git a/testsuite/tests/ghci/should_run/T18064.stderr b/testsuite/tests/ghci/should_run/T18064.stderr
new file mode 100644
index 0000000000..8edd219551
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T18064.stderr
@@ -0,0 +1,2 @@
+<interactive>: ^^ Could not load 'blah', dependency unresolved. See top entry above.
+
diff --git a/testsuite/tests/ghci/should_run/T18064.stdout b/testsuite/tests/ghci/should_run/T18064.stdout
new file mode 100644
index 0000000000..4a584e4989
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T18064.stdout
@@ -0,0 +1 @@
+Nothing
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index fa4c78cdce..8130d512d4 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -66,3 +66,12 @@ test('T16012', just_ghci, ghci_script, ['T16012.script'])
test('T16096', just_ghci, ghci_script, ['T16096.script'])
test('T507', just_ghci, ghci_script, ['T507.script'])
test('T18027', just_ghci, ghci_script, ['T18027.script'])
+test('T18064',
+ [just_ghci,
+ when(leading_underscore(),skip)
+ # we need to skip otherwise the test fails on platforms prepending leading
+ # underscores to symbols (we get "Could not load '_blah'" instead of "Could
+ # not load 'blah').
+ ],
+ ghci_script,
+ ['T18064.script'])