[commit: ghc] master: Remove dead code in testsuite driver (2cb08d7)

git at git.haskell.org git at git.haskell.org
Fri Jul 27 18:44:00 UTC 2018


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

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

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

commit 2cb08d72d938fa6fdf46da032980af8c4973a0be
Author: Krzysztof Gogolewski <krz.gogolewski at gmail.com>
Date:   Fri Jul 27 18:40:26 2018 +0200

    Remove dead code in testsuite driver
    
    Test Plan: validate
    
    Reviewers: bgamari, O7 GHC - Testsuite
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4972


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

2cb08d72d938fa6fdf46da032980af8c4973a0be
 testsuite/driver/runtests.py |  4 ----
 testsuite/driver/testlib.py  | 21 ++++-----------------
 testsuite/driver/testutil.py | 14 --------------
 3 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 4e275c5..e9cce94 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -4,13 +4,10 @@
 # (c) Simon Marlow 2002
 #
 
-from __future__ import print_function
-
 import argparse
 import signal
 import sys
 import os
-import string
 import shutil
 import tempfile
 import time
@@ -55,7 +52,6 @@ parser.add_argument("--only", action="append", help="just this test (can be give
 parser.add_argument("--way", action="append", help="just this way")
 parser.add_argument("--skipway", action="append", help="skip this way")
 parser.add_argument("--threads", type=int, help="threads to run simultaneously")
-parser.add_argument("--check-files-written", help="check files aren't written by multiple tests") # NOTE: This doesn't seem to exist?
 parser.add_argument("--verbose", type=int, choices=[0,1,2,3,4,5], help="verbose (Values 0 through 5 accepted)")
 parser.add_argument("--skip-perf-tests", action="store_true", help="skip performance tests")
 parser.add_argument("--junit", type=argparse.FileType('wb'), help="output testsuite summary in JUnit format")
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index f7863c3..f99c6ed 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -3,13 +3,9 @@
 # (c) Simon Marlow 2002
 #
 
-from __future__ import print_function
-
 import io
 import shutil
 import os
-import errno
-import string
 import re
 import traceback
 import time
@@ -25,26 +21,22 @@ from testglobals import *
 from testutil import *
 extra_src_files = {'T4198': ['exitminus1.c']} # TODO: See #12223
 
+global pool_sema
 if config.use_threads:
     import threading
-    try:
-        import thread
-    except ImportError: # Python 3
-        import _thread as thread
+    pool_sema = threading.BoundedSemaphore(value=config.threads)
 
 global wantToStop
 wantToStop = False
 
-global pool_sema
-if config.use_threads:
-    pool_sema = threading.BoundedSemaphore(value=config.threads)
-
 def stopNow():
     global wantToStop
     wantToStop = True
+
 def stopping():
     return wantToStop
 
+
 # Options valid for the current test only (these get reset to
 # testdir_testopts after each test).
 
@@ -504,7 +496,6 @@ def no_check_hp(name, opts):
 
 def filter_stdout_lines( regex ):
     """ Filter lines of stdout with the given regular expression """
-    import re
     def f( name, opts ):
         _normalise_fun(name, opts, lambda s: '\n'.join(re.findall(regex, s)))
     return f
@@ -1823,9 +1814,6 @@ def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, pr
     cmd = cmd.format(**config.__dict__)
     if_verbose(3, cmd + ('< ' + os.path.basename(stdin) if stdin else ''))
 
-    # declare the buffers to a default
-    stdin_buffer  = None
-
     stdin_file = io.open(stdin, 'rb') if stdin else None
     stdout_buffer = b''
     stderr_buffer = b''
@@ -1949,7 +1937,6 @@ def find_expected_file(name, suff):
 
 if config.msys:
     import stat
-    import time
     def cleanup():
         testdir = getTestOpts().testdir
         max_attempts = 5
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index dcba177..104bbff 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -1,4 +1,3 @@
-import errno
 import os
 import platform
 import subprocess
@@ -25,15 +24,6 @@ def getStdout(cmd_and_args):
         raise Exception("stderr from command: %s\nOutput:\n%s\n" % (cmd_and_args, stderr))
     return stdout
 
-def mkdirp(path):
-    try:
-        os.makedirs(path)
-    except OSError as e:
-        if e.errno == errno.EEXIST and os.path.isdir(path):
-            pass
-        else:
-            raise
-
 def lndir(srcdir, dstdir):
     # Create symlinks for all files in src directory.
     # Not all developers might have lndir installed.
@@ -60,10 +50,6 @@ else:
     link_or_copy_file = os.symlink
 
 class Watcher(object):
-    global pool
-    global evt
-    global sync_lock
-    
     def __init__(self, count):
         self.pool = count
         self.evt = threading.Event()



More information about the ghc-commits mailing list