diff options
author | Andrei Barbu <andrei@0xab.com> | 2021-09-30 17:19:36 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-15 16:33:17 -0500 |
commit | f5a0b408c7e4ef71221eea3ea80ea250fbb28e18 (patch) | |
tree | 31b305405145c022d6aadfd512e83c3184330365 /testsuite | |
parent | 45bd630886157fbe4856594e098202808aedbdd0 (diff) | |
download | haskell-f5a0b408c7e4ef71221eea3ea80ea250fbb28e18.tar.gz |
Plugin load order should follow the commandline order (fixes #17884)
In the past the order was reversed because flags are consed onto a list.
No particular behavior was documented.
We now reverse the flags and document the behavior.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/plugins/Makefile | 10 | ||||
-rw-r--r-- | testsuite/tests/plugins/all.T | 15 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins-order-pragma.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins-order-pragma.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins-order.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins-order.stderr | 9 |
6 files changed, 52 insertions, 1 deletions
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile index 6716aecbfb..7ee0ccbfb7 100644 --- a/testsuite/tests/plugins/Makefile +++ b/testsuite/tests/plugins/Makefile @@ -172,3 +172,13 @@ test-defaulting-plugin: test-defaulting-plugin-fail: -"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 test-defaulting-plugin-fail.hs -package-db defaulting-plugin/pkg.test-defaulting-plugin-fail/local.package.conf +.PHONY: plugins-order +plugins-order: + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 plugins-order.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin ImpurePlugin -fplugin PurePlugin -fplugin-opt ImpurePlugin:First_Option -fplugin-opt PurePlugin:Second_Option -fplugin-opt PurePlugin:Second_Option_2 -fplugin FingerprintPlugin -fplugin-opt FingerprintPlugin:1 + ./plugins-order + +.PHONY: plugins-order-pragma +plugins-order-pragma: + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 plugins-order-pragma.hs -package-db plugin-recomp/pkg.plugins01/local.package.conf -fplugin ImpurePlugin + ./plugins-order-pragma + diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index 2146a2aa43..928bc494eb 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -249,7 +249,6 @@ test('T20417', ], makefile_test, []) - test('T20218', [extra_files(['simple-plugin/']), only_ways([config.ghc_plugin_way]), pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.T20218 TOP={top}'), @@ -275,3 +274,17 @@ test('test-defaulting-plugin-fail', only_ways([config.ghc_plugin_way]), pre_cmd('$MAKE -s --no-print-directory -C defaulting-plugin package.test-defaulting-plugin-fail TOP={top}')], makefile_test, []) + +test('plugins-order', + [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}') + ], + makefile_test, []) + +test('plugins-order-pragma', + [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}') + ], + makefile_test, []) diff --git a/testsuite/tests/plugins/plugins-order-pragma.hs b/testsuite/tests/plugins/plugins-order-pragma.hs new file mode 100644 index 0000000000..eed6008748 --- /dev/null +++ b/testsuite/tests/plugins/plugins-order-pragma.hs @@ -0,0 +1,6 @@ +{-# OPTIONS -fplugin PurePlugin -fplugin-opt ImpurePlugin:First_Option -fplugin-opt PurePlugin:Second_Option -fplugin-opt PurePlugin:Second_Option_2 -fplugin FingerprintPlugin -fplugin-opt FingerprintPlugin:1 #-} + +-- Are plugins loaded in the correct order? +module Main where + +main = pure () diff --git a/testsuite/tests/plugins/plugins-order-pragma.stderr b/testsuite/tests/plugins/plugins-order-pragma.stderr new file mode 100644 index 0000000000..3f77276e4a --- /dev/null +++ b/testsuite/tests/plugins/plugins-order-pragma.stderr @@ -0,0 +1,9 @@ +Simple Plugin Passes Queried +Got options: First_Option +Simple Plugin Passes Queried +Got options: Second_Option Second_Option_2 +Simple Plugin Passes Queried +Got options: 1 +Simple Plugin Pass Run +Simple Plugin Pass Run +Simple Plugin Pass Run diff --git a/testsuite/tests/plugins/plugins-order.hs b/testsuite/tests/plugins/plugins-order.hs new file mode 100644 index 0000000000..105cca3ed0 --- /dev/null +++ b/testsuite/tests/plugins/plugins-order.hs @@ -0,0 +1,4 @@ +-- Are plugins loaded in the correct order? +module Main where + +main = pure () diff --git a/testsuite/tests/plugins/plugins-order.stderr b/testsuite/tests/plugins/plugins-order.stderr new file mode 100644 index 0000000000..3f77276e4a --- /dev/null +++ b/testsuite/tests/plugins/plugins-order.stderr @@ -0,0 +1,9 @@ +Simple Plugin Passes Queried +Got options: First_Option +Simple Plugin Passes Queried +Got options: Second_Option Second_Option_2 +Simple Plugin Passes Queried +Got options: 1 +Simple Plugin Pass Run +Simple Plugin Pass Run +Simple Plugin Pass Run |