[Git][ghc/ghc][wip/torsten.schmits/reexport-internal-test] test case for a bug with reexported modules from internal libs

Torsten Schmits (@torsten.schmits) gitlab at gitlab.haskell.org
Fri Sep 27 17:07:13 UTC 2024



Torsten Schmits pushed to branch wip/torsten.schmits/reexport-internal-test at Glasgow Haskell Compiler / GHC


Commits:
939af875 by Torsten Schmits at 2024-09-27T19:07:07+02:00
test case for a bug with reexported modules from internal libs

- - - - -


3 changed files:

- testsuite/tests/driver/T24384/Makefile
- testsuite/tests/driver/T24384/all.T
- + testsuite/tests/driver/T24384/setup-b.sh


Changes:

=====================================
testsuite/tests/driver/T24384/Makefile
=====================================
@@ -8,3 +8,7 @@ T24384:
 	mv B.hs lib/
 	'$(TEST_HC)' A.hs lib/B.hs C.hs D.hs E.hs F.hs F.hs-boot -M -dep-json dep.json -include-pkg-deps -include-cpp-deps -package-db ./db -hide-all-packages -package base -package containers -package template-haskell -package dep -package dep:pub
 	cat dep.json
+
+T24384b:
+	./setup-b.sh "$(TEST_HC)" "$(GHC_PKG)"
+	'$(TEST_HC)' InternalReexport.hs -v0 -M -dep-json dep.json -package-db ./db -hide-all-packages -package base -package dep


=====================================
testsuite/tests/driver/T24384/all.T
=====================================
@@ -16,3 +16,11 @@ test('T24384',
       ],
      makefile_test,
      [])
+
+test('T24384b',
+     [extra_files([
+         'setup-b.sh',
+         ]),
+      ],
+     makefile_test,
+     [])


=====================================
testsuite/tests/driver/T24384/setup-b.sh
=====================================
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+
+set -eu
+
+ghc_cmd="$1"
+ghc_pkg_cmd="$2"
+
+base="$PWD"
+db="$base/db"
+dep="$base/dep"
+conf_dep="${dep}/dep.conf"
+int="$base/int"
+conf_int="${int}/int.conf"
+lib_tag="ghc$($ghc_cmd --numeric-version)"
+
+ghc_pkg()
+{
+  eval "${ghc_pkg_cmd at Q} --no-user-package-db --package-db=${db at Q} $@"
+}
+
+ghc()
+{
+  eval "${ghc_cmd at Q} $@"
+}
+
+mkdir -p "$dep" "$int" "$db"
+
+cat > "$dep/DepA.hs" <<EOF
+module DepA where
+EOF
+
+cat > "$int/DepB.hs" <<EOF
+module DepB where
+EOF
+
+cat > "$conf_dep" <<'EOF'
+name: dep
+package-name: dep
+version: 1.0
+id: dep-1.0-z
+key: dep-1.0-z
+depends: dep-1.0-int
+exposed: True
+exposed-modules:
+  DepA,
+  DepB from dep-1.0-int:DepB
+import-dirs: ${pkgroot}/dep
+library-dirs: ${pkgroot}/dep
+hs-libraries: HSdep-1.0-z
+EOF
+
+cat > "$conf_int" <<'EOF'
+name: z-dep-z-int
+package-name: dep
+lib-name: int
+version: 1.0
+id: dep-1.0-int
+key: dep-1.0-int
+exposed-modules: DepB
+import-dirs: ${pkgroot}/int
+library-dirs: ${pkgroot}/int
+hs-libraries: HSdep-1.0-int
+EOF
+
+ghc_pkg recache
+
+ghc "-v0 -package-db ${db at Q} -hidir ${int at Q} -O0 -this-unit-id dep-1.0-int -dynamic -shared ${int at Q}/DepB.hs -o ${int at Q}/libHSdep-1.0-int-${lib_tag}.so"
+ghc "-v0 -package-db ${db at Q} -hidir ${dep at Q} -O0 -this-unit-id dep-1.0-z -dynamic -shared ${dep at Q}/DepA.hs -o ${dep at Q}/libHSdep-1.0-z-${lib_tag}.so"
+
+ghc_pkg -v0 register "${conf_int at Q}"
+ghc_pkg -v0 register "${conf_dep at Q}"
+
+cat > InternalReexport.hs <<EOF
+module InternalReexport where
+import DepB
+EOF



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/939af8751b01ddc6bce6f355e420a68de9c1970e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/939af8751b01ddc6bce6f355e420a68de9c1970e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240927/667f622c/attachment-0001.html>


More information about the ghc-commits mailing list