[Git][ghc/ghc][wip/alpine-ci] 2 commits: testsuite: Ensure that ffi005 output order is predictable

Ben Gamari gitlab at gitlab.haskell.org
Tue Jun 11 21:49:04 UTC 2019



Ben Gamari pushed to branch wip/alpine-ci at Glasgow Haskell Compiler / GHC


Commits:
e8e0e7c8 by Ben Gamari at 2019-06-11T21:48:57Z
testsuite: Ensure that ffi005 output order is predictable

The libc output buffer wasn't being flushed, making the order
system-depedent.

- - - - -
6f12aa63 by Ben Gamari at 2019-06-11T21:48:57Z
XXX: Test alpine job

- - - - -


5 changed files:

- .gitlab-ci.yml
- testsuite/tests/ffi/should_run/all.T
- testsuite/tests/ffi/should_run/ffi005.hs
- testsuite/tests/ffi/should_run/ffi005.stdout
- + testsuite/tests/ffi/should_run/ffi005_c.c


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -541,7 +541,7 @@ release-x86_64-linux-deb8:
 
 release-x86_64-linux-alpine:
   extends: .validate-linux
-  stage: full-build
+  stage: lint
   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine:$DOCKER_REV"
   variables:
     BUILD_SPHINX_PDF: "NO"
@@ -549,8 +549,6 @@ release-x86_64-linux-alpine:
     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-alpine-linux.tar.xz"
     # Can't use ld.gold due to #13958.
     CONFIGURE_ARGS: "--disable-ld-override"
-  only:
-    - tags
   cache:
     key: linux-x86_64-alpine
   artifacts:


=====================================
testsuite/tests/ffi/should_run/all.T
=====================================
@@ -32,7 +32,7 @@ test('ffi005', [ omit_ways(prof_ways),
                  when(arch('i386'), skip),
                  when(platform('i386-apple-darwin'), expect_broken(4105)),
                  exit_code(3) ],
-               compile_and_run, [''])
+               compile_and_run, ['ffi005_c.c'])
 
 test('ffi006', normal, compile_and_run, [''])
 


=====================================
testsuite/tests/ffi/should_run/ffi005.hs
=====================================
@@ -20,10 +20,12 @@ main = do
 --  putStrLn $ "errno == " ++ show err
 
   putStrLn "\nTesting puts (and withString)"
-  withCString "Test successful" puts
+  hFlush stdout
+  withCString "Test puts successful" puts
+  flushStdout  -- Flush the libc output buffer
 
   putStrLn "\nTesting peekArray0"
-  s <- withCString "Test successful" (peekArray0 (castCharToCChar '\0'))
+  s <- withCString "Test peekArray0 successful" (peekArray0 (castCharToCChar '\0'))
   putStr (map castCCharToChar s)
 
 -- disabled due to use of non-portable constants in arguments to open:
@@ -71,6 +73,7 @@ withBuffer sz m = do
   return s
 
 foreign import ccall puts :: CString -> IO CInt
+foreign import ccall "flush_stdout" flushStdout :: IO ()
 
 -- foreign import ccall "open" open'  :: CString -> CInt -> IO CInt
 -- foreign import ccall "open" open2' :: CString -> CInt -> CInt -> IO CInt


=====================================
testsuite/tests/ffi/should_run/ffi005.stdout
=====================================
@@ -3,9 +3,10 @@ Testing sin==mysin (should return lots of Trues)
 [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
 
 Testing puts (and withString)
+Test puts successful
 
 Testing peekArray0
-Test successful
+Test peekArray0 successful
 Testing sin==dynamic_sin (should return lots of Trues)
 [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
 
@@ -16,4 +17,3 @@ Testing sin==Id wrapped_sin (should return lots of Trues)
 [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
 
 Testing exit
-Test successful


=====================================
testsuite/tests/ffi/should_run/ffi005_c.c
=====================================
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void flush_stdout(void)
+{
+    fflush(stdout);
+}



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/915a704255539d70e975af4bf46523ef5e6479c6...6f12aa63c67f8d252f0ad0487a031abb01beadc6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/915a704255539d70e975af4bf46523ef5e6479c6...6f12aa63c67f8d252f0ad0487a031abb01beadc6
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/20190611/50a1ca0e/attachment-0001.html>


More information about the ghc-commits mailing list