show the progress of functional test
example (added the progress index `n/m`)
```
1/107 - wallet_hd.py passed, Duration: 27 s
.........................................................................................
2/107 - mining_getblocktemplate_longpoll.py passed, Duration: 72 s
..................................................................
3/107 - feature_maxuploadtarget.py passed, Duration: 78 s
```
- clear dots line
```
$ test/functional/test_runner.py -t can_trash
Temporary test directory at can_trash/test_runner_₿_🏃_20181018_220600
1/105 - wallet_hd.py passed, Duration: 21 s
2/105 - mining_getblocktemplate_longpoll.py passed, Duration: 71 s
3/105 - feature_maxuploadtarget.py passed, Duration: 68 s
..................
```
- don't print the `dot` progressive if `--quiet`
- done_str
- nothing commit to check again travis tests
This commit is contained in:
parent
fe23553edd
commit
96c509e4d0
1 changed files with 19 additions and 11 deletions
|
@ -320,9 +320,10 @@ def main():
|
|||
args=passon_args,
|
||||
combined_logs_len=args.combinedlogslen,
|
||||
failfast=args.failfast,
|
||||
level=logging_level
|
||||
)
|
||||
|
||||
def run_tests(test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False):
|
||||
def run_tests(test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, level=logging.DEBUG):
|
||||
args = args or []
|
||||
|
||||
# Warn if bitcoind is already running (unix only)
|
||||
|
@ -357,22 +358,22 @@ def run_tests(test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=Fal
|
|||
raise
|
||||
|
||||
#Run Tests
|
||||
job_queue = TestHandler(jobs, tests_dir, tmpdir, test_list, flags)
|
||||
job_queue = TestHandler(jobs, tests_dir, tmpdir, test_list, flags, level)
|
||||
start_time = time.time()
|
||||
test_results = []
|
||||
|
||||
max_len_name = len(max(test_list, key=len))
|
||||
|
||||
for _ in range(len(test_list)):
|
||||
test_count = len(test_list)
|
||||
for i in range(test_count):
|
||||
test_result, testdir, stdout, stderr = job_queue.get_next()
|
||||
test_results.append(test_result)
|
||||
|
||||
done_str = "{}/{} - {}{}{}".format(i + 1, test_count, BOLD[1], test_result.name, BOLD[0])
|
||||
if test_result.status == "Passed":
|
||||
logging.debug("\n%s%s%s passed, Duration: %s s" % (BOLD[1], test_result.name, BOLD[0], test_result.time))
|
||||
logging.debug("%s passed, Duration: %s s" % (done_str, test_result.time))
|
||||
elif test_result.status == "Skipped":
|
||||
logging.debug("\n%s%s%s skipped" % (BOLD[1], test_result.name, BOLD[0]))
|
||||
logging.debug("%s skipped" % (done_str))
|
||||
else:
|
||||
print("\n%s%s%s failed, Duration: %s s\n" % (BOLD[1], test_result.name, BOLD[0], test_result.time))
|
||||
print("%s failed, Duration: %s s\n" % (done_str, test_result.time))
|
||||
print(BOLD[1] + 'stdout:\n' + BOLD[0] + stdout + '\n')
|
||||
print(BOLD[1] + 'stderr:\n' + BOLD[0] + stderr + '\n')
|
||||
if combined_logs_len and os.path.isdir(testdir):
|
||||
|
@ -438,13 +439,14 @@ class TestHandler:
|
|||
Trigger the test scripts passed in via the list.
|
||||
"""
|
||||
|
||||
def __init__(self, num_tests_parallel, tests_dir, tmpdir, test_list=None, flags=None):
|
||||
def __init__(self, num_tests_parallel, tests_dir, tmpdir, test_list=None, flags=None, logging_level=logging.DEBUG):
|
||||
assert(num_tests_parallel >= 1)
|
||||
self.num_jobs = num_tests_parallel
|
||||
self.tests_dir = tests_dir
|
||||
self.tmpdir = tmpdir
|
||||
self.test_list = test_list
|
||||
self.flags = flags
|
||||
self.logging_level = logging_level
|
||||
self.num_running = 0
|
||||
self.jobs = []
|
||||
|
||||
|
@ -471,6 +473,7 @@ class TestHandler:
|
|||
log_stderr))
|
||||
if not self.jobs:
|
||||
raise IndexError('pop from empty list')
|
||||
dot_count = 0
|
||||
while True:
|
||||
# Return first proc that finishes
|
||||
time.sleep(.5)
|
||||
|
@ -491,9 +494,14 @@ class TestHandler:
|
|||
status = "Failed"
|
||||
self.num_running -= 1
|
||||
self.jobs.remove(job)
|
||||
|
||||
if self.logging_level == logging.DEBUG:
|
||||
clearline = '\r' + (' ' * dot_count) + '\r'
|
||||
print(clearline, end='', flush=True)
|
||||
dot_count = 0
|
||||
return TestResult(name, status, int(time.time() - start_time)), testdir, stdout, stderr
|
||||
if self.logging_level == logging.DEBUG:
|
||||
print('.', end='', flush=True)
|
||||
dot_count += 1
|
||||
|
||||
def kill_and_join(self):
|
||||
"""Send SIGKILL to all jobs and block until all have ended."""
|
||||
|
|
Loading…
Reference in a new issue