[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: 9cd32e92 by Simon Jakobi at 2026-03-06T15:05:27+01:00 Add regression test for #13729 Closes #13729. - - - - - 11 changed files: - + testsuite/tests/driver/T13729/A/Setup.hs - + testsuite/tests/driver/T13729/A/TH.hs - + testsuite/tests/driver/T13729/A/Types1.hs - + testsuite/tests/driver/T13729/A/Types2.hs - + testsuite/tests/driver/T13729/A/p.cabal - + testsuite/tests/driver/T13729/B/Main.hs - + testsuite/tests/driver/T13729/B/Setup.hs - + testsuite/tests/driver/T13729/B/q.cabal - + testsuite/tests/driver/T13729/Makefile - + testsuite/tests/driver/T13729/Setup.hs - + testsuite/tests/driver/T13729/all.T Changes: ===================================== testsuite/tests/driver/T13729/A/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/driver/T13729/A/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/A/Types1.hs ===================================== @@ -0,0 +1,3 @@ +module Types where + +data Foo = Bar ===================================== testsuite/tests/driver/T13729/A/Types2.hs ===================================== @@ -0,0 +1,3 @@ +module Types where + +data Foo = Bar | Baz ===================================== testsuite/tests/driver/T13729/A/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/B/Main.hs ===================================== @@ -0,0 +1,6 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import TH + +main = putStrLn $(th_string) ===================================== testsuite/tests/driver/T13729/B/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/driver/T13729/B/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 ===================================== testsuite/tests/driver/T13729/Makefile ===================================== @@ -0,0 +1,40 @@ +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 first Foo definition. + rm -rf A/dist + cp A/Types1.hs A/Types.hs + (cd A; $(CONFIGURE) --ipid "A-0.1") + (cd A; $(SETUP) build) + (cd A; $(SETUP) copy) + (cd A; $(SETUP) register) + + # Build package B and record the splice output. + rm -rf B/dist + (cd B; $(CONFIGURE) --ipid "B-0.1") + (cd B; $(SETUP) build) + (cd B; $(SETUP) copy) + (cd B; $(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 A/Types2.hs A/Types.hs + (cd A; $(SETUP) build) + (cd A; $(SETUP) copy) + (cd A; $(SETUP) register) + (cd B; $(SETUP) build) + (cd B; $(SETUP) copy) + (cd B; $(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(['A', 'B', 'Setup.hs']), + when(fast(), skip), + js_broken(22349)], + run_command, + ['$MAKE -s --no-print-directory T13729 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn]) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd32e925ab5f27225ae1af534ae5ccb... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd32e925ab5f27225ae1af534ae5ccb... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)