diff options
author | Aníbal Limón <anibal.limon@linaro.org> | 2019-03-20 12:48:10 -0600 |
---|---|---|
committer | Chase Qi <chase.qi@linaro.org> | 2019-03-26 09:37:20 +0800 |
commit | 3cba40930193f17b2d7e3099232d09a6b76705f4 (patch) | |
tree | 60263383d95a99b6a1b04971e4c5f09d87d024a6 | |
parent | 9a5f4cf42fedfb58a88dd3b595570b311152691b (diff) |
automated/linux: piglit_lava_parse.py create common function to print_results
Change-Id: I49179153d74f427ff3c5b34c875d0b93ec57efb0
Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
-rwxr-xr-x | automated/linux/piglit/piglit_lava_parse.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/automated/linux/piglit/piglit_lava_parse.py b/automated/linux/piglit/piglit_lava_parse.py index 1e780fa..cc4fcb9 100755 --- a/automated/linux/piglit/piglit_lava_parse.py +++ b/automated/linux/piglit/piglit_lava_parse.py @@ -46,6 +46,16 @@ def natural_keys(text): return text +def print_results(filename, ignore_tests): + with open(filename, 'r') as f: + piglit_results = json.loads(f.read()) + for test in sorted(piglit_results['tests'].keys()): + if test in ignore_tests: + continue + result = map_result_to_lava(piglit_results['tests'][test]['result']) + print("%s %s" % (test, result)) + + if __name__ == '__main__': if len(sys.argv) < 2: print("Usage: %s <result_dir|result_file> [ignore_file]" % sys.argv[0]) @@ -64,18 +74,7 @@ if __name__ == '__main__': continue piglit_result = None full_f = os.path.join(root, name) - with open(full_f, 'r') as f: - piglit_results = json.loads(f.read()) - for test in piglit_results.keys(): - if test in ignore_tests: - continue - result = map_result_to_lava(piglit_results[test]['result']) - print("%s %s" % (test, result)) + print_results(full_f, ignore_tests) else: - with open(sys.argv[1], 'r') as f: - piglit_results = json.loads(f.read()) - for test in sorted(piglit_results['tests'].keys()): - if test in ignore_tests: - continue - result = map_result_to_lava(piglit_results['tests'][test]['result']) - print("%s %s" % (test, result)) + print_results(sys.argv[1], ignore_tests) + |