summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-23 15:46:19 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-26 15:10:09 -0500
commit217546a798e1eb5a931a677771bbd54bb0e4b5ee (patch)
tree985d94084bc7da043ecdefa6c90fb13319055c02
parent43b13ed33f50274383a8dce11cbd7c77b8e851d5 (diff)
downloadhaskell-217546a798e1eb5a931a677771bbd54bb0e4b5ee.tar.gz
testsuite: Flush stdout buffers in InitEventLogging
Otherwise we are sensitive to libc's buffering strategy. Similar to the issue fixed in 543dfaab166c81f46ac4af76918ce32190aaab22.
-rw-r--r--testsuite/tests/rts/InitEventLogging.hs4
-rw-r--r--testsuite/tests/rts/InitEventLogging.stdout1
-rw-r--r--testsuite/tests/rts/InitEventLogging_c.c4
3 files changed, 7 insertions, 2 deletions
diff --git a/testsuite/tests/rts/InitEventLogging.hs b/testsuite/tests/rts/InitEventLogging.hs
index 1ec1e65028..83d49d20cc 100644
--- a/testsuite/tests/rts/InitEventLogging.hs
+++ b/testsuite/tests/rts/InitEventLogging.hs
@@ -1,11 +1,13 @@
{-# LANGUAGE ForeignFunctionInterface #-}
+import System.IO
+
-- Test that the startEventLog interface works as expected.
main :: IO ()
main = do
putStrLn "Starting eventlog..."
+ hFlush stdout
c_init_eventlog
- putStrLn "done"
foreign import ccall unsafe "init_eventlog"
c_init_eventlog :: IO ()
diff --git a/testsuite/tests/rts/InitEventLogging.stdout b/testsuite/tests/rts/InitEventLogging.stdout
index 7cbab8fe59..ef5ce6f2d3 100644
--- a/testsuite/tests/rts/InitEventLogging.stdout
+++ b/testsuite/tests/rts/InitEventLogging.stdout
@@ -1,5 +1,4 @@
Starting eventlog...
-done
init
write
write
diff --git a/testsuite/tests/rts/InitEventLogging_c.c b/testsuite/tests/rts/InitEventLogging_c.c
index 47e4520fc4..369a4f010f 100644
--- a/testsuite/tests/rts/InitEventLogging_c.c
+++ b/testsuite/tests/rts/InitEventLogging_c.c
@@ -3,19 +3,23 @@
void test_init(void) {
printf("init\n");
+ fflush(stdout);
}
bool test_write(void *eventlog, size_t eventlog_size) {
printf("write\n");
+ fflush(stdout);
return true;
}
void test_flush(void) {
printf("flush\n");
+ fflush(stdout);
}
void test_stop(void) {
printf("stop\n");
+ fflush(stdout);
}
const EventLogWriter writer = {