[commit: ghc] ghc-8.0: Testsuite: check actual_prof_file only when needed (d552896)

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


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

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

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

commit d552896c3afb7ec0f2a955b6756c6b09a92b6906
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Fri Feb 26 11:23:28 2016 +0100

    Testsuite: check actual_prof_file only when needed
    
    Might be a little faster. Avoids testing for #6113 (.prof file not
    written when process is killed with any signal but SIGINT) for tests
    that don't have a .prof.sample file (which is almost all of them) when
    running the profiling ways.
    Tests that were failing because of #6113: T8089, overflow1, overflow2 and
    overflow3.
    
    (cherry picked from commit e3b9dbf48c7b7b1ac4a5d6ecf1411469b5f7666c)


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

d552896c3afb7ec0f2a955b6756c6b09a92b6906
 testsuite/driver/testlib.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index afea594..ba39268 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1598,6 +1598,14 @@ def check_hp_ok(name):
         return(False)
 
 def check_prof_ok(name, way):
+    (_, 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
+    # compare it with.
+    if not os.path.exists(expected_prof_path):
+        return True
+
     actual_prof_file = add_suffix(name, 'prof')
     actual_prof_path = in_testdir(actual_prof_file)
 
@@ -1609,16 +1617,9 @@ def check_prof_ok(name, way):
         print(actual_prof_path + " is empty")
         return(False)
 
-    (_, expected_prof_file) = find_expected_file(name, 'prof.sample')
-    expected_prof_path = in_testdir(expected_prof_file)
-
-    # sample prof file is not required
-    if not os.path.exists(expected_prof_path):
-        return True
-    else:
-        return compare_outputs(way, 'prof', normalise_prof,
-                               expected_prof_file, actual_prof_file,
-                               whitespace_normaliser=normalise_whitespace)
+    return compare_outputs(way, 'prof', normalise_prof,
+                            expected_prof_file, actual_prof_file,
+                            whitespace_normaliser=normalise_whitespace)
 
 # Compare expected output to actual output, and optionally accept the
 # new output. Returns true if output matched or was accepted, false



More information about the ghc-commits mailing list