[Git][ghc/ghc][master] testsuite: Fix racing prints in T21465

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Mar 30 05:41:41 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
a5360490 by Ben Gamari at 2023-03-30T01:41:25-04:00
testsuite: Fix racing prints in T21465

As noted in #23155, we previously failed to add flushes necessary to
ensure predictable output.

Fixes #23155.

- - - - -


3 changed files:

- testsuite/tests/rts/T21465/T21465.hs
- testsuite/tests/rts/T21465/T21465.stdout
- testsuite/tests/rts/T21465/T21465_c.c


Changes:

=====================================
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 ()
 


=====================================
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.


=====================================
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);
 }



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a5360490949533933dc8d76237ea87d920d7e311

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a5360490949533933dc8d76237ea87d920d7e311
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230330/75e6d698/attachment-0001.html>


More information about the ghc-commits mailing list