[Git][ghc/ghc][wip/torsten.schmits/oneshot-bytecode-pkgdeps] test multi-unit build

Torsten Schmits (@torsten.schmits) gitlab at gitlab.haskell.org
Tue Jul 9 16:39:14 UTC 2024



Torsten Schmits pushed to branch wip/torsten.schmits/oneshot-bytecode-pkgdeps at Glasgow Haskell Compiler / GHC


Commits:
bf627100 by Torsten Schmits at 2024-07-09T18:39:08+02:00
test multi-unit build

- - - - -


5 changed files:

- compiler/GHC/Linker/Deps.hs
- testsuite/tests/th/cross-package/Makefile
- testsuite/tests/th/cross-package/all.T
- + testsuite/tests/th/cross-package/unit1
- + testsuite/tests/th/cross-package/unit2


Changes:

=====================================
compiler/GHC/Linker/Deps.hs
=====================================
@@ -392,7 +392,7 @@ oneshot_deps_loop opts (mod : mods) acc = do
       | bytecode
       -- TODO How can we better determine the external deps?
       = [usg_mod | UsagePackageModule {usg_mod} <- mi_usages iface] ++ local
-      | Just _ <- mb_home
+      | is_home
       = local
       | otherwise
       = []


=====================================
testsuite/tests/th/cross-package/Makefile
=====================================
@@ -3,8 +3,10 @@ include $(TOP)/mk/boilerplate.mk
 include $(TOP)/mk/test.mk
 
 # TODO it works even without -package obj, but it should complain about the package not being exposed
-BASIC := $(TEST_HC_OPTS) -this-unit-id=cross -package-db db -package dep -v0
-ARGS := $(BASIC) -fprefer-byte-code -fbyte-code-and-object-code
+DB := -package-db db -package dep
+BASIC := $(TEST_HC_OPTS) $(DB) -this-unit-id=cross -v0
+BC := -fprefer-byte-code -fbyte-code-and-object-code
+ARGS := $(BASIC) $(BC)
 
 .PHONY: CrossPackageArchive
 CrossPackageArchive:
@@ -25,3 +27,11 @@ CrossPackageNoArchive:
 CrossPackageArchiveObjCode:
 	./prep.bash "$(TEST_HC)" "$(TEST_HC_OPTS)" "$(GHC_PKG)" 1
 	./run.bash "$(TEST_HC)" "$(BASIC)"
+
+.PHONY: CrossPackageMultiUnit
+CrossPackageMultiUnit:
+	./prep.bash "$(TEST_HC)" "$(TEST_HC_OPTS)" "$(GHC_PKG)" 1
+	mkdir -p unit2-src/
+	mv CrossLocal.hs CrossNum.hs CrossNum.hs-boot unit2-src/
+	"$(TEST_HC)" $(TEST_HC_OPTS) $(ARGS) -unit @unit1 -unit @unit2
+	./Cross


=====================================
testsuite/tests/th/cross-package/all.T
=====================================
@@ -1,4 +1,4 @@
-def cross_test(suf):
+def cross_test(suf, files = []):
     name = f'CrossPackage{suf}'
     test(
         name,
@@ -15,7 +15,7 @@ def cross_test(suf):
                 'obj.conf',
                 'prep.bash',
                 'run.bash',
-            ]),
+            ] + files),
             use_specs({'stdout': 'CrossPackage.stdout'}),
         ],
         makefile_test,
@@ -26,3 +26,4 @@ cross_test('Archive')
 cross_test('EmptyArchive')
 cross_test('NoArchive')
 cross_test('ArchiveObjCode')
+cross_test('MultiUnit', ['unit1', 'unit2'])


=====================================
testsuite/tests/th/cross-package/unit1
=====================================
@@ -0,0 +1 @@
+-i -i. Cross -this-unit-id unit1 -package-id unit2


=====================================
testsuite/tests/th/cross-package/unit2
=====================================
@@ -0,0 +1 @@
+-i -i./unit2-src CrossLocal CrossNum -this-unit-id unit2



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

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bf627100bb5075d6db0483cb0dd695741ba4c126
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/20240709/e414d031/attachment-0001.html>


More information about the ghc-commits mailing list