Testsuite driver does not report errors in plugins
When a test defines a plugin and uses it (with {-# OPTIONS_GHC -fplugin=Plugin #-}
), and the plugin doesn't compile, the testsuite driver doesn't report the issues that arose in the compilation of the plugin.
Example: Simon made a change in his Constraint vs Type patch !8750 (merged). This caused an issue with the test-defaulting-plugin
test, which was reported as follows:
=====> 1 of 1 [0, 0, 0]
test-defaulting-plugin(normal) 1 of 1 [0, 0, 0]
Wrong exit code for test-defaulting-plugin()(expected 0 , actual 2 )
Stderr ( test-defaulting-plugin ):
<no location info>: error:
Could not find module 'DefaultLifted'
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
*** unexpected failure for test-defaulting-plugin(normal)
This isn't helpful at all. The actual issue, which can be found by manually attempting to compile the DefaultLifted
plugin, was:
_build/stage1/bin/ghc testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs -package ghc -package containers
[1 of 1] Compiling DefaultLifted ( testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs, testsuite/tests/plugins/defaulting-plugin/DefaultLifted.o )
testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs:20:10: error: [GHC-88464]
Variable not in scope: eqType :: Type -> Type -> Bool
Suggested fix:
Perhaps use one of these:
'seqType' (imported from GHC.Plugins),
data constructor 'Type' (imported from GHC.Plugins),
'hfType' (imported from GHC.Plugins)
|
20 | (==) = eqType
| ^^^^^^
testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs:22:13: error: [GHC-88464]
Variable not in scope: nonDetCmpType :: Type -> Type -> Ordering
|
22 | compare = nonDetCmpType
| ^^^^^^^^^^^^^
So we should make sure that the testsuite driver reports this error instead of the opaque Could not find module 'DefaultLifted'
.