Skip to content

Add test case for backjumping when dependencies are not linked #3363

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 1 commit into from
Apr 20, 2016
Merged
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
Expand Up @@ -133,6 +133,8 @@ tests = [
, runTest $ indep $ mkTest db17 "indepGoals2" ["A", "B"] (Just [("A", 1), ("B", 1), ("C", 1), ("D", 1)])
, expectFail $
runTest $ indep $ mkTest db19 "indepGoals3" ["D", "E", "F"] Nothing -- The target order is important.
, expectFail $
runTest $ indep $ mkTest db20 "indepGoals4" ["C", "A", "B"] (Just [("A", 1), ("B", 1), ("C", 1), ("D", 1), ("D", 2)])
]
]
where
Expand Down Expand Up @@ -651,6 +653,24 @@ db19 = [
, Right $ exAv "F" 1 [ExAny "A", ExAny "B"]
]

-- | This database tests that the solver correctly backjumps when dependencies
-- of linked packages are not linked. It is an example where the conflict set
-- from enforcing the single instance restriction is not sufficient. See pull
-- request #3327.
--
-- When C, A, and B are installed as independent goals, the solver first
-- chooses 0.C-1 and 0.D-2. When choosing dependencies for A and B, it links
-- 1.D and 2.D to 0.D. Finally, the solver discovers the test's constraint on
-- D. It must backjump to try 1.D-1 and then link 2.D to 1.D.
db20 :: ExampleDb
db20 = [
Right $ exAv "A" 1 [ExAny "B"]
, Right $ exAv "B" 1 [ExAny "D"] `withTest` ExTest "test" [ExFix "D" 1]
, Right $ exAv "C" 1 [ExFix "D" 2]
, Right $ exAv "D" 1 []
, Right $ exAv "D" 2 []
]

dbExts1 :: ExampleDb
dbExts1 = [
Right $ exAv "A" 1 [ExExt (EnableExtension RankNTypes)]
Expand Down