summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKevin Buhr <buhr@asaurus.net>2019-05-03 18:15:44 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-09 18:42:57 -0400
commit9d238791862e8b128d397a1c0317986ea82ed000 (patch)
treea1dd2557a5be4ea1d2548638f7d4cdd785e8b335 /testsuite
parentb9fe91fce5cf5ab233ab48a64e6a49caf1beced3 (diff)
downloadhaskell-9d238791862e8b128d397a1c0317986ea82ed000.tar.gz
Handle trailing path separator in package DB names (#16360)
Package DB directories with trailing separator (provided via GHC_PACKAGE_PATH or via -package-db) resulted in incorrect calculation of ${pkgroot} substitution variable. Keep the trailing separator while resolving as directory or file, but remove it before dropping the last path component with takeDirectory. Closes #16360.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/driver/T16360/Hello.hs3
-rw-r--r--testsuite/tests/driver/T16360/Makefile17
-rw-r--r--testsuite/tests/driver/T16360/all.T1
-rw-r--r--testsuite/tests/driver/T16360/test/Test.hs4
-rw-r--r--testsuite/tests/driver/T16360/test/test.pkg8
5 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/driver/T16360/Hello.hs b/testsuite/tests/driver/T16360/Hello.hs
new file mode 100644
index 0000000000..56109fa8bf
--- /dev/null
+++ b/testsuite/tests/driver/T16360/Hello.hs
@@ -0,0 +1,3 @@
+import Test
+
+main = print test
diff --git a/testsuite/tests/driver/T16360/Makefile b/testsuite/tests/driver/T16360/Makefile
new file mode 100644
index 0000000000..67dcf80ba8
--- /dev/null
+++ b/testsuite/tests/driver/T16360/Makefile
@@ -0,0 +1,17 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+LOCAL_PKGCONF=package.conf.d
+
+clean:
+ rm -f test/*.o test/*.hi *.o *.hi
+ rm -rf $(LOCAL_PKGCONF)
+
+.PHONY: T16360
+T16360:
+ @rm -rf $(LOCAL_PKGCONF)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -this-unit-id test-1.0 -c test/Test.hs
+ "$(GHC_PKG)" init $(LOCAL_PKGCONF)
+ "$(GHC_PKG)" --no-user-package-db -f $(LOCAL_PKGCONF) register test/test.pkg -v0
+ "$(TEST_HC)" $(TEST_HC_OPTS) -package-db $(LOCAL_PKGCONF)/ -c Hello.hs
diff --git a/testsuite/tests/driver/T16360/all.T b/testsuite/tests/driver/T16360/all.T
new file mode 100644
index 0000000000..1cc19459f9
--- /dev/null
+++ b/testsuite/tests/driver/T16360/all.T
@@ -0,0 +1 @@
+test('T16360', [extra_files(['Hello.hs', 'test/'])], makefile_test, [])
diff --git a/testsuite/tests/driver/T16360/test/Test.hs b/testsuite/tests/driver/T16360/test/Test.hs
new file mode 100644
index 0000000000..b4d7f27dce
--- /dev/null
+++ b/testsuite/tests/driver/T16360/test/Test.hs
@@ -0,0 +1,4 @@
+module Test where
+
+test :: Int
+test = 42
diff --git a/testsuite/tests/driver/T16360/test/test.pkg b/testsuite/tests/driver/T16360/test/test.pkg
new file mode 100644
index 0000000000..f925cfe2d9
--- /dev/null
+++ b/testsuite/tests/driver/T16360/test/test.pkg
@@ -0,0 +1,8 @@
+name: test
+version: 1.0
+id: test-1.0
+key: test-1.0
+exposed-modules: Test
+import-dirs: ${pkgroot}/test
+library-dirs: ${pkgroot}/test
+exposed: True