Skip to content

Commit

Permalink
Fix AutogenModulesToggling test
Browse files Browse the repository at this point in the history
By converting this to a setupTest we use the in-tree Cabal library
rather than relying on a proxy of the GHC version to provide the right
Cabal library version.

Supercedes haskell#9398
  • Loading branch information
mpickering committed Nov 6, 2023
1 parent 15b5b05 commit 7263bd4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
32 changes: 22 additions & 10 deletions cabal-testsuite/PackageTests/AutogenModulesToggling/cabal.out
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# cabal v2-run
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- test-0.1 (exe:autogen-toggle-test) (first run)
# Setup configure
Configuring test-0.1...
# Setup build
Preprocessing library for test-0.1...
Building library for test-0.1...
Preprocessing executable 'autogen-toggle-test' for test-0.1...
Building executable 'autogen-toggle-test' for test-0.1...
# Setup copy
Installing library in <PATH>
Installing executable autogen-toggle-test in <PATH>
Warning: The directory <ROOT>/cabal.dist/usr/bin is not in the system search path.
# Setup register
Registering library for test-0.1...
# autogen-toggle-test
-----BEGIN CABAL OUTPUT-----
The module says: Real module, ship to production
# cabal v2-run
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- test-0.1 (exe:autogen-toggle-test) (configuration changed)
-----END CABAL OUTPUT-----
# Setup configure
Configuring test-0.1...
# Setup build
Preprocessing library for test-0.1...
Building library for test-0.1...
Preprocessing executable 'autogen-toggle-test' for test-0.1...
Building executable 'autogen-toggle-test' for test-0.1...
# Setup copy
Installing library in <PATH>
Installing executable autogen-toggle-test in <PATH>
Warning: The directory <ROOT>/cabal.dist/usr/bin is not in the system search path.
# Setup register
Registering library for test-0.1...
# autogen-toggle-test
-----BEGIN CABAL OUTPUT-----
The module says: Prebuilt module, don't use in production
-----END CABAL OUTPUT-----
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import Test.Cabal.Prelude

main :: IO ()
main = cabalTest . recordMode RecordMarked $ do
skipUnlessGhcVersion ">= 9.7"
cabal "v2-run" ["-fgenerate", "autogen-toggle-test"]
cabal "v2-run" ["-f-generate", "autogen-toggle-test"]
main = setupTest . withPackageDb $ do
setup_install ["-fgenerate"]
r1 <- runInstalledExe' "autogen-toggle-test" []
setup_install ["-f-generate"]
r2 <- runInstalledExe' "autogen-toggle-test" []
assertOutputContains "Real module, ship to production" r1
assertOutputContains "Prebuilt module, don't use in production" r2

0 comments on commit 7263bd4

Please sign in to comment.