[commit: ghc] master: Color output is wreaking havoc on test results (847d229)

git at git.haskell.org git at git.haskell.org
Mon Dec 5 20:51:44 UTC 2016


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

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

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

commit 847d229346431483b99adcff12e46c7bf6af15da
Author: Tamar Christina <tamar at zhox.com>
Date:   Mon Dec 5 20:51:11 2016 +0000

    Color output is wreaking havoc on test results
    
    Summary:
    D2716 introduced colors into the output of GHC.
    These color ourputs are done using escape characters output
    to the terminal.
    
    These however are wreaking havoc on the testsuite output as now
    no stderr with a warning or error will match anymore.
    
    Instead of accepting the new codes as expected values instead I
    turn them off. So the testsuite is consistent on platforms/terminals we
    don't support colors on.
    
    Test Plan:
    any test that outputs colors. e.g.
    
    make test TEST=T9576
    
    Reviewers: austin, Rufflewind, bgamari
    
    Subscribers: thomie, #ghc_windows_task_force
    
    Differential Revision: https://phabricator.haskell.org/D2787
    
    GHC Trac Issues: #8809


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

847d229346431483b99adcff12e46c7bf6af15da
 testsuite/mk/ghc-config.hs | 6 ++++++
 testsuite/mk/test.mk       | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/testsuite/mk/ghc-config.hs b/testsuite/mk/ghc-config.hs
index 84f1523..cf55008 100644
--- a/testsuite/mk/ghc-config.hs
+++ b/testsuite/mk/ghc-config.hs
@@ -42,6 +42,12 @@ main = do
         _ -> "NO"
   putStrLn $ "MinGhcVersion711" ++ '=':minGhcVersion711
 
+  let minGhcVersion801 = case lookup "Project version" fields of
+        Just v
+          | parseVersion v >= [8,1] -> "YES"
+        _ -> "NO"
+  putStrLn $ "MinGhcVersion801" ++ '=':minGhcVersion801
+
 
 getGhcFieldOrFail :: [(String,String)] -> String -> String -> IO ()
 getGhcFieldOrFail fields mkvar key
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index d4bd5fe..16be955 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -43,6 +43,12 @@ TEST_HC_OPTS += -fno-warn-missed-specialisations
 TEST_HC_OPTS += -fshow-warning-groups
 endif
 
+ifeq "$(MinGhcVersion801)" "YES"
+# Turn off any VT800 codes in the output or they wreak havoc on the
+# testsuite output.
+TEST_HC_OPTS += -fdiagnostics-color=never
+endif
+
 # Add the no-debug-output last as it is often convenient to copy the test invocation
 # removing this line.
 TEST_HC_OPTS += -dno-debug-output



More information about the ghc-commits mailing list