diff options
author | Christiaan Baaij <christiaan.baaij@gmail.com> | 2018-08-01 14:21:22 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-08-01 19:38:48 -0400 |
commit | 52065e95c6df89d0048c6e3f35d6cc26ce8246f9 (patch) | |
tree | 78dac501a71e830bcf175af5b40b19643e17b6ed /testsuite | |
parent | f8618a9b15177ee8c84771b927cb3583c9cd8408 (diff) | |
download | haskell-52065e95c6df89d0048c6e3f35d6cc26ce8246f9.tar.gz |
Plugin dependency information is stored separately
We need to store the used plugins so that we recompile
a module when a plugin that it uses is recompiled.
However, storing the `ModuleName`s of the plugins used by a
module in the `dep_mods` field made the rest of GHC think
that they belong in the HPT, causing at least the issues
reported in #15234
We therefor store the `ModuleName`s of the plugins in a
new field, `dep_plgins`, which is only used the the
recompilation logic.
Reviewers: mpickering, bgamari
Reviewed By: mpickering, bgamari
Subscribers: alpmestan, rwbarton, thomie, carter
GHC Trac Issues: #15234
Differential Revision: https://phabricator.haskell.org/D4937
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/plugins/Makefile | 7 | ||||
-rw-r--r-- | testsuite/tests/plugins/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugin-recomp-change.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugin-recomp/Common.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugin-recomp/Makefile | 7 |
5 files changed, 28 insertions, 3 deletions
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile index 6c823cc5d5..688ac04fb5 100644 --- a/testsuite/tests/plugins/Makefile +++ b/testsuite/tests/plugins/Makefile @@ -105,3 +105,10 @@ plugin-recomp-flags: "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) plugin-recomp-test.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin FingerprintPlugin -fplugin-opt FingerprintPlugin:0 "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) plugin-recomp-test.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin FingerprintPlugin -fplugin-opt FingerprintPlugin:1 "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) plugin-recomp-test.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin FingerprintPlugin -fplugin-opt FingerprintPlugin:1 + +# Should recompile the module because the plugin changed +.PHONY: plugin-recomp-change +plugin-recomp-change: + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 plugin-recomp-test.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin PurePlugin + "$(MAKE)" -s --no-print-directory -C plugin-recomp package.plugins01 TOP=$(TOP) RUN=-DRUN2 + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 plugin-recomp-test.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin PurePlugin diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index ba4b87df29..48efb05f81 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -155,3 +155,9 @@ test('plugin-recomp-flags', pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}') ], run_command, ['$MAKE -s --no-print-directory plugin-recomp-flags']) + +test('plugin-recomp-change', + [extra_files(['plugin-recomp/', 'plugin-recomp-test.hs']), + pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}') + ], + run_command, ['$MAKE -s --no-print-directory plugin-recomp-change']) diff --git a/testsuite/tests/plugins/plugin-recomp-change.stderr b/testsuite/tests/plugins/plugin-recomp-change.stderr new file mode 100644 index 0000000000..91747c8b7d --- /dev/null +++ b/testsuite/tests/plugins/plugin-recomp-change.stderr @@ -0,0 +1,6 @@ +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run 2 diff --git a/testsuite/tests/plugins/plugin-recomp/Common.hs b/testsuite/tests/plugins/plugin-recomp/Common.hs index dc49025c60..ce4f8240c8 100644 --- a/testsuite/tests/plugins/plugin-recomp/Common.hs +++ b/testsuite/tests/plugins/plugin-recomp/Common.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} module Common where import GhcPlugins @@ -13,5 +14,9 @@ install options todos = do mainPass :: ModGuts -> CoreM ModGuts mainPass guts = do +#if defined(RUN2) + putMsgS "Simple Plugin Pass Run 2" +#else putMsgS "Simple Plugin Pass Run" +#endif return guts diff --git a/testsuite/tests/plugins/plugin-recomp/Makefile b/testsuite/tests/plugins/plugin-recomp/Makefile index ae5c24e87f..db2df8dbc8 100644 --- a/testsuite/tests/plugins/plugin-recomp/Makefile +++ b/testsuite/tests/plugins/plugin-recomp/Makefile @@ -1,4 +1,5 @@ TOP=../../.. +RUN=-DRUN1 include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk @@ -12,9 +13,9 @@ package.%: $(MAKE) -s --no-print-directory clean.$* mkdir pkg.$* "$(TEST_HC)" -outputdir pkg.$* --make -v0 -o pkg.$*/setup Setup.hs - + "$(GHC_PKG)" init pkg.$*/local.package.conf - - pkg.$*/setup configure --distdir pkg.$*/dist -v0 $(CABAL_PLUGIN_BUILD) --prefix="$(HERE)/pkg.$*/install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=pkg.$*/local.package.conf $(if $(findstring YES,$(HAVE_PROFILING)), --enable-library-profiling) + + pkg.$*/setup configure --distdir pkg.$*/dist -v0 $(CABAL_PLUGIN_BUILD) --ghc-option="$(RUN)" --prefix="$(HERE)/pkg.$*/install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=pkg.$*/local.package.conf $(if $(findstring YES,$(HAVE_PROFILING)), --enable-library-profiling) pkg.$*/setup build --distdir pkg.$*/dist -v0 pkg.$*/setup install --distdir pkg.$*/dist -v0 |