diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-03-28 09:52:34 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-03-29 14:14:40 -0400 |
commit | 6ac4ca8f2ccc05dfb75d4625431181d69bbfd41d (patch) | |
tree | c568fe729211fd06324093c5839a0c3f4aac7399 | |
parent | 30d45e971d94b3c28296a3f20f94275f38bc89d1 (diff) | |
download | haskell-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.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/rts/T21465/T21465.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/T21465/T21465_c.c | 1 |
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); } |