diff --git a/tests-ng/tests-launcher.py b/tests-ng/tests-launcher.py index f4046c7..a16e908 100755 --- a/tests-ng/tests-launcher.py +++ b/tests-ng/tests-launcher.py @@ -14,19 +14,24 @@ from halo import Halo MAX_JOBS = 10 +LOG_FILE = '/tmp/dotdrop-tests-launcher.log' -def run_test(path): +def run_test(logfd, path): cur = os.path.dirname(sys.argv[0]) name = os.path.basename(path) path = os.path.join(cur, name) + if logfd: + logfd.write('starting test {}\n'.format(path)) p = subprocess.Popen(path, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, _ = p.communicate() out = out.decode() r = p.returncode == 0 + if logfd: + logfd.write('done test {}\n'.format(path)) reason = 'returncode' if 'Traceback' in out: r = False @@ -53,17 +58,23 @@ def main(): tests = get_tests() + fd = open(LOG_FILE, 'w') + fd.write('start with {} jobs\n'.format(MAX_JOBS)) + fd.flush() + print() spinner = Halo(text='Testing', spinner='bouncingBall') spinner.start() with futures.ThreadPoolExecutor(max_workers=MAX_JOBS) as ex: wait_for = [] for test in tests: - j = ex.submit(run_test, test) + j = ex.submit(run_test, fd, test) wait_for.append(j) + fd.flush() for f in futures.as_completed(wait_for): r, reason, p, log = f.result() + fd.flush() if not r: ex.shutdown(wait=False) for x in wait_for: @@ -71,6 +82,7 @@ def main(): print() print(log) print('test {} failed ({})'.format(p, reason)) + fd.close() return False #else: # sys.stdout.write('.') @@ -78,6 +90,8 @@ def main(): sys.stdout.write('\n') spinner.stop() print() + fd.write('done with {} jobs\n'.format(MAX_JOBS)) + fd.close() return True