summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-12-11 18:36:00 -0500
committerBen Gamari <ben@smart-cactus.org>2018-12-12 23:25:02 -0500
commitefb6a30f0b70948ba51497bf2831e009ec6e1378 (patch)
treed39e605b08ddda0c44f8de95ccf9adb65a0af7ae /testsuite/tests/plugins
parentf0eb404e1b5b296048da3d0b9efe42d5aa9e0f1d (diff)
downloadhaskell-efb6a30f0b70948ba51497bf2831e009ec6e1378.tar.gz
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
Diffstat (limited to 'testsuite/tests/plugins')
-rw-r--r--testsuite/tests/plugins/T15858.script33
-rw-r--r--testsuite/tests/plugins/T15858.stderr21
-rw-r--r--testsuite/tests/plugins/all.T8
3 files changed, 62 insertions, 0 deletions
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'])