[commit: ghc] master: testsuite: Use bools for booleans, not ints (ecde954)

git at git.haskell.org git at git.haskell.org
Wed Sep 5 11:48:14 UTC 2018


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

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

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

commit ecde9546e7768a57bb57d742c8ef3b7cf7fde80e
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Wed Sep 5 13:45:50 2018 +0200

    testsuite: Use bools for booleans, not ints
    
    Summary: Just as it says on the tin.
    
    Test Plan: Validate
    
    Reviewers: bgamari, osa1
    
    Reviewed By: osa1
    
    Subscribers: osa1, monoidal, rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D5010


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

ecde9546e7768a57bb57d742c8ef3b7cf7fde80e
 testsuite/driver/testglobals.py | 22 +++++++++++-----------
 testsuite/driver/testlib.py     | 30 +++++++++++++++---------------
 testsuite/mk/test.mk            |  6 +++---
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 067b7d4..311e39b 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -27,9 +27,9 @@ class TestConfig:
         self.only = set()
 
         # Accept new output which differs from the sample?
-        self.accept = 0
-        self.accept_platform = 0
-        self.accept_os = 0
+        self.accept = False
+        self.accept_platform = False
+        self.accept_os = False
 
         # File in which to save the summary
         self.summary_file = ''
@@ -117,7 +117,7 @@ class TestConfig:
 
         # threads
         self.threads = 1
-        self.use_threads = 0
+        self.use_threads = False
 
         # Should we skip performance tests
         self.skip_perf_tests = False
@@ -168,7 +168,7 @@ def getTestRun():
 class TestOptions:
    def __init__(self):
        # skip this test?
-       self.skip = 0
+       self.skip = False
 
        # skip these ways
        self.omit_ways = []
@@ -193,7 +193,7 @@ class TestOptions:
        self.ignore_stderr = False
 
        # Backpack test
-       self.compile_backpack = 0
+       self.compile_backpack = False
 
        # We sometimes want to modify the compiler_always_flags, so
        # they are copied from config.compiler_always_flags when we
@@ -230,15 +230,15 @@ class TestOptions:
        self.alone = False
 
        # Does this test use a literate (.lhs) file?
-       self.literate = 0
+       self.literate = False
 
        # Does this test use a .c, .m or .mm file?
-       self.c_src      = 0
-       self.objc_src   = 0
-       self.objcpp_src = 0
+       self.c_src      = False
+       self.objc_src   = False
+       self.objcpp_src = False
 
        # Does this test use a .cmm file?
-       self.cmm_src    = 0
+       self.cmm_src    = False
 
        # Should we put .hi/.o files in a subdirectory?
        self.outputdir = None
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 6402efe..ff6a8c8 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -84,7 +84,7 @@ def normal( name, opts ):
     return;
 
 def skip( name, opts ):
-    opts.skip = 1
+    opts.skip = True
 
 def expect_fail( name, opts ):
     # The compiler, testdriver, OS or platform is missing a certain
@@ -423,19 +423,19 @@ def multi_cpu_race(name, opts):
 
 # ---
 def literate( name, opts ):
-    opts.literate = 1;
+    opts.literate = True
 
 def c_src( name, opts ):
-    opts.c_src = 1;
+    opts.c_src = True
 
 def objc_src( name, opts ):
-    opts.objc_src = 1;
+    opts.objc_src = True
 
 def objcpp_src( name, opts ):
-    opts.objcpp_src = 1;
+    opts.objcpp_src = True
 
 def cmm_src( name, opts ):
-    opts.cmm_src = 1;
+    opts.cmm_src = True
 
 def outputdir( odir ):
     return lambda name, opts, d=odir: _outputdir(name, opts, d)
@@ -973,19 +973,19 @@ def compile_fail( name, way, extra_hc_opts ):
     return do_compile( name, way, 1, '', [], extra_hc_opts )
 
 def backpack_typecheck( name, way, extra_hc_opts ):
-    return do_compile( name, way, 0, '', [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=1 )
+    return do_compile( name, way, 0, '', [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
 
 def backpack_typecheck_fail( name, way, extra_hc_opts ):
-    return do_compile( name, way, 1, '', [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=1 )
+    return do_compile( name, way, 1, '', [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
 
 def backpack_compile( name, way, extra_hc_opts ):
-    return do_compile( name, way, 0, '', [], extra_hc_opts, backpack=1 )
+    return do_compile( name, way, 0, '', [], extra_hc_opts, backpack=True )
 
 def backpack_compile_fail( name, way, extra_hc_opts ):
-    return do_compile( name, way, 1, '', [], extra_hc_opts, backpack=1 )
+    return do_compile( name, way, 1, '', [], extra_hc_opts, backpack=True )
 
 def backpack_run( name, way, extra_hc_opts ):
-    return compile_and_run__( name, way, '', [], extra_hc_opts, backpack=1 )
+    return compile_and_run__( name, way, '', [], extra_hc_opts, backpack=True )
 
 def multimod_compile( name, way, top_mod, extra_hc_opts ):
     return do_compile( name, way, 0, top_mod, [], extra_hc_opts )
@@ -1577,14 +1577,14 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file,
             # See Note [Output comparison].
             r = runCmd('diff -uw "{0}" "{1}"'.format(expected_normalised_path,
                                                         actual_normalised_path),
-                        print_output = 1)
+                        print_output=True)
 
             # If for some reason there were no non-whitespace differences,
             # then do a full diff
             if r == 0:
                 r = runCmd('diff -u "{0}" "{1}"'.format(expected_normalised_path,
                                                            actual_normalised_path),
-                           print_output = 1)
+                           print_output=True)
 
         if config.accept and (getTestOpts().expect == 'fail' or
                               way in getTestOpts().expect_fail_for):
@@ -1800,7 +1800,7 @@ def dump_file(f):
     except Exception:
         print('')
 
-def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, print_output=0):
+def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, print_output=False):
     timeout_prog = strip_quotes(config.timeout_prog)
     timeout = str(int(ceil(config.timeout * timeout_multiplier)))
 
@@ -1832,7 +1832,7 @@ def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, pr
     finally:
         if stdin_file:
             stdin_file.close()
-        if config.verbose >= 1 and print_output >= 1:
+        if config.verbose >= 1 and print_output:
             if stdout_buffer:
                 sys.stdout.buffer.write(stdout_buffer)
             if stderr_buffer:
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 3e9f4d6..d9a13aa 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -296,14 +296,14 @@ setspeed =
 endif
 
 ifeq "$(accept)" "YES"
-setaccept = -e config.accept=1
+setaccept = -e config.accept=True
 
 ifeq "$(PLATFORM)" "YES"
-setaccept += -e config.accept_platform=1
+setaccept += -e config.accept_platform=True
 endif
 
 ifeq "$(OS)" "YES"
-setaccept += -e config.accept_os=1
+setaccept += -e config.accept_os=True
 endif
 
 else



More information about the ghc-commits mailing list