Allow expected failures to be ignored

This commit is contained in:
Trevor Elliott 2015-03-30 16:58:33 -07:00
parent 2bba4a6871
commit 3ca8746eb3
2 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,8 @@ ARCH := $(shell uname -m)
TESTS ?= issues regression renamer mono-binds
TEST_DIFF ?= meld
IGNORE_EXPECTED ?= --ignore-expected
CABAL_BUILD_FLAGS ?= -j
CABAL_INSTALL_FLAGS ?= $(CABAL_BUILD_FLAGS)
@ -230,6 +232,7 @@ test: ${CS_BIN}/cryptol-test-runner
-r output \
-T --hide-successes \
-T --jxml=$(call adjust-path,$(CURDIR)/results.xml) \
$(IGNORE_EXPECTED) \
$(if $(TEST_DIFF),-p $(TEST_DIFF),) \
)

View File

@ -61,6 +61,7 @@ data Options = Options
, optResultDir :: FilePath
, optTests :: [FilePath]
, optDiff :: Maybe String
, optIgnoreExpected :: Bool
} deriving (Show)
defaultOptions :: Options
@ -71,6 +72,7 @@ defaultOptions = Options
, optResultDir = "output"
, optTests = []
, optDiff = Nothing
, optIgnoreExpected = False
}
setHelp :: Endo Options
@ -92,6 +94,10 @@ addTestFile :: String -> Endo Options
addTestFile path =
Endo (\ opts -> opts { optTests = path : optTests opts })
setIgnoreExpected :: Endo Options
setIgnoreExpected =
Endo (\ opts -> opts { optIgnoreExpected = True })
options :: [OptDescr (Endo Options)]
options =
[ Option "c" ["cryptol"] (ReqArg setCryptol "PATH")
@ -102,6 +108,8 @@ options =
"use this diffing program on failures"
, Option "T" [] (ReqArg addOther "STRING")
"add an argument to pass to the test-runner main"
, Option "i" ["ignore-expected"] (NoArg setIgnoreExpected)
"ignore expected failures"
, Option "h" ["help"] (NoArg setHelp)
"display this message"
]
@ -201,7 +209,8 @@ generateAssertion opts dir file = testCase file $ do
(_,diffOut,_) <- readProcessWithExitCode "diff" [ goldFile', resultOut ] ""
assertFailure diffOut
Right fail_msg -> assertFailure fail_msg
Right fail_msg | optIgnoreExpected opts -> return ()
| otherwise -> assertFailure fail_msg
-- Test Discovery --------------------------------------------------------------