Skip to content

Restore a few integration test comments and new-build package arguments. #4924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Test.Cabal.Prelude
main = cabalTest $ do
r <- fails $ cabal' "new-build" []

-- This package has explicit setup dependencies that do not include Cabal.
-- new-build should try to build it, but configure should fail because
-- Setup.hs just prints an error message and exits.
r <- fails $ cabal' "new-build" ["custom-setup-without-cabal"]
assertOutputContains "My custom Setup" r
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Test.Cabal.Prelude
main = cabalTest $ do
r <- fails $ cabal' "new-build" []

-- This package has explicit setup dependencies that do not include Cabal.
-- Compilation should fail because Setup.hs imports Distribution.Simple.
r <- fails $ cabal' "new-build" ["custom-setup-without-cabal-defaultMain"]
assertRegex "Should not have been able to import Cabal"
"(Could not find module|Failed to load interface for).*Distribution\\.Simple" r
{-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Cabal
version: 99998
version: 1.2
build-type: Simple
cabal-version: >= 1.2

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module CabalMessage where

message = "This is Cabal-1.2"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Cabal
version: 99999
version: 2.0
build-type: Simple
cabal-version: >= 1.2

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module CabalMessage where

message = "This is Cabal-2.0"

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions cabal-testsuite/PackageTests/Regression/T3436/cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- Cabal-99999 (lib:Cabal) (first run)
- Cabal-2.0 (lib:Cabal) (first run)
- custom-setup-1.0 (lib:custom-setup) (first run)
Configuring Cabal-99999...
Preprocessing library for Cabal-99999..
Building library for Cabal-99999..
Configuring Cabal-2.0...
Preprocessing library for Cabal-2.0..
Building library for Cabal-2.0..
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages: custom-setup Cabal-99999
packages: custom-setup Cabal-2.0
6 changes: 3 additions & 3 deletions cabal-testsuite/PackageTests/Regression/T3436/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Test.Cabal.Prelude
main = cabalTest $ do
-- NB: This test doesn't really test #3436, because Cabal-99998
-- NB: This test doesn't really test #3436, because Cabal-1.2
-- isn't in the system database and thus we can't see if the
-- depsolver incorrectly chooses it. Worth fixing if we figure
-- out how to simulate the "global" database without root.
r <- fails $ cabal' "new-build" ["all"]
assertOutputContains "This is Cabal-99999" r
r <- fails $ cabal' "new-build" ["custom-setup"]
assertOutputContains "This is Cabal-2.0" r
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version: 1.0
build-type: Custom

custom-setup
setup-depends: base, Cabal >= 99999
setup-depends: base, Cabal >= 2.0

library
16 changes: 8 additions & 8 deletions cabal-testsuite/PackageTests/Regression/T3436/sandbox.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal install
Resolving dependencies...
Configuring Cabal-99998...
Preprocessing library for Cabal-99998..
Building library for Cabal-99998..
Configuring Cabal-1.2...
Preprocessing library for Cabal-1.2..
Building library for Cabal-1.2..
Installing library in <PATH>
Installed Cabal-99998
Installed Cabal-1.2
# cabal sandbox add-source
# cabal install
Resolving dependencies...
Configuring Cabal-99999...
Preprocessing library for Cabal-99999..
Building library for Cabal-99999..
Configuring Cabal-2.0...
Preprocessing library for Cabal-2.0..
Building library for Cabal-2.0..
Installing library in <PATH>
Installed Cabal-99999
Installed Cabal-2.0
Failed to install custom-setup-1.0
cabal: Error: some packages failed to install:
custom-setup-1.0-92JpsxIMpiQHysxYdDtEVq failed during the configure step. The exception was:
Expand Down
20 changes: 17 additions & 3 deletions cabal-testsuite/PackageTests/Regression/T3436/sandbox.test.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import Test.Cabal.Prelude

-- Regression test for issue #3436
--
-- #3436 occurred when a package with a custom setup specified a 'cabal-version'
-- that was newer than the version of the installed Cabal library, even though
-- the solver didn't choose the installed Cabal for the package's setup script.
--
-- This test installs a fake Cabal-1.2 and then tries to build the package
-- custom-setup, which depends on a fake Cabal-2.0 (through cabal-version and
-- setup-depends).
main = cabalTest $ do
withSandbox $ do
cabal "install" ["./Cabal-99998"]
cabal_sandbox "add-source" ["Cabal-99999"]
cabal "install" ["./Cabal-1.2"]
cabal_sandbox "add-source" ["Cabal-2.0"]

-- cabal should build custom-setup's setup script with Cabal-2.0, but
-- then configure should fail because Setup just prints an error message
-- imported from Cabal and exits.
r <- fails $ cabal' "install" ["custom-setup/"]
assertOutputContains "This is Cabal-99999" r
assertOutputContains "This is Cabal-2.0" r