From e4d4c47f90da6b5c6604da8730f302f1acdd9d96 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 25 Feb 2017 20:52:00 -0800 Subject: start some changes to show pass/fail stats along with progress --- runtest.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/runtest.py b/runtest.py index d636b73..d0de6d1 100755 --- a/runtest.py +++ b/runtest.py @@ -99,6 +99,9 @@ except ImportError: print("Can't import threading or queue") threading_ok = False +import subprocess + + cwd = os.getcwd() baseline = 0 @@ -343,6 +346,7 @@ sp.append(cwd) # _ws = re.compile('\s') + def escape(s): if _ws.search(s): s = '"' + s + '"' @@ -350,8 +354,6 @@ def escape(s): return s -import subprocess - if not suppress_stdout and not suppress_stderr: # Without any output suppressed, we let the subprocess # write its stuff freely to stdout/stderr. @@ -423,6 +425,7 @@ else: spawned_stderr = p.stderr.read() return (spawned_stderr, spawned_stdout, p.wait()) + class Base(object): def __init__(self, path, spe=None): self.path = path @@ -435,6 +438,7 @@ class Base(object): break self.status = None + class SystemExecutor(Base): def execute(self): self.stderr, self.stdout, s = spawn_it(self.command_args) @@ -442,6 +446,7 @@ class SystemExecutor(Base): if s < 0 or s > 2: sys.stdout.write("Unexpected exit status %d\n" % s) + class PopenExecutor(Base): # For an explanation of the following 'if ... else' # and the 'allow_pipe_files' option, please check out the @@ -641,6 +646,7 @@ tests = [] unittests = [] endtests = [] + def find_Tests_py(directory): """ Look for unit tests """ result = [] @@ -653,6 +659,7 @@ def find_Tests_py(directory): result.append(os.path.join(dirpath, fname)) return sorted(result) + def find_py(directory): """ Look for end-to-end tests """ result = [] @@ -760,9 +767,12 @@ else: total_start_time = time_func() total_num_tests = len(tests) tests_completed = 0 +tests_passing = 0 +tests_failing = 0 + def run_test(t, io_lock, async=True): - global tests_completed + global tests_completed, tests_passing, tests_failing header = "" command_args = ['-tt'] if debug: @@ -796,6 +806,11 @@ def run_test(t, io_lock, async=True): if execute_tests: t.execute() + if t.status == 0: + tests_passing += 1 + else: + tests_failing += 1 + t.test_time = time_func() - test_start_time if io_lock: io_lock.acquire() -- cgit v0.12