[commit: ghc] master: Testsuite: fix the little known CHECK_FILES_WRITTEN=1 (c14bd01)

git at git.haskell.org git at git.haskell.org
Fri Jun 12 09:39:13 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c14bd01756ffaf3a0bf34c766cfc1d611dba0dc4/ghc

>---------------------------------------------------------------

commit c14bd01756ffaf3a0bf34c766cfc1d611dba0dc4
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Sat May 30 12:33:20 2015 +0200

    Testsuite: fix the little known CHECK_FILES_WRITTEN=1
    
    The testsuite driver has a little known feature to check which files
    each test writes to, whether there are tests that write to same file,
    and whether the tests leave any files behind when CLEANUP=1. It uses
    strace under the hood.
    
    This commit fixes some bitrot, and filters out some more strace lines
    that we're not interested in (and are shown as framework failures
    otherwise).
    
    Differential Revision: https://phabricator.haskell.org/D979


>---------------------------------------------------------------

c14bd01756ffaf3a0bf34c766cfc1d611dba0dc4
 testsuite/driver/testlib.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index c6150da..462c854 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1868,7 +1868,7 @@ def runCmdFor( name, cmd, timeout_multiplier=1.0 ):
             r = rawSystemWithTimeout(
                     ["strace", "-o", fn, "-fF",
                                "-e", "creat,open,chdir,clone,vfork",
-                     config.timeout_prog, str(timeout), cmd])
+                     strip_quotes(config.timeout_prog), str(timeout), cmd])
             addTestFilesWritten(name, fn)
             rm_no_fail(fn)
         else:
@@ -1885,7 +1885,10 @@ def runCmdExitCode( cmd ):
 # checking for files being written to by multiple tests
 
 re_strace_call_end = '(\) += ([0-9]+|-1 E.*)| <unfinished ...>)$'
-re_strace_unavailable       = re.compile('^\) += \? <unavailable>$')
+re_strace_unavailable_end ='\) += \? <unavailable>$'
+
+re_strace_unavailable_line  = re.compile('^' + re_strace_unavailable_end)
+re_strace_unavailable_cntnt = re.compile('^<\.\.\. .* resumed> ' + re_strace_unavailable_end)
 re_strace_pid               = re.compile('^([0-9]+) +(.*)')
 re_strace_clone             = re.compile('^(clone\(|<... clone resumed> ).*\) = ([0-9]+)$')
 re_strace_clone_unfinished  = re.compile('^clone\( <unfinished \.\.\.>$')
@@ -1896,7 +1899,10 @@ re_strace_chdir_resumed     = re.compile('^<\.\.\. chdir resumed> \) += 0$')
 re_strace_open              = re.compile('^open\("([^"]*)", ([A-Z_|]*)(, [0-9]+)?' + re_strace_call_end)
 re_strace_open_resumed      = re.compile('^<... open resumed> '                    + re_strace_call_end)
 re_strace_ignore_sigchild   = re.compile('^--- SIGCHLD \(Child exited\) @ 0 \(0\) ---$')
+re_strace_ignore_sigchild2  = re.compile('^--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, .*} ---$')
+re_strace_ignore_exited     = re.compile('^\+\+\+ exited with [0-9]* \+\+\+$')
 re_strace_ignore_sigvtalarm = re.compile('^--- SIGVTALRM \(Virtual timer expired\) @ 0 \(0\) ---$')
+re_strace_ignore_sigvtalarm2= re.compile('^--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TIMER, .*} ---$')
 re_strace_ignore_sigint     = re.compile('^--- SIGINT \(Interrupt\) @ 0 \(0\) ---$')
 re_strace_ignore_sigfpe     = re.compile('^--- SIGFPE \(Floating point exception\) @ 0 \(0\) ---$')
 re_strace_ignore_sigsegv    = re.compile('^--- SIGSEGV \(Segmentation fault\) @ 0 \(0\) ---$')
@@ -1942,7 +1948,7 @@ def addTestFilesWrittenHelper(name, fn):
             if m_pid:
                 pid = m_pid.group(1)
                 content = m_pid.group(2)
-            elif re_strace_unavailable.match(line):
+            elif re_strace_unavailable_line.match(line):
                 next
             else:
                 framework_fail(name, 'strace', "Can't find pid in strace line: " + line)
@@ -1994,8 +2000,14 @@ def addTestFilesWrittenHelper(name, fn):
                 pass
             elif re_strace_ignore_sigchild.match(content):
                 pass
+            elif re_strace_ignore_sigchild2.match(content):
+                pass
+            elif re_strace_ignore_exited.match(content):
+                pass
             elif re_strace_ignore_sigvtalarm.match(content):
                 pass
+            elif re_strace_ignore_sigvtalarm2.match(content):
+                pass
             elif re_strace_ignore_sigint.match(content):
                 pass
             elif re_strace_ignore_sigfpe.match(content):
@@ -2004,6 +2016,8 @@ def addTestFilesWrittenHelper(name, fn):
                 pass
             elif re_strace_ignore_sigpipe.match(content):
                 pass
+            elif re_strace_unavailable_cntnt.match(content):
+                pass
             else:
                 framework_fail(name, 'strace', "Can't understand strace line: " + line)
  



More information about the ghc-commits mailing list