Commit 46a72e75 authored by Camil Staps's avatar Camil Staps 🍃

Fix fromJust runtime error when child gives unreadable messages

parent 06c34c0a
Pipeline #12737 passed with stage
in 37 seconds
...@@ -311,9 +311,9 @@ where ...@@ -311,9 +311,9 @@ where
// Check child output // Check child output
# (continue,output,io,w) = readPipes output pio io w # (continue,output,io,w) = readPipes output pio io w
| isError continue = return (Failed Nothing) r io w | isError continue = return (Failed Nothing) r io w
| continue =: (Ok False) | continue=:(Ok False)
# results = map (fromJSON o fromString) $ filter ((<>) "") output.lines # results = map (fromJSON o fromString) $ filter ((<>) "") output.lines
# ee = mergeResults $ map fromJust results # ee = collectEvents $ map fromJust results
= return ee.event r io w = return ee.event r io w
// Check if child has terminated // Check if child has terminated
# (t,w) = checkProcess h w # (t,w) = checkProcess h w
...@@ -346,7 +346,7 @@ where ...@@ -346,7 +346,7 @@ where
| size s <= n = s | size s <= n = s
| otherwise = s % (0,n-4) +++ "..." | otherwise = s % (0,n-4) +++ "..."
= return event r io w = return event r io w
# ee = mergeResults $ map fromJust results # ee = collectEvents $ map fromJust results
# io = emit (EndEvent ee) io # io = emit (EndEvent ee) io
| fromJust rcode <> 0 | fromJust rcode <> 0
# event = Failed Nothing # event = Failed Nothing
...@@ -361,8 +361,8 @@ where ...@@ -361,8 +361,8 @@ where
# w = snd $ fclose io w # w = snd $ fclose io w
= redirect output h pio r w = redirect output h pio r w
where where
mergeResults :: [TestEvent] -> EndEvent collectEvents :: [TestEvent] -> EndEvent
mergeResults tes = collectEvents tes =
{ name = r.TestRun.name { name = r.TestRun.name
, event = if (isEmpty failed && isEmpty lost) Passed , event = if (isEmpty failed && isEmpty lost) Passed
(Failed $ Just $ FailedChildren $ (Failed $ Just $ FailedChildren $
...@@ -401,7 +401,7 @@ where ...@@ -401,7 +401,7 @@ where
| not continue && opts.stop_on_first_failure | not continue && opts.stop_on_first_failure
-> (continue, io) -> (continue, io)
-> case fromJSON $ fromString s of -> case fromJSON $ fromString s of
Nothing -> (False, io) Nothing -> (True, io)
Just ev -> (not $ ev=:(EndEvent {event=Failed _}), emit ev io)) Just ev -> (not $ ev=:(EndEvent {event=Failed _}), emit ev io))
output output
(True, io) (True, io)
......
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