diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-01-25 13:01:33 +0100 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-01-25 13:09:46 +0100 |
commit | 05fbce40323bc9e3fb0dab82d6da3e89659bbbea (patch) | |
tree | 623176a30d5253693b454ab0eea799cc1f9c4660 /test/runTests.hs | |
parent | 3ec5a6e4fd8371b1be399888f36cfd0c73c8f87f (diff) |
don't show error message for wip tests
Diffstat (limited to 'test/runTests.hs')
-rw-r--r-- | test/runTests.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/runTests.hs b/test/runTests.hs index 1b4f2e09..a6f26b4d 100644 --- a/test/runTests.hs +++ b/test/runTests.hs | |||
@@ -173,20 +173,22 @@ testFrame Config{..} dirs f tests | |||
173 | = local (const $ ioFetch dirs') | 173 | = local (const $ ioFetch dirs') |
174 | $ forM (zip [1..] (tests :: [TestCasePath])) $ \(i, tn) -> do | 174 | $ forM (zip [1..] (tests :: [TestCasePath])) $ \(i, tn) -> do |
175 | let n = testCaseVal tn | 175 | let n = testCaseVal tn |
176 | er e = return ("\n!Crashed\n" ++ tab e, (,) ErrorCatched <$> tn) | 176 | er e = return (tab "!Crashed" tn e, (,) ErrorCatched <$> tn) |
177 | (runtime, (msg, result)) <- timeOut cfgTimeout ("\n!Timed Out", (,) TimedOut <$> tn) $ catchErr er $ do | 177 | (runtime, (msg, result)) <- timeOut cfgTimeout ("!Timed Out", (,) TimedOut <$> tn) $ catchErr er $ do |
178 | result <- liftIO . evaluate =<< (force <$> action (snd $ fst tn) n) | 178 | result <- liftIO . evaluate =<< (force <$> action (snd $ fst tn) n) |
179 | liftIO $ case result of | 179 | liftIO $ case result of |
180 | Left e -> return ("\n!Failed\n" ++ tab e, (,) Failed <$> tn) | 180 | Left e -> return (tab "!Failed" tn e, (,) Failed <$> tn) |
181 | Right (op, x) -> (,) "" <$> (if cfgReject then alwaysReject else compareResult) tn (pad 15 op) (head dirs' </> (n ++ ".out")) x | 181 | Right (op, x) -> (,) "" <$> (if cfgReject then alwaysReject else compareResult) tn (pad 15 op) (head dirs' </> (n ++ ".out")) x |
182 | liftIO $ putStrLn $ n ++" (" ++ showTime runtime ++ ")" ++ msg | 182 | liftIO $ putStrLn $ n ++" (" ++ showTime runtime ++ ")" ++ if null msg then "" else " " ++ msg |
183 | return $ (,) runtime <$> result | 183 | return $ (,) runtime <$> result |
184 | where | 184 | where |
185 | dirs_ = [takeDirectory f | f <- map testCaseVal tests, takeFileName f /= f] | 185 | dirs_ = [takeDirectory f | f <- map testCaseVal tests, takeFileName f /= f] |
186 | dirs' = dirs ++ dirs_ -- if null dirs_ then dirs else dirs_ | 186 | dirs' = dirs ++ dirs_ -- if null dirs_ then dirs else dirs_ |
187 | action ar n = f ar <$> (Right <$> getDef n "main" Nothing) `catchMM` (return . Left . show) | 187 | action ar n = f ar <$> (Right <$> getDef n "main" Nothing) `catchMM` (return . Left . show) |
188 | 188 | ||
189 | tab = unlines . map (" " ++) . lines | 189 | tab msg tn |
190 | | fst (fst tn) == WorkInProgress = const msg | ||
191 | | otherwise = ((msg ++ "\n") ++) . unlines . map (" " ++) . lines | ||
190 | showTime delta = let t = realToFrac delta :: Double | 192 | showTime delta = let t = realToFrac delta :: Double |
191 | res | t > 1e-1 = printf "%.3fs" t | 193 | res | t > 1e-1 = printf "%.3fs" t |
192 | | t > 1e-3 = printf "%.1fms" (t/1e-3) | 194 | | t > 1e-3 = printf "%.1fms" (t/1e-3) |