forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using different Cabal library versions for
cabal-install
test…
…s with custom setup. The idea here is to pass a `--package-db` flag to `cabal-install` which contains just `Cabal` and `Cabal-syntax` of the specific version. This allows `cabal-install` tests to use the in-tree `Cabal` version, something which you can easily run into and get very confused about when writing tests. There are a few options which can be passed to `cabal-tests` executable to control which Cabal library you will test against. 1. --boot-cabal-lib specifies to use the Cabal library bundled with the test compiler, this is the default and existing behaviour of the testsuite. 2. --intree-cabal-lib=<root_dir> specifies to use Cabal and Cabal-syntax from a specific directory, and `--test-tmp` indicates where to put the package database they are built with. 3. --specific-cabal-lib=<VERSION> specifies to use a specific Cabal version from hackage (ie 3.10.2.0) and installs the package database into --test-tmp=<DIR> The end result is that changes in the Cabal library can be tested with cabal-install tests in the testsuite. There have been a number of confusing issues with people writing tests for changes in the Cabal library which never ran because of cabal-install tests always used the boot Cabal library (see haskell#9425 for one). Fixes haskell#9681
- Loading branch information
1 parent
4d6375f
commit 93bd6bf
Showing
19 changed files
with
134 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Test.Cabal.Prelude | ||
main = setupTest $ do | ||
skipUnless "no Cabal for GHC" =<< hasCabalForGhc | ||
setup' "configure" [] >>= assertOutputContains "ThisIsCustomYeah" | ||
setup' "build" [] >>= assertOutputContains "ThisIsCustomYeah" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import Test.Cabal.Prelude | ||
-- Test internal custom preprocessor | ||
main = setupTest $ do | ||
skipUnless "no Cabal for GHC" =<< hasCabalForGhc | ||
setup_build [] | ||
runExe' "hello-world" [] | ||
>>= assertOutputContains "hello from A" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import Test.Cabal.Prelude | ||
main = setupTest $ do | ||
recordMode DoNotRecord $ do | ||
skipUnless "no Cabal for GHC" =<< hasCabalForGhc | ||
setup' "configure" ["--enable-tests", "--enable-coverage"] >>= assertOutputContains "ThisIsCustomYeah" | ||
setup' "build" [] | ||
setup' "test" [] >>= assertOutputContains "Package coverage report written to" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +0,0 @@ | ||
# cabal v2-update | ||
Downloading the latest package list from test-local-repo | ||
# cabal v2-repl | ||
Resolving dependencies... | ||
Error: [Cabal-7107] | ||
Could not resolve dependencies: | ||
[__0] trying: pkg-a-0 (user goal) | ||
[__1] next goal: pkg-a:setup.Cabal (dependency of pkg-a) | ||
[__1] rejecting: pkg-a:setup.Cabal-<VERSION>/installed-<HASH>, pkg-a:setup.Cabal-3.8.0.0 (constraint from --enable-multi-repl requires >=3.11) | ||
[__1] fail (backjumping, conflict set: pkg-a, pkg-a:setup.Cabal) | ||
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: pkg-a:setup.Cabal (3), pkg-a (2) | ||
6 changes: 4 additions & 2 deletions
6
cabal-testsuite/PackageTests/MultiRepl/CabalTooOld/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ withRepo "repo" $ do | ||
main = cabalTest $ recordMode DoNotRecord . withRepo "repo" $ do | ||
-- For the multi-repl command | ||
skipUnlessGhcVersion ">= 9.4" | ||
void $ fails $ cabalWithStdin "v2-repl" ["--keep-temp-files","--enable-multi-repl","pkg-a", "pkg-b"] "" | ||
res <- fails $ cabalWithStdin "v2-repl" ["--keep-temp-files","--enable-multi-repl","pkg-a", "pkg-b"] "" | ||
assertOutputContains "constraint from --enable-multi-repl requires >=3.11" res |
2 changes: 1 addition & 1 deletion
2
cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-packagedbs.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import Test.Cabal.Prelude | ||
main = cabalTest $ do | ||
withPackageDb $ do | ||
noCabalPackageDb . withPackageDb $ do | ||
withDirectory "p-no-package-dbs" $ do | ||
res <- fails $ cabal' "v2-build" [] | ||
assertOutputContains "No package databases have been specified." res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
cabal-testsuite/PackageTests/TestSuiteTests/LibV09/setup-deadlock.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Test.Cabal.Prelude | ||
main = setupAndCabalTest $ do | ||
skipUnless "no Cabal for GHC" =<< hasCabalForGhc | ||
setup_build ["--enable-tests"] | ||
fails $ setup "test" [] |
1 change: 0 additions & 1 deletion
1
cabal-testsuite/PackageTests/TestSuiteTests/LibV09/setup.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Test.Cabal.Prelude | ||
-- Test if detailed-0.9 builds correctly | ||
main = setupAndCabalTest $ do | ||
skipUnless "no Cabal for GHC" =<< hasCabalForGhc | ||
setup_build ["--enable-tests"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters