[commit: ghc] master: testsuite: allow accepting of fine grained results [skip ci] (ca535f9)

git at git.haskell.org git at git.haskell.org
Sat Mar 31 10:55:09 UTC 2018


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

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

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

commit ca535f95a742d885c4082c9dc296c151fb3c1e12
Author: Tamar Christina <tamar at zhox.com>
Date:   Sat Mar 31 11:14:17 2018 +0100

    testsuite: allow accepting of fine grained results [skip ci]
    
    Summary:
    Sometimes we need to be able to mass accept changes that are platform
    specific and that can't be normalized away using our string formatters.
    
    e.g. differences in I/O manager errors or behaviors. This allows one
    to do so easier than before and less error prone.
    
    I have updated the docs and made it clear this should only be used
    when a normalizer won't work:
    
    https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Updating
    
    Test Plan: Manually tested while working on new I/O manager
    
    Reviewers: bgamari
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4549


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

ca535f95a742d885c4082c9dc296c151fb3c1e12
 testsuite/driver/testglobals.py |  2 ++
 testsuite/driver/testlib.py     | 14 ++++++++++++--
 testsuite/mk/test.mk            | 12 ++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 44fe125..f6831c9 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -28,6 +28,8 @@ class TestConfig:
 
         # Accept new output which differs from the sample?
         self.accept = 0
+        self.accept_platform = 0
+        self.accept_os = 0
 
         # File in which to save the summary
         self.summary_file = ''
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 8bdbedf..f2bb1c9 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1597,7 +1597,17 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file,
             if_verbose(1, 'Test is expected to fail. Not accepting new output.')
             return 0
         elif config.accept and actual_raw:
-            if_verbose(1, 'Accepting new output.')
+            if config.accept_platform:
+                if_verbose(1, 'Accepting new output for platform "'
+                              + config.platform + '".')
+                expected_path += '-' + config.platform
+            elif config.accept_os:
+                if_verbose(1, 'Accepting new output for os "'
+                              + config.os + '".')
+                expected_path += '-' + config.os
+            else:
+                if_verbose(1, 'Accepting new output.')
+
             write_file(expected_path, actual_raw)
             return 1
         elif config.accept:
@@ -1914,7 +1924,7 @@ def in_srcdir(name, suffix=''):
 
 # Finding the sample output.  The filename is of the form
 #
-#   <test>.stdout[-ws-<wordsize>][-<platform>]
+#   <test>.stdout[-ws-<wordsize>][-<platform>|-<os>]
 #
 def find_expected_file(name, suff):
     basename = add_suffix(name, suff)
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index a21c4bb..1eb8d49 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -14,6 +14,9 @@
 #  CONFIG    -- use a different configuration file
 #  COMPILER  -- select a configuration file from config/
 #  THREADS   -- run n tests at once
+#  PLATFORM  -- if accepting a result, accept it for the current platform.
+#  OS        -- if accepting a result, accept it for all wordsizes of the
+#               current os.
 #
 # -----------------------------------------------------------------------------
 
@@ -280,6 +283,15 @@ endif
 
 ifeq "$(accept)" "YES"
 setaccept = -e config.accept=1
+
+ifeq "$(PLATFORM)" "YES"
+setaccept += -e config.accept_platform=1
+endif
+
+ifeq "$(OS)" "YES"
+setaccept += -e config.accept_os=1
+endif
+
 else
 setaccept =
 endif



More information about the ghc-commits mailing list