Commit 553959f8 authored by kristenk's avatar kristenk
Browse files

Evaluate solver result in quickcheck tests to force install plan validation.

Previously, the tests only evaluated enough of the result to determine whether
the solver found an install plan, but that install plan could be invalid.
parent c36d11ff
......@@ -516,6 +516,7 @@ Test-Suite solver-quickcheck
bytestring,
Cabal,
containers,
deepseq >= 1.2,
mtl,
pretty,
process,
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module UnitTests.Distribution.Solver.Modular.QuickCheck (tests) where
import Control.DeepSeq (NFData, force)
import Control.Monad (foldM)
import Data.Either (lefts)
import Data.Function (on)
import Data.List (groupBy, isInfixOf, nub, nubBy, sort)
import Data.Maybe (isJust)
import GHC.Generics (Generic)
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>), (<*>))
......@@ -111,7 +114,10 @@ solve enableBj reorder indep solver targets (TestDb db) =
| otherwise = OtherFailure
in Result {
resultLog = lg
, resultPlan = either (Left . failure) (Right . extractInstallPlan) result
, resultPlan =
-- Force the result so that we check for internal errors when we check
-- for success or failure. See D.C.Dependency.validateSolverResult.
force $ either (Left . failure) (Right . extractInstallPlan) result
}
-- | How to modify the order of the input targets.
......@@ -130,7 +136,9 @@ data Result = Result {
}
data Failure = BackjumpLimitReached | OtherFailure
deriving (Eq, Show)
deriving (Eq, Generic, Show)
instance NFData Failure
-- | Package name.
newtype PN = PN { unPN :: String }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment