diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-03-28 09:52:34 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-03-30 01:41:25 -0400 |
commit | a5360490949533933dc8d76237ea87d920d7e311 (patch) | |
tree | 8a306e1e322f2126db8f46ad15d99b4025fef6fa | |
parent | f4f1f14f8009c3c120b8b963ec130cbbc774ec02 (diff) | |
download | haskell-a5360490949533933dc8d76237ea87d920d7e311.tar.gz |
testsuite: Fix racing prints in T21465
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); } |