Skip to content

Commit

Permalink
testsuite: Add tests for haskell#9467 (base shim, setup qualifier int…
Browse files Browse the repository at this point in the history
…eraction)

This adds two tests for issue haskell#9467
  • Loading branch information
mpickering authored and alt-romes committed Mar 14, 2024
1 parent aaf16c4 commit 73b2db8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ test-suite unit-tests
tasty >= 1.2.3 && <1.6,
tasty-golden >=2.3.1.1 && <2.4,
tasty-quickcheck,
tasty-expected-failure,
tasty-hunit >= 0.10,
tree-diff,
QuickCheck >= 2.14.3 && <2.15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import qualified Distribution.Version as V

-- test-framework
import Test.Tasty as TF
import Test.Tasty.ExpectedFailure

-- Cabal
import Language.Haskell.Extension
Expand Down Expand Up @@ -190,6 +191,9 @@ tests =
, runTest $ mkTest db12 "baseShim4" ["C"] (solverSuccess [("A", 1), ("B", 1), ("C", 1)])
, runTest $ mkTest db12 "baseShim5" ["D"] anySolverFailure
, runTest $ mkTest db12 "baseShim6" ["E"] (solverSuccess [("E", 1), ("syb", 2)])
, expectFailBecause "#9467" $ runTest $ mkTest db12s "baseShim7" ["A"] (solverSuccess [("A", 1)])
, expectFailBecause "#9467" $ runTest $ mkTest db11s "baseShim7-simple" ["A"] (solverSuccess [("A", 1)])
, runTest $ mkTest db12s2 "baseShim8" ["A"] (solverSuccess [("A", 1)])
]
, testGroup
"Base and non-reinstallable"
Expand Down Expand Up @@ -1325,6 +1329,61 @@ db12 =
, Right $ exAv "E" 1 [ExFix "base" 4, ExFix "syb" 2]
]

-- | A version of db12 where the dependency on base happens via a setup dependency
--
-- * The setup dependency is solved in it's own qualified scope, so should be solved
-- independently of the rest of the build plan.
--
-- * The setup dependency depends on `base-3` and hence `syb1`
--
-- * A depends on `base-4` and `syb-2`, should be fine as the setup stanza should
-- be solved independently.
db12s :: ExampleDb
db12s =
let base3 = exInst "base" 3 "base-3-inst" [base4, syb1]
base4 = exInst "base" 4 "base-4-inst" []
syb1 = exInst "syb" 1 "syb-1-inst" [base4]
in [ Left base3
, Left base4
, Left syb1
, Right $ exAv "syb" 2 [ExFix "base" 4]
, Right $
exAv "A" 1 [ExFix "base" 4, ExFix "syb" 2]
`withSetupDeps` [ExFix "base" 3]
]

-- | A version of db11 where the dependency on base happens via a setup dependency
--
-- * The setup dependency is solved in it's own qualified scope, so should be solved
-- independently of the rest of the build plan.
--
-- * The setup dependency depends on `base-3`
--
-- * A depends on `base-4`, should be fine as the setup stanza should
-- be solved independently.
db11s :: ExampleDb
db11s =
let base3 = exInst "base" 3 "base-3-inst" [base4]
base4 = exInst "base" 4 "base-4-inst" []
in [ Left base3
, Left base4
, Right $
exAv "A" 1 [ExFix "base" 4]
`withSetupDeps` [ExFix "base" 3]
]

-- Works without the base-shimness, choosing different versions of base
db12s2 :: ExampleDb
db12s2 =
let base3 = exInst "base" 3 "base-3-inst" []
base4 = exInst "base" 4 "base-4-inst" []
in [ Left base3
, Left base4
, Right $
exAv "A" 1 [ExFix "base" 4]
`withSetupDeps` [ExFix "base" 3]
]

dbBase :: ExampleDb
dbBase =
[ Right $
Expand Down

0 comments on commit 73b2db8

Please sign in to comment.