Skip to content

Commit a539e49

Browse files
committed
Test configuring a package with a custom-setup that doesn't include Cabal.
1 parent 9ec4028 commit a539e49

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

cabal-install/cabal-install.cabal

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ Extra-Source-Files:
2727
tests/IntegrationTests/custom-setup/Cabal-99998/CabalMessage.hs
2828
tests/IntegrationTests/custom-setup/Cabal-99999/Cabal.cabal
2929
tests/IntegrationTests/custom-setup/Cabal-99999/CabalMessage.hs
30+
tests/IntegrationTests/custom-setup/custom-setup-without-cabal-defaultMain/Setup.hs
31+
tests/IntegrationTests/custom-setup/custom-setup-without-cabal-defaultMain/custom-setup-without-cabal-defaultMain.cabal
32+
tests/IntegrationTests/custom-setup/custom-setup-without-cabal/Setup.hs
33+
tests/IntegrationTests/custom-setup/custom-setup-without-cabal/custom-setup-without-cabal.cabal
3034
tests/IntegrationTests/custom-setup/custom-setup/Setup.hs
3135
tests/IntegrationTests/custom-setup/custom-setup/custom-setup.cabal
36+
tests/IntegrationTests/custom-setup/custom_setup_without_Cabal_doesnt_allow_Cabal_import.sh
37+
tests/IntegrationTests/custom-setup/custom_setup_without_Cabal_doesnt_require_Cabal.sh
3238
tests/IntegrationTests/custom-setup/installs_Cabal_as_setup_dep.sh
3339
tests/IntegrationTests/custom/custom_dep.sh
3440
tests/IntegrationTests/custom/custom_dep/client/B.hs
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import System.Exit
2+
import System.IO
3+
import Distribution.Simple
4+
5+
main = defaultMain
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: custom-setup-without-cabal-defaultMain
2+
version: 1.0
3+
build-type: Custom
4+
cabal-version: >= 1.2
5+
6+
custom-setup
7+
setup-depends: base
8+
9+
library
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import System.Exit
2+
import System.IO
3+
4+
main = hPutStrLn stderr "My custom Setup" >> exitFailure
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: custom-setup-without-cabal
2+
version: 1.0
3+
build-type: Custom
4+
cabal-version: >= 99999
5+
6+
custom-setup
7+
setup-depends: base
8+
9+
library
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
. ./common.sh
2+
cd custom-setup-without-cabal-defaultMain
3+
4+
# This package has explicit setup dependencies that do not include Cabal.
5+
# Compilation should fail because Setup.hs imports Distribution.Simple.
6+
! cabal new-build custom-setup-without-cabal-defaultMain > output 2>&1
7+
cat output
8+
grep -q "\(Could not find module\|Failed to load interface for\).*Distribution\\.Simple" output \
9+
|| die "Should not have been able to import Cabal"
10+
11+
grep -q "It is a member of the hidden package .*Cabal-" output \
12+
|| die "Cabal should be available"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
. ./common.sh
2+
cd custom-setup-without-cabal
3+
4+
# This package has explicit setup dependencies that do not include Cabal.
5+
# new-build should try to build it, even though the cabal-version cannot be
6+
# satisfied by an installed version of Cabal (cabal-version: >= 99999). However,
7+
# configure should fail because Setup.hs just prints an error message and exits.
8+
! cabal new-build custom-setup-without-cabal > output 2>&1
9+
cat output
10+
grep -q "My custom Setup" output \
11+
|| die "Expected output from custom Setup"

0 commit comments

Comments
 (0)