[commit: ghc] ghc-8.0: Testsuite: also normalise platform-dependent .stdout/stderr (43eef43)

git at git.haskell.org git at git.haskell.org
Wed Aug 24 22:18:24 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/43eef4353790d1311b29cff28b23cd2e006e633b/ghc

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

commit 43eef4353790d1311b29cff28b23cd2e006e633b
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed May 25 16:03:19 2016 +0200

    Testsuite: also normalise platform-dependent .stdout/stderr
    
    This effectively reverses commit
    429f0099ab9adfadc779ca76f3aae1c9c160fb8c (2006).
    
    I don't see why platform-dependent .stdout/stderr files should //not//
    get normalised.
    
    It fixes T11223_link_order_a_b_2_fail on Windows, by normalising
    `ghc-stage2.exe` to `ghc` when comparing stderr with .stderr-mingw32.
    
    Reviewed by: Phyx
    
    Differential Revision: https://phabricator.haskell.org/D2267
    
    GHC Trac Issues: #12118
    
    (cherry picked from commit 6a5bce14ffb8b10def150b185fc95d7b2ebab263)


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

43eef4353790d1311b29cff28b23cd2e006e633b
 testsuite/driver/testlib.py | 38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index ba39268..12a8ebd 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1045,7 +1045,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, over
     # of whether we expected the compilation to fail or not (successful
     # compilations may generate warnings).
 
-    (_, expected_stderr_file) = find_expected_file(name, 'stderr')
+    expected_stderr_file = find_expected_file(name, 'stderr')
     actual_stderr_file = add_suffix(name, 'comp.stderr')
 
     if not compare_outputs(way, 'stderr',
@@ -1070,7 +1070,7 @@ def compile_cmp_asm( name, way, extra_hc_opts ):
     # of whether we expected the compilation to fail or not (successful
     # compilations may generate warnings).
 
-    (_, expected_asm_file) = find_expected_file(name, 'asm')
+    expected_asm_file = find_expected_file(name, 'asm')
     actual_asm_file = add_suffix(name, 's')
 
     if not compare_outputs(way, 'asm',
@@ -1514,15 +1514,9 @@ def get_compiler_flags(override_flags, noforce):
 
 def check_stdout_ok(name, way):
    actual_stdout_file = add_suffix(name, 'run.stdout')
-   (platform_specific, expected_stdout_file) = find_expected_file(name, 'stdout')
+   expected_stdout_file = find_expected_file(name, 'stdout')
 
-   def norm(str):
-      if platform_specific:
-         return str
-      else:
-         return normalise_output(str)
-
-   extra_norm = join_normalisers(norm, getTestOpts().extra_normaliser)
+   extra_norm = join_normalisers(normalise_output, getTestOpts().extra_normaliser)
 
    check_stdout = getTestOpts().check_stdout
    if check_stdout:
@@ -1538,16 +1532,10 @@ def dump_stdout( name ):
 
 def check_stderr_ok(name, way):
    actual_stderr_file = add_suffix(name, 'run.stderr')
-   (platform_specific, expected_stderr_file) = find_expected_file(name, 'stderr')
-
-   def norm(str):
-      if platform_specific:
-         return str
-      else:
-         return normalise_errmsg(str)
+   expected_stderr_file = find_expected_file(name, 'stderr')
 
    return compare_outputs(way, 'stderr',
-                          join_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \
+                          join_normalisers(normalise_errmsg, getTestOpts().extra_errmsg_normaliser), \
                           expected_stderr_file, actual_stderr_file,
                           whitespace_normaliser=normalise_whitespace)
 
@@ -1598,7 +1586,7 @@ def check_hp_ok(name):
         return(False)
 
 def check_prof_ok(name, way):
-    (_, expected_prof_file) = find_expected_file(name, 'prof.sample')
+    expected_prof_file = find_expected_file(name, 'prof.sample')
     expected_prof_path = in_testdir(expected_prof_file)
 
     # Check actual prof file only if we have an expected prof file to
@@ -2194,20 +2182,18 @@ def find_expected_file(name, suff):
     basename = add_suffix(name, suff)
     basepath = in_testdir(basename)
 
-    files = [(platformSpecific, basename + ws + plat)
-             for (platformSpecific, plat) in [(1, '-' + config.platform),
-                                              (1, '-' + config.os),
-                                              (0, '')]
+    files = [basename + ws + plat
+             for plat in ['-' + config.platform, '-' + config.os, '']
              for ws in ['-ws-' + config.wordsize, '']]
 
     dir = glob.glob(basepath + '*')
     dir = [normalise_slashes_(d) for d in dir]
 
-    for (platformSpecific, f) in files:
+    for f in files:
        if in_testdir(f) in dir:
-            return (platformSpecific,f)
+            return f
 
-    return (0, basename)
+    return basename
 
 # Clean up prior to the test, so that we can't spuriously conclude
 # that it passed on the basis of old run outputs.



More information about the ghc-commits mailing list