[commit: ghc] master: Simplify testsuite driver (f27d714)

git at git.haskell.org git at git.haskell.org
Sat Aug 11 19:05:53 UTC 2018


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

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

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

commit f27d7145414eae17a211b88908965c91b0236a0f
Author: Krzysztof Gogolewski <krz.gogolewski at gmail.com>
Date:   Sat Aug 11 21:04:04 2018 +0200

    Simplify testsuite driver
    
    Summary:
    - remove clean_cmd
    - framework_failures was undefined
    - times_file was not used
    - if_verbose_dump was called only when verbose >= 1; remove the check
    - simplify normalise_whitespace
    
    Test Plan: validate
    
    Reviewers: bgamari, thomie
    
    Reviewed By: thomie
    
    Subscribers: rwbarton, carter
    
    Differential Revision: https://phabricator.haskell.org/D5061


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

f27d7145414eae17a211b88908965c91b0236a0f
 testsuite/driver/runtests.py                   |  2 +-
 testsuite/driver/testglobals.py                |  6 ------
 testsuite/driver/testlib.py                    | 23 ++++++++---------------
 testsuite/tests/driver/recomp015/all.T         |  1 -
 testsuite/tests/driver/retc001/all.T           |  1 -
 testsuite/tests/safeHaskell/safeLanguage/all.T |  2 +-
 testsuite/tests/simplCore/should_compile/all.T |  1 -
 7 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index e01f67c..ae4f32b 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -297,7 +297,7 @@ if config.list_broken:
     print('')
 
     if t.framework_failures:
-        print('WARNING:', len(framework_failures), 'framework failures!')
+        print('WARNING:', len(t.framework_failures), 'framework failures!')
         print('')
 else:
     # completion watcher
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 246f26c..067b7d4 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -43,9 +43,6 @@ class TestConfig:
         # with --verbose=0.
         self.no_print_summary = False
 
-        # File in which to save the times
-        self.times_file = ''
-
         # What platform are we running on?
         self.platform = ''
         self.os = ''
@@ -249,9 +246,6 @@ class TestOptions:
        # Command to run before the test
        self.pre_cmd = None
 
-       # Command to run for extra cleaning
-       self.clean_cmd = None
-
        # Command wrapper: a function to apply to the command before running it
        self.cmd_wrapper = None
 
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index ef2b8dd..971ed40 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -454,12 +454,6 @@ def _pre_cmd( name, opts, cmd ):
 
 # ----
 
-def clean_cmd( cmd ):
-    # TODO. Remove all calls to clean_cmd.
-    return lambda _name, _opts: None
-
-# ----
-
 def cmd_prefix( prefix ):
     return lambda name, opts, p=prefix: _cmd_prefix(name, opts, prefix)
 
@@ -1222,7 +1216,7 @@ def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, b
         if config.verbose >= 1 and _expect_pass(way):
             print('Compile failed (exit code {0}) errors were:'.format(exit_code))
             actual_stderr_path = in_testdir(name, 'comp.stderr')
-            if_verbose_dump(1, actual_stderr_path)
+            dump_file(actual_stderr_path)
 
     # ToDo: if the sub-shell was killed by ^C, then exit
 
@@ -1636,7 +1630,7 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file,
 
 def normalise_whitespace( str ):
     # Merge contiguous whitespace characters into a single space.
-    return ' '.join(w for w in str.split())
+    return ' '.join(str.split())
 
 callSite_re = re.compile(r', called at (.+):[\d]+:[\d]+ in [\w\-\.]+:')
 
@@ -1800,13 +1794,12 @@ def if_verbose( n, s ):
     if config.verbose >= n:
         print(s)
 
-def if_verbose_dump( n, f ):
-    if config.verbose >= n:
-        try:
-            with io.open(f) as file:
-                print(file.read())
-        except Exception:
-            print('')
+def dump_file(f):
+    try:
+        with io.open(f) as file:
+            print(file.read())
+    except Exception:
+        print('')
 
 def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, print_output=0):
     timeout_prog = strip_quotes(config.timeout_prog)
diff --git a/testsuite/tests/driver/recomp015/all.T b/testsuite/tests/driver/recomp015/all.T
index e0b77f3..9399534 100644
--- a/testsuite/tests/driver/recomp015/all.T
+++ b/testsuite/tests/driver/recomp015/all.T
@@ -2,7 +2,6 @@
 
 test('recomp015',
      [extra_files(['Generate.hs']),
-       clean_cmd('$MAKE -s clean'),
        # See ticket:11022#comment:7
        unless(opsys('linux') or opsys('solaris2') or opsys('openbsd'), skip),
        when(arch('arm'), skip),
diff --git a/testsuite/tests/driver/retc001/all.T b/testsuite/tests/driver/retc001/all.T
index 3f15ed1..a5b0c82 100644
--- a/testsuite/tests/driver/retc001/all.T
+++ b/testsuite/tests/driver/retc001/all.T
@@ -1,6 +1,5 @@
 test('retc001',
      [extra_files(['A.hs', 'B1.hs', 'B2.hs', 'C.hs']),
-      clean_cmd('$MAKE -s clean'),
 # See issue 11204, this test sometimes passes and sometimes fails on OSX
       when(opsys('darwin'), skip)],
      run_command,
diff --git a/testsuite/tests/safeHaskell/safeLanguage/all.T b/testsuite/tests/safeHaskell/safeLanguage/all.T
index a8a1bc0..2807f73 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/all.T
+++ b/testsuite/tests/safeHaskell/safeLanguage/all.T
@@ -36,6 +36,6 @@ test('SafeLang18', normal, compile, [''])
 # Test building a package, that trust values are set correctly
 # and can be changed correctly
 #test('SafeRecomp01',
-#		clean_cmd('$MAKE -s --no-print-directory cleanSafeRecomp01'),
+#		normal,
 #      run_command, ['$MAKE -s --no-print-directory safeRecomp01'])
 
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index d4eaf19..95a9d99 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -148,7 +148,6 @@ test('T7785', only_ways(['optasm']), compile, ['-ddump-rules'])
 test('T7702',
      [extra_files(['T7702plugin']),
       pre_cmd('$MAKE -s --no-print-directory -C T7702plugin package.T7702 TOP={top}'),
-      clean_cmd('$MAKE -s --no-print-directory -C T7702plugin clean.T7702'),
       # we say 18mb peak allocated +/- 70% because other compiler flags have
       # a large effect on allocation which is hard to separate from the
       # allocation done by the plugin... but a regression allocates > 90mb



More information about the ghc-commits mailing list