From a634d90e4ac80027466782975007de33afcb4c28 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 22 Nov 2019 12:46:36 -0500 Subject: [PATCH] Add a script to extra logs for particular test filenames from full WPT logs. --- etc/wpt-summarize.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 etc/wpt-summarize.py diff --git a/etc/wpt-summarize.py b/etc/wpt-summarize.py new file mode 100644 index 000000000000..48883a74126d --- /dev/null +++ b/etc/wpt-summarize.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright 2019 The Servo Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import sys +import json + +full_search = len(sys.argv) > 3 and sys.argv[3] == '--full' + +with open(sys.argv[1]) as f: + data = f.readlines() + thread = None + for entry in data: + entry = json.loads(entry) + if thread and "thread" in entry: + if entry["thread"] == thread: + print(json.dumps(entry)) + if "action" in entry and entry["action"] == "test_end": + thread = None + else: + if "action" in entry and \ + entry["action"] == "test_start" and \ + entry["test"] == sys.argv[2]: + thread = entry["thread"] + print(json.dumps(entry)) + elif full_search and \ + "command" in entry and \ + sys.argv[2] in entry["command"]: + thread = entry["thread"] + print(json.dumps(entry))