From fba84a46a1ca5daf43a2db517116ada3ffaa8557 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 3 Aug 2013 01:18:33 +0300 Subject: [PATCH] Prettyified test runner output. --- meson_test.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meson_test.py b/meson_test.py index f8da08e61..b0864ec7d 100755 --- a/meson_test.py +++ b/meson_test.py @@ -40,7 +40,7 @@ def run_tests(options, datafilename): logfile = open(logfilename, 'w') logfile.write('Log of Meson test suite run on %s.\n\n' % datetime.datetime.now().isoformat()) tests = pickle.load(open(datafilename, 'rb')) - for test in tests: + for i, test in enumerate(tests): name = test[0] fname = test[1] cmd = wrap + [fname] @@ -52,10 +52,14 @@ def run_tests(options, datafilename): stdo = stdo.decode() stde = stde.decode() - if p.returncode != 0: - result_str = 'Test "%s": FAIL (%.3f s)' % (name, duration) + num = '%d/%d' % (i+1, len(tests)) + padding1 = ' '*(40-len(name)) + if p.returncode == 0: + res = 'OK' else: - result_str = 'Test "%s": OK (%.3f s)' % (name, duration) + res = 'FAIL' + padding2 = ' '*(5-len(res)) + result_str = '%s "%s"%s%s%s(%.3f s)' % (num, name, padding1, res, padding2, duration) print(result_str) write_log(logfile, name, result_str, stdo, stde) print('\nFull log written to %s.' % logfilename)