From efb6a30f0b70948ba51497bf2831e009ec6e1378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Tue, 11 Dec 2018 18:36:00 -0500 Subject: Fix recompilation checking of pure plugins Previously when switching from using a Plugin with `RecompMaybe`/`ForceRecompile` in `pluginRecompile` to a Plugin with `NoForceRecompile` GHC would never even consider recompiling. However the previously active plugin could have modified the compilation output so we should recompile. Test Plan: validate Reviewers: bgamari, mpickering Subscribers: mpickering, rwbarton, carter GHC Trac Issues: #15858 Differential Revision: https://phabricator.haskell.org/D5299 --- testsuite/tests/plugins/T15858.script | 33 +++++++++++++++++++++++++++++++++ testsuite/tests/plugins/T15858.stderr | 21 +++++++++++++++++++++ testsuite/tests/plugins/all.T | 8 ++++++++ 3 files changed, 62 insertions(+) create mode 100644 testsuite/tests/plugins/T15858.script create mode 100644 testsuite/tests/plugins/T15858.stderr (limited to 'testsuite') diff --git a/testsuite/tests/plugins/T15858.script b/testsuite/tests/plugins/T15858.script new file mode 100644 index 0000000000..77a1b53557 --- /dev/null +++ b/testsuite/tests/plugins/T15858.script @@ -0,0 +1,33 @@ +:set -fobject-code +-- ^ Without this no recompilation happens at all in ghci, but that's a bug for +-- another ticket. + +:l plugin-recomp-test.hs + +-- switching to an impure plugin triggers recomp. +:! echo ==ImpurePlugin.0 >&2 +:set -fclear-plugins -fplugin ImpurePlugin +:l plugin-recomp-test.hs + +-- ..forever, this also triggers recomp. +:! echo ==ImpurePlugin.1 >&2 +:l plugin-recomp-test.hs + +-- switching from impure to pure plugin triggers recomp. +:! echo ==PurePlugin.0 >&2 +:set -fclear-plugins -fplugin PurePlugin +:l plugin-recomp-test.hs + +-- switching to a fingerprint plugin triggers recomp. +:! echo ==FingerprintPlugin.0 >&2 +:set -fclear-plugins -fplugin FingerprintPlugin +:l plugin-recomp-test.hs + +-- same fingerprint plugin doesn't trigger recomp. +:! echo ==FingerprintPlugin.1 >&2 +:l plugin-recomp-test.hs + +-- switching from fingerprint to pure plugin triggers recomp. +:! echo ==PurePlugin.1 >&2 +:set -fclear-plugins -fplugin PurePlugin +:l plugin-recomp-test.hs diff --git a/testsuite/tests/plugins/T15858.stderr b/testsuite/tests/plugins/T15858.stderr new file mode 100644 index 0000000000..db0610f587 --- /dev/null +++ b/testsuite/tests/plugins/T15858.stderr @@ -0,0 +1,21 @@ +==ImpurePlugin.0 +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +==ImpurePlugin.1 +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +==PurePlugin.0 +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +==FingerprintPlugin.0 +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +==FingerprintPlugin.1 +==PurePlugin.1 +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run \ No newline at end of file diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index 72a42da91a..3b031668bb 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -199,3 +199,11 @@ test('static-plugins', extra_run_opts('"' + config.libdir + '"')], compile_and_run, ['-package ghc -isimple-plugin/']) + +test('T15858', + [extra_files(['plugin-recomp/', 'plugin-recomp-test.hs']), +# only_ways([config.ghc_plugin_way]), + pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}'), + extra_hc_opts("-package-db plugin-recomp/pkg.plugins01/local.package.conf ") + ], + ghci_script, ['T15858.script']) -- cgit v1.2.1