[Git][ghc/ghc][wip/alpine-ci] 11 commits: gitlab-ci: Lint testsuite for framework failures

Ben Gamari gitlab at gitlab.haskell.org
Sat Jun 15 20:56:54 UTC 2019



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


Commits:
503e830c by Ben Gamari at 2019-06-15T03:10:08Z
gitlab-ci: Lint testsuite for framework failures

This introduces a new lint job checking for framework failures and
listing broken tests.

- - - - -
b5ea9323 by Ben Gamari at 2019-06-15T03:10:08Z
lint: Only apply --interactive lint to testsuite .T files

- - - - -
5c97211c by Ben Gamari at 2019-06-15T03:10:08Z
gitlab-ci: Lint the linters

- - - - -
257165b4 by Alp Mestanogullari at 2019-06-15T03:10:46Z
Remove duplicates from 'ghc --info' output

- - - - -
5da6c86f by Ben Gamari at 2019-06-15T19:14:01Z
Bump unix submodule

Skips `executeFile001` test in `threaded2` way. Fixes #16814.

- - - - -
30b285cd by Ben Gamari at 2019-06-15T20:56:42Z
base/Event/Poll: Drop POLLRDHUP enum item

Previously the Event enumeration produced by hsc2hs would sometimes
include a currently-unused POLLRDHUP item. This unused binding would
result in a build failure. Drop it.

- - - - -
3f039dca by Ben Gamari at 2019-06-15T20:56:42Z
testsuite: Fix T8602 on musl

Musl wants hash-bangs on all executables.

- - - - -
b9feae53 by Ben Gamari at 2019-06-15T20:56:42Z
testsuite: Ensure T5423 flushes C output buffer

Previously T5423 would fail to flush the printf output buffer.
Consequently it was platform-dependent whether the C or Haskell print
output would be emitted first.

- - - - -
be4532be by Ben Gamari at 2019-06-15T20:56:42Z
testsuite: Flush conc059's printf buffer

Otherwise it the order out the Haskell and C output will be
system-dependent.

- - - - -
f17f1938 by Ben Gamari at 2019-06-15T20:56:42Z
testsuite: Ensure that ffi005 output order is predictable

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

- - - - -
823b3e80 by Ben Gamari at 2019-06-15T20:56:42Z
gitlab-ci: Build alpine release bindists

- - - - -


19 changed files:

- .gitlab-ci.yml
- .gitlab/linters/check-makefiles.py
- .gitlab/linters/linter.py
- compiler/main/DynFlags.hs
- libraries/base/GHC/Event/Poll.hsc
- libraries/unix
- testsuite/driver/runtests.py
- testsuite/mk/test.mk
- testsuite/tests/concurrent/should_run/conc059.stdout
- testsuite/tests/concurrent/should_run/conc059_c.c
- testsuite/tests/driver/T8602/T8602.script
- 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
- testsuite/tests/rts/Makefile
- testsuite/tests/rts/T5423.hs
- testsuite/tests/rts/T5423.stdout
- + testsuite/tests/rts/T5423_c.c


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -27,6 +27,7 @@ stages:
   - hackage    # head.hackage testing
   - deploy     # push documentation
 
+# N.B.Don't run on wip/ branches, instead on run on merge requests.
 .only-default: &only-default
   only:
     - master
@@ -70,10 +71,31 @@ ghc-linters:
     refs:
       - merge_requests
 
+lint-linters:
+  <<: *only-default
+  stage: lint
+  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
+  script:
+    - mypy .gitlab/linters/*.py
+  dependencies: []
+  tags:
+    - lint
+
+lint-testsuite:
+  <<: *only-default
+  stage: lint
+  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
+  script:
+    - make -Ctestsuite list_broken TEST_HC=ghc
+  dependencies: []
+  tags:
+    - lint
+
 # We allow the submodule checker to fail when run on merge requests (to
 # accomodate, e.g., haddock changes not yet upstream) but not on `master` or
 # Marge jobs.
 .lint-submods:
+  <<: *only-default
   stage: lint
   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
   script:
@@ -118,6 +140,7 @@ lint-submods-branch:
       - /ghc-[0-9]+\.[0-9]+/
 
 .lint-changelogs:
+  <<: *only-default
   stage: lint
   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
   dependencies: []
@@ -554,6 +577,30 @@ release-x86_64-linux-deb8:
     when: always
     expire_in: 2 week
 
+#################################
+# x86_64-linux-alpine
+#################################
+
+release-x86_64-linux-alpine:
+  extends: .validate-linux
+  stage: full-build
+  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine:$DOCKER_REV"
+  # There are currently a few failing tests
+  allow_failure: true
+  variables:
+    BUILD_SPHINX_PDF: "NO"
+    TEST_ENV: "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:
+    when: always
+    expire_in: 2 week
+
 #################################
 # x86_64-linux-centos7
 #################################


=====================================
.gitlab/linters/check-makefiles.py
=====================================
@@ -12,9 +12,10 @@ from linter import run_linters, RegexpLinter
 
 linters = [
     RegexpLinter(r'--interactive',
-                 message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`.",
-                 path_filter = lambda path: path == 'Makefile')
+                 message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`."
+                ).add_path_filter(lambda path: path.suffix == '.T')
 ]
 
 if __name__ == '__main__':
-    run_linters(linters, subdir='testsuite')
+    run_linters(linters,
+                subdir='testsuite')


=====================================
.gitlab/linters/linter.py
=====================================
@@ -7,10 +7,11 @@ import sys
 import re
 import textwrap
 import subprocess
-from typing import List, Optional
+from pathlib import Path
+from typing import List, Optional, Callable, Sequence
 from collections import namedtuple
 
-def lint_failure(file, line_no, line_content, message):
+def lint_failure(file, line_no: int, line_content: str, message: str):
     """ Print a lint failure message. """
     wrapper = textwrap.TextWrapper(initial_indent='  ',
                                    subsequent_indent='    ')
@@ -29,7 +30,7 @@ def lint_failure(file, line_no, line_content, message):
 
     print(textwrap.dedent(msg))
 
-def get_changed_files(base_commit, head_commit,
+def get_changed_files(base_commit: str, head_commit: str,
                       subdir: str = '.'):
     """ Get the files changed by the given range of commits. """
     cmd = ['git', 'diff', '--name-only',
@@ -46,12 +47,21 @@ class Linter(object):
     """
     def __init__(self):
         self.warnings = [] # type: List[Warning]
+        self.path_filters = [] # type: List[Callable[[Path], bool]]
 
     def add_warning(self, w: Warning):
         self.warnings.append(w)
 
-    def lint(self, path):
-        pass
+    def add_path_filter(self, f: Callable[[Path], bool]) -> "Linter":
+        self.path_filters.append(f)
+        return self
+
+    def do_lint(self, path: Path):
+        if all(f(path) for f in self.path_filters):
+            self.lint(path)
+
+    def lint(self, path: Path):
+        raise NotImplementedError
 
 class LineLinter(Linter):
     """
@@ -59,33 +69,32 @@ class LineLinter(Linter):
     the given line from a file and calls :func:`add_warning` for any lint
     issues found.
     """
-    def lint(self, path):
-        if os.path.isfile(path):
-            with open(path, 'r') as f:
+    def lint(self, path: Path):
+        if path.is_file():
+            with path.open('r') as f:
                 for line_no, line in enumerate(f):
                     self.lint_line(path, line_no+1, line)
 
-    def lint_line(self, path, line_no, line):
-        pass
+    def lint_line(self, path: Path, line_no: int, line: str):
+        raise NotImplementedError
 
 class RegexpLinter(LineLinter):
     """
     A :class:`RegexpLinter` produces the given warning message for
     all lines matching the given regular expression.
     """
-    def __init__(self, regex, message, path_filter=lambda path: True):
+    def __init__(self, regex: str, message: str):
         LineLinter.__init__(self)
         self.re = re.compile(regex)
         self.message = message
-        self.path_filter = path_filter
 
-    def lint_line(self, path, line_no, line):
-        if self.path_filter(path) and self.re.search(line):
+    def lint_line(self, path: Path, line_no: int, line: str):
+        if self.re.search(line):
             w = Warning(path=path, line_no=line_no, line_content=line[:-1],
                         message=self.message)
             self.add_warning(w)
 
-def run_linters(linters: List[Linter],
+def run_linters(linters: Sequence[Linter],
                 subdir: str = '.') -> None:
     import argparse
     parser = argparse.ArgumentParser()
@@ -97,7 +106,7 @@ def run_linters(linters: List[Linter],
         if path.startswith('.gitlab/linters'):
             continue
         for linter in linters:
-            linter.lint(path)
+            linter.do_lint(Path(path))
 
     warnings = [warning
                 for linter in linters


=====================================
compiler/main/DynFlags.hs
=====================================
@@ -5664,10 +5664,6 @@ compilerInfo dflags
        ("Have interpreter",            showBool $ platformMisc_ghcWithInterpreter $ platformMisc dflags),
        ("Object splitting supported",  showBool False),
        ("Have native code generator",  showBool $ platformMisc_ghcWithNativeCodeGen $ platformMisc dflags),
-       ("Support SMP",                 showBool $ platformMisc_ghcWithSMP $ platformMisc dflags),
-       ("Tables next to code",         showBool $ platformMisc_tablesNextToCode $ platformMisc dflags),
-       ("RTS ways",                    platformMisc_ghcRTSWays $ platformMisc dflags),
-       ("RTS expects libdw",           showBool $ platformMisc_ghcRtsWithLibdw $ platformMisc dflags),
        -- Whether or not we support @-dynamic-too@
        ("Support dynamic-too",         showBool $ not isWindows),
        -- Whether or not we support the @-j@ flag with @--make at .
@@ -5694,7 +5690,6 @@ compilerInfo dflags
        ("GHC Dynamic",                 showBool dynamicGhc),
        -- Whether or not GHC was compiled using -prof
        ("GHC Profiled",                showBool rtsIsProfiled),
-       ("Leading underscore",          showBool $ platformMisc_leadingUnderscore $ platformMisc dflags),
        ("Debug on",                    show debugIsOn),
        ("LibDir",                      topDir dflags),
        -- The path of the global package database used by GHC


=====================================
libraries/base/GHC/Event/Poll.hsc
=====================================
@@ -162,24 +162,12 @@ newtype Event = Event CShort
              , FiniteBits -- ^ @since 4.7.0.0
              )
 
--- We have to duplicate the whole enum like this in order for the
--- hsc2hs cross-compilation mode to work
-#if defined(POLLRDHUP)
 #{enum Event, Event
  , pollIn    = POLLIN
  , pollOut   = POLLOUT
- , pollRdHup = POLLRDHUP
  , pollErr   = POLLERR
  , pollHup   = POLLHUP
  }
-#else
-#{enum Event, Event
- , pollIn    = POLLIN
- , pollOut   = POLLOUT
- , pollErr   = POLLERR
- , pollHup   = POLLHUP
- }
-#endif
 
 fromEvent :: E.Event -> Event
 fromEvent e = remap E.evtRead  pollIn .|.


=====================================
libraries/unix
=====================================
@@ -1 +1 @@
-Subproject commit 3985f63a35235ce5e10a4cb6f532c1041f466372
+Subproject commit bd2631b375f8c2e1d9f6c778065d0ef699cf853a


=====================================
testsuite/driver/runtests.py
=====================================
@@ -350,7 +350,7 @@ for name in config.only:
 if config.list_broken:
     print('')
     print('Broken tests:')
-    print(' '.join(map (lambda bdn: '#' + str(bdn[0]) + '(' + bdn[1] + '/' + bdn[2] + ')', brokens)))
+    print('\n  '.join(map (lambda bdn: '#' + str(bdn[0]) + '(' + bdn[1] + '/' + bdn[2] + ')', brokens)))
     print('')
 
     if t.framework_failures:


=====================================
testsuite/mk/test.mk
=====================================
@@ -81,7 +81,11 @@ endif
 
 RUNTEST_OPTS += -e "ghc_compiler_always_flags='$(TEST_HC_OPTS)'"
 
-RUNTEST_OPTS += -e config.compiler_debugged=$(GhcDebugged)
+ifeq "$(GhcDebugged)" "YES"
+RUNTEST_OPTS += -e "config.compiler_debugged=True"
+else
+RUNTEST_OPTS += -e "config.compiler_debugged=False"
+endif
 
 ifeq "$(GhcWithNativeCodeGen)" "YES"
 RUNTEST_OPTS += -e ghc_with_native_codegen=True


=====================================
testsuite/tests/concurrent/should_run/conc059.stdout
=====================================
@@ -1,3 +1,3 @@
-500000
 exiting...
+500000
 exited.


=====================================
testsuite/tests/concurrent/should_run/conc059_c.c
=====================================
@@ -16,6 +16,7 @@ int main(int argc, char *argv[])
     usleep(100000);
 #endif
     printf("exiting...\n");
+    fflush(stdout);
     hs_exit();
     printf("exited.\n");
 #if mingw32_HOST_OS


=====================================
testsuite/tests/driver/T8602/T8602.script
=====================================
@@ -1,3 +1,4 @@
-:! echo 'echo $4 $5 $6; exit 1' > t8602.sh
+:! echo '#!/bin/sh' > t8602.sh
+:! echo 'echo $4 $5 $6; exit 1' >> t8602.sh
 :! chmod +x t8602.sh
 :load A


=====================================
testsuite/tests/ffi/should_run/all.T
=====================================
@@ -28,11 +28,11 @@ test('ffi004', skip, compile_and_run, [''])
 # On x86, the test suffers from floating-point differences due to the
 # use of 80-bit internal precision when using the native code generator.
 #
-test('ffi005', [ omit_ways(prof_ways),
+test('ffi005', [ omit_ways(prof_ways + ['ghci']),
                  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);
+}


=====================================
testsuite/tests/rts/Makefile
=====================================
@@ -37,7 +37,8 @@ T5423:
 	$(RM) T5423_cmm.o T5423.o T5423.hi T5423$(exeext)
 	"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c T5423_cmm.cmm
 	"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c T5423.hs
-	"$(TEST_HC)" $(TEST_HC_OPTS) -v0 T5423.o T5423_cmm.o -o T5423$(exeext)
+	"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c T5423_c.c
+	"$(TEST_HC)" $(TEST_HC_OPTS) -v0 T5423.o T5423_cmm.o T5423_c.o -o T5423$(exeext)
 	./T5423
 
 .PHONY: T9405


=====================================
testsuite/tests/rts/T5423.hs
=====================================
@@ -7,8 +7,13 @@ foreign import prim "test" test :: Int# -> Int# -> Int# -> Int# -> Int#
                                 -> Int# -> Int# -> Int# -> Int# -> Int#
                                 -> Int#
 
+foreign import ccall "flush_stdout" flush_stdout :: IO ()
+
 v :: Int
 v = I# (test 111# 112# 113# 114# 115# 116# 117# 118# 119# 120#)
 
 main :: IO ()
-main = print v
+main = do
+  n <- return $! v
+  flush_stdout -- Ensure that libc output buffer is flushed
+  print n


=====================================
testsuite/tests/rts/T5423.stdout
=====================================
@@ -1,2 +1,2 @@
-120
 111  112  113  114  115  116  117  118  119  120
+120


=====================================
testsuite/tests/rts/T5423_c.c
=====================================
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void flush_stdout(void)
+{
+    fflush(stdout);
+}



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/312ddc4cd1277ed4431ee8cbeaf64aebc69c73e1...823b3e80e31cf64669597cafd000ccdd08f98077

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/312ddc4cd1277ed4431ee8cbeaf64aebc69c73e1...823b3e80e31cf64669597cafd000ccdd08f98077
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/20190615/66686f3f/attachment-0001.html>


More information about the ghc-commits mailing list