summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-03-28 09:52:34 -0400
committerBen Gamari <ben@smart-cactus.org>2023-03-29 14:14:40 -0400
commit6ac4ca8f2ccc05dfb75d4625431181d69bbfd41d (patch)
treec568fe729211fd06324093c5839a0c3f4aac7399
parent30d45e971d94b3c28296a3f20f94275f38bc89d1 (diff)
downloadhaskell-wip/T23155.tar.gz
testsuite: Fix racing prints in T21465wip/T23155
As noted in #23155, we previously failed to add flushes necessary to ensure predictable output. Fixes #23155.
-rw-r--r--testsuite/tests/rts/T21465/T21465.hs4
-rw-r--r--testsuite/tests/rts/T21465/T21465.stdout2
-rw-r--r--testsuite/tests/rts/T21465/T21465_c.c1
3 files changed, 5 insertions, 2 deletions
diff --git a/testsuite/tests/rts/T21465/T21465.hs b/testsuite/tests/rts/T21465/T21465.hs
index 1465359054..4346f06d9d 100644
--- a/testsuite/tests/rts/T21465/T21465.hs
+++ b/testsuite/tests/rts/T21465/T21465.hs
@@ -1,10 +1,12 @@
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
+import System.IO
+
foreign import ccall "test_c" testC :: IO ()
helper :: IO ()
-helper = putStrLn "This is the helper function"
+helper = putStrLn "This is the helper function" >> hFlush stdout
foreign export ccall helper :: IO ()
diff --git a/testsuite/tests/rts/T21465/T21465.stdout b/testsuite/tests/rts/T21465/T21465.stdout
index 2ae74934f3..bb8fe2203d 100644
--- a/testsuite/tests/rts/T21465/T21465.stdout
+++ b/testsuite/tests/rts/T21465/T21465.stdout
@@ -1,5 +1,4 @@
This is the helper function
-Done.
0: 01 01
1: 02 02
2: 03 03
@@ -16,3 +15,4 @@ Done.
13: 0e 0e
14: 0f 0f
15: 10 10
+Done.
diff --git a/testsuite/tests/rts/T21465/T21465_c.c b/testsuite/tests/rts/T21465/T21465_c.c
index 3351027a91..dc93e6becf 100644
--- a/testsuite/tests/rts/T21465/T21465_c.c
+++ b/testsuite/tests/rts/T21465/T21465_c.c
@@ -25,4 +25,5 @@ void test_c() {
for (int i = 0; i < 16; i++) {
printf("%2i: %02x %02x\n", i, blah[i], foo[i]);
}
+ fflush(stdout);
}