diff options
author | Simon Marlow <marlowsd@gmail.com> | 2016-06-26 06:53:56 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-06-27 08:45:55 +0100 |
commit | 7843c71c7e48cdba115bef422184e855ede23a67 (patch) | |
tree | df8e3a8777620f8b3e3b06228fe6a6e00fb3d73c | |
parent | da60e3e94ea3e737609444615f61649121782a1a (diff) | |
download | haskell-7843c71c7e48cdba115bef422184e855ede23a67.tar.gz |
Make T8761 deterministic, I hope
Summary:
T8761 seems to get different interleaving in its output on
Phabricator, so this switches it to use stderr consistently.
Test Plan: worksforme
Reviewers: goldfire, austin, bgamari, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2363
-rw-r--r-- | testsuite/tests/th/T8761.hs | 14 | ||||
-rw-r--r-- | testsuite/tests/th/T8761.stderr | 13 |
2 files changed, 13 insertions, 14 deletions
diff --git a/testsuite/tests/th/T8761.hs b/testsuite/tests/th/T8761.hs index c0c96b96b5..b8177ff3ee 100644 --- a/testsuite/tests/th/T8761.hs +++ b/testsuite/tests/th/T8761.hs @@ -34,7 +34,7 @@ do pats <- sequence [prefixPat, infixPat, recordPat] -- pretty print the pattern synonyms: - mapM_ (runIO . putStrLn . pprint) pats + mapM_ (runIO . hPutStrLn stderr . pprint) pats -- splice in the pattern synonyms return pats @@ -108,10 +108,10 @@ getY1' = y1 ((1, 2), [3]) -- should yield 3 do infos <- mapM reify [ 'P, 'Pe, 'Pu, 'Pue, 'Pur, 'Purp , 'Pure, 'Purep, 'Pep, 'Pup, 'Puep ] - mapM_ (runIO . putStrLn . pprint) infos - runIO $ hFlush stdout - -- GHC does not guarantee to do this after TH code. In particular - -- when the output is going to a file, and we're using GHC with - -- the runtime linker or with -fexternal-interpreter, stdout will - -- not get flushed. + mapM_ (runIO . hPutStrLn stderr . pprint) infos + -- NB. use stderr rather than stdout, because GHC does not + -- guarantee to flush stdout after TH code. In particular when + -- the output is going to a file, and we're using GHC with the + -- runtime linker or with -fexternal-interpreter, stdout will not + -- get flushed. [d| theAnswerIs = 42 |] diff --git a/testsuite/tests/th/T8761.stderr b/testsuite/tests/th/T8761.stderr index 2ecf495e47..6a7af1e9e3 100644 --- a/testsuite/tests/th/T8761.stderr +++ b/testsuite/tests/th/T8761.stderr @@ -1,3 +1,7 @@ +pattern Q1 x1_0 x2_1 x3_2 <- ((x1_0, x2_1), [x3_2], _, _) +pattern x1_0 Q2 x2_1 = ((x1_0, x2_1)) +pattern Q3 {qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where + Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3]) T8761.hs:(16,1)-(39,13): Splicing declarations do { [qx1, qy1, qz1] <- mapM (\ i -> newName $ "x" ++ show i) [1, 2, 3]; @@ -25,7 +29,7 @@ T8761.hs:(16,1)-(39,13): Splicing declarations = patSynD nm3 (recordPatSyn [qx3, qy3, qz3]) (explBidir [cls]) patP; pats <- sequence [prefixPat, infixPat, recordPat]; - mapM_ (runIO . putStrLn . pprint) pats; + mapM_ (runIO . hPutStrLn stderr . pprint) pats; return pats } ======> pattern Q1 x1 x2 x3 <- ((x1, x2), [x3], _, _) @@ -119,10 +123,6 @@ T8761.hs:(71,1)-(105,39): Splicing declarations pattern Pup x <- MkUnivProv x pattern Puep :: forall a. forall b. Show b => a -> b -> (ExProv, a) pattern Puep x y <- (MkExProv y, x) -pattern Q1 x1_0 x2_1 x3_2 <- ((x1_0, x2_1), [x3_2], _, _) -pattern x1_0 Q2 x2_1 = ((x1_0, x2_1)) -pattern Q3 {qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where - Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3]) pattern T8761.P :: GHC.Types.Bool pattern T8761.Pe :: () => forall (a0_0 :: *) . a0_0 -> T8761.Ex pattern T8761.Pu :: forall (a0_0 :: *) . a0_0 -> a0_0 @@ -152,8 +152,7 @@ T8761.hs:(108,1)-(117,25): Splicing declarations reify ['P, 'Pe, 'Pu, 'Pue, 'Pur, 'Purp, 'Pure, 'Purep, 'Pep, 'Pup, 'Puep]; - mapM_ (runIO . putStrLn . pprint) infos; - runIO $ hFlush stdout; + mapM_ (runIO . hPutStrLn stderr . pprint) infos; [d| theAnswerIs = 42 |] } ======> theAnswerIs = 42 |