Add “Ignore warning” option to cabal check
[cabal.git] / cabal-testsuite / PackageTests / Regression / T5782Diamond / cabal.test.hs
blob410a0eba1f1a02cdb66923e241a1c39aa7253735
1 -- When Module.f is changed, with cabal <= 3.2 this non-deterministically fails
2 -- to compile and, if it doesn't fail, it also non-deterministically gives
3 -- a wrong answer (ignoring the change to Module.f in the output, despite
4 -- recompiling, so probably the wrong library is linked in); when running
5 -- manually on my machine, three changes to Module.hs are enough to trigger
6 -- the error, often two are enough, even with cabal 3.2, even to get
7 -- compilation error
8 -- "Ambiguous module name `Module': it was found in multiple packages: issue5782-0.1 issue5782-0.1"
9 -- not only the wrong result from exe run.
11 -- The dummy "--installdir=." is needed for cabal <= 3.2
12 -- and also to match cabal output on different OSes
13 -- (default installdir is different on various OSes).
15 -- `withShorterPathForNewBuildStore` is needed to avoid some path mismatches, etc.,
16 -- in the output, but MacOS still insists on processing internal libraries
17 -- in a different order and Windows additionally still can't recognize
18 -- the paths match. Hence `recordMode DoNotRecord` to mute the output,
19 -- which is fine in this case, because the problem manifests either
20 -- as failed compilation or wrong exe output, which I do check.
22 import Test.Cabal.Prelude
23 main = withShorterPathForNewBuildStore $ \storeDir ->
24 cabalTest $
25 withSourceCopy . withDelay $ do
26 writeSourceFile "issue5782/src/Module.hs" "module Module where\nf = \"AAA\""
27 recordMode DoNotRecord $
28 cabalG ["--store-dir=" ++ storeDir, "--installdir=" ++ storeDir, "--overwrite-policy=always"] "v2-install" ["issue5782"]
29 withPlan $
30 runPlanExe' "issue5782" "E" []
31 >>= assertOutputContains "AAA"
32 delay
33 writeSourceFile "issue5782/src/Module.hs" "module Module where\nf = \"BBB\""
34 recordMode DoNotRecord $
35 cabalG ["--store-dir=" ++ storeDir, "--installdir=" ++ storeDir, "--overwrite-policy=always"] "v2-install" ["issue5782"]
36 withPlan $
37 runPlanExe' "issue5782" "E" []
38 >>= assertOutputContains "BBB"
39 writeSourceFile "issue5782/src/Module.hs" "module Module where\nf = \"CCC\""
40 delay -- different spot to try another scenario
41 recordMode DoNotRecord $
42 cabalG ["--store-dir=" ++ storeDir, "--installdir=" ++ storeDir, "--overwrite-policy=always"] "v2-install" ["issue5782"]
43 withPlan $
44 runPlanExe' "issue5782" "E" []
45 >>= assertOutputContains "CCC"