Skip to content

Commit a3026d7

Browse files
mpickeringalt-romes
authored andcommitted
testsuite: Add tests for haskell#9467 (base shim, setup qualifier interaction)
This adds two tests for issue haskell#9467
1 parent e125959 commit a3026d7

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

cabal-install/cabal-install.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ test-suite unit-tests
349349
tasty >= 1.2.3 && <1.6,
350350
tasty-golden >=2.3.1.1 && <2.4,
351351
tasty-quickcheck,
352+
tasty-expected-failure,
352353
tasty-hunit >= 0.10,
353354
tree-diff,
354355
QuickCheck >= 2.14.3 && <2.15

cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import qualified Distribution.Version as V
1313

1414
-- test-framework
1515
import Test.Tasty as TF
16+
import Test.Tasty.ExpectedFailure
1617

1718
-- Cabal
1819
import Language.Haskell.Extension
@@ -190,6 +191,9 @@ tests =
190191
, runTest $ mkTest db12 "baseShim4" ["C"] (solverSuccess [("A", 1), ("B", 1), ("C", 1)])
191192
, runTest $ mkTest db12 "baseShim5" ["D"] anySolverFailure
192193
, runTest $ mkTest db12 "baseShim6" ["E"] (solverSuccess [("E", 1), ("syb", 2)])
194+
, expectFailBecause "#9467" $ runTest $ mkTest db12s "baseShim7" ["A"] (solverSuccess [("A", 1)])
195+
, expectFailBecause "#9467" $ runTest $ mkTest db11s "baseShim7-simple" ["A"] (solverSuccess [("A", 1)])
196+
, runTest $ mkTest db11s2 "baseShim8" ["A"] (solverSuccess [("A", 1)])
193197
]
194198
, testGroup
195199
"Base and non-reinstallable"
@@ -1325,6 +1329,61 @@ db12 =
13251329
, Right $ exAv "E" 1 [ExFix "base" 4, ExFix "syb" 2]
13261330
]
13271331

1332+
-- | A version of db12 where the dependency on base happens via a setup dependency
1333+
--
1334+
-- * The setup dependency is solved in it's own qualified scope, so should be solved
1335+
-- independently of the rest of the build plan.
1336+
--
1337+
-- * The setup dependency depends on `base-3` and hence `syb1`
1338+
--
1339+
-- * A depends on `base-4` and `syb-2`, should be fine as the setup stanza should
1340+
-- be solved independently.
1341+
db12s :: ExampleDb
1342+
db12s =
1343+
let base3 = exInst "base" 3 "base-3-inst" [base4, syb1]
1344+
base4 = exInst "base" 4 "base-4-inst" []
1345+
syb1 = exInst "syb" 1 "syb-1-inst" [base4]
1346+
in [ Left base3
1347+
, Left base4
1348+
, Left syb1
1349+
, Right $ exAv "syb" 2 [ExFix "base" 4]
1350+
, Right $
1351+
exAv "A" 1 [ExFix "base" 4, ExFix "syb" 2]
1352+
`withSetupDeps` [ExFix "base" 3]
1353+
]
1354+
1355+
-- | A version of db11 where the dependency on base happens via a setup dependency
1356+
--
1357+
-- * The setup dependency is solved in it's own qualified scope, so should be solved
1358+
-- independently of the rest of the build plan.
1359+
--
1360+
-- * The setup dependency depends on `base-3`
1361+
--
1362+
-- * A depends on `base-4`, should be fine as the setup stanza should
1363+
-- be solved independently.
1364+
db11s :: ExampleDb
1365+
db11s =
1366+
let base3 = exInst "base" 3 "base-3-inst" [base4]
1367+
base4 = exInst "base" 4 "base-4-inst" []
1368+
in [ Left base3
1369+
, Left base4
1370+
, Right $
1371+
exAv "A" 1 [ExFix "base" 4]
1372+
`withSetupDeps` [ExFix "base" 3]
1373+
]
1374+
1375+
-- Works without the base-shimness, choosing different versions of base
1376+
db11s2 :: ExampleDb
1377+
db11s2 =
1378+
let base3 = exInst "base" 3 "base-3-inst" []
1379+
base4 = exInst "base" 4 "base-4-inst" []
1380+
in [ Left base3
1381+
, Left base4
1382+
, Right $
1383+
exAv "A" 1 [ExFix "base" 4]
1384+
`withSetupDeps` [ExFix "base" 3]
1385+
]
1386+
13281387
dbBase :: ExampleDb
13291388
dbBase =
13301389
[ Right $

0 commit comments

Comments
 (0)