[Git][ghc/ghc][wip/sjakobi/T13729] Add regression test for #13729
Simon Jakobi pushed to branch wip/sjakobi/T13729 at Glasgow Haskell Compiler / GHC Commits: 100877c6 by Simon Jakobi at 2026-03-06T14:50:27+01:00 Add regression test for #13729 Closes #13729. - - - - - 11 changed files: - + testsuite/tests/driver/T13729/Makefile - + testsuite/tests/driver/T13729/Setup.hs - + testsuite/tests/driver/T13729/all.T - + testsuite/tests/driver/T13729/p/Setup.hs - + testsuite/tests/driver/T13729/p/TH.hs - + testsuite/tests/driver/T13729/p/Types.hs - + testsuite/tests/driver/T13729/p/Types2.hs - + testsuite/tests/driver/T13729/p/p.cabal - + testsuite/tests/driver/T13729/q/Main.hs - + testsuite/tests/driver/T13729/q/Setup.hs - + testsuite/tests/driver/T13729/q/q.cabal Changes: ===================================== testsuite/tests/driver/T13729/Makefile ===================================== @@ -0,0 +1,39 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +SETUP='$(PWD)/Setup' -v0 +CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --with-hc-pkg='$(GHC_PKG)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN) + +T13729: + '$(GHC_PKG)' init tmp.d + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup + + # Build package A with the checked-in Foo definition. + rm -rf p/dist + (cd p; $(CONFIGURE) --ipid "A-0.1") + (cd p; $(SETUP) build) + (cd p; $(SETUP) copy) + (cd p; $(SETUP) register) + + # Build package B and record the splice output. + rm -rf q/dist + (cd q; $(CONFIGURE) --ipid "B-0.1") + (cd q; $(SETUP) build) + (cd q; $(SETUP) copy) + (cd q; $(SETUP) register) + ./inst/bin/B > out1 + grep -q Bar out1 + ! grep -q Baz out1 + + # Overwrite Types.hs with the second Foo definition, rebuild A, then rebuild B + # without -fforce-recomp. + cp p/Types2.hs p/Types.hs + (cd p; $(SETUP) build) + (cd p; $(SETUP) copy) + (cd p; $(SETUP) register) + (cd q; $(SETUP) build) + (cd q; $(SETUP) copy) + (cd q; $(SETUP) register) + ./inst/bin/B > out2 + grep -q Baz out2 ===================================== testsuite/tests/driver/T13729/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/driver/T13729/all.T ===================================== @@ -0,0 +1,20 @@ +if config.have_vanilla: + vanilla = '--enable-library-vanilla' +else: + vanilla = '--disable-library-vanilla' + +if config.have_profiling: + prof = '--enable-library-profiling' +else: + prof = '--disable-library-profiling' + +if not config.compiler_profiled and config.have_dynamic: + dyn = '--enable-shared' +else: + dyn = '--disable-shared' + +test('T13729', [extra_files(['p', 'q', 'Setup.hs']), + when(fast(), skip), + js_broken(22349)], + run_command, + ['$MAKE -s --no-print-directory T13729 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn]) ===================================== testsuite/tests/driver/T13729/p/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/driver/T13729/p/TH.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module TH where + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax +import Types + +th_string = lift . show =<< reify ''Foo ===================================== testsuite/tests/driver/T13729/p/Types.hs ===================================== @@ -0,0 +1,3 @@ +module Types where + +data Foo = Bar | Baz ===================================== testsuite/tests/driver/T13729/p/Types2.hs ===================================== @@ -0,0 +1,3 @@ +module Types where + +data Foo = Bar | Baz ===================================== testsuite/tests/driver/T13729/p/p.cabal ===================================== @@ -0,0 +1,10 @@ +cabal-version: 2.2 +name: A +version: 0.1.0.0 +build-type: Simple + +library + exposed-modules: TH, Types + hs-source-dirs: . + build-depends: base >=4.14 && <5, template-haskell + default-language: Haskell2010 ===================================== testsuite/tests/driver/T13729/q/Main.hs ===================================== @@ -0,0 +1,6 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import TH + +main = putStrLn $(th_string) ===================================== testsuite/tests/driver/T13729/q/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/driver/T13729/q/q.cabal ===================================== @@ -0,0 +1,10 @@ +cabal-version: 2.2 +name: B +version: 0.1.0.0 +build-type: Simple + +executable B + main-is: Main.hs + hs-source-dirs: . + build-depends: base >=4.14 && <5, A + default-language: Haskell2010 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/100877c615a5405476a5a7824d64d18e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/100877c615a5405476a5a7824d64d18e... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)