[commit: ghc] master: Make T8761 deterministic, I hope (7843c71)
git at git.haskell.org
git at git.haskell.org
Mon Jun 27 07:42:06 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/7843c71c7e48cdba115bef422184e855ede23a67/ghc
>---------------------------------------------------------------
commit 7843c71c7e48cdba115bef422184e855ede23a67
Author: Simon Marlow <marlowsd at gmail.com>
Date: Sun Jun 26 06:53:56 2016 +0100
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
>---------------------------------------------------------------
7843c71c7e48cdba115bef422184e855ede23a67
testsuite/tests/th/T8761.hs | 14 +++++++-------
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 c0c96b9..b8177ff 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 2ecf495..6a7af1e 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
More information about the ghc-commits
mailing list