From e1574b94e6747b57de248a4271751f4e6b8dd51c Mon Sep 17 00:00:00 2001 From: Joshua Litt <joshualitt@google.com> Date: Fri, 28 Mar 2014 13:13:56 -0700 Subject: [PATCH] Small script to scrape json for waterfall Change-Id: I879fcd3203c84fa83125e06662009d308bc2dbb6 --- test/android/scrape_gtest_log.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/android/scrape_gtest_log.py diff --git a/test/android/scrape_gtest_log.py b/test/android/scrape_gtest_log.py new file mode 100644 index 0000000000..c159c89383 --- /dev/null +++ b/test/android/scrape_gtest_log.py @@ -0,0 +1,28 @@ +# Copyright (c) 2014 The WebM project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +"""Standalone script which parses a gtest log for json. + +Json is returned returns as an array. This script is used by the libvpx +waterfall to gather json results mixed in with gtest logs. This is +dubious software engineering. +""" + +import json +import re +import sys + + +def main(): + blob = sys.stdin.read() + json_string = '[' + ','.join('{' + x + '}' for x in + re.findall(r'{([^}]*.?)}', blob)) + ']' + print json.dumps(json.loads(json_string), indent=4, sort_keys=True) + +if __name__ == '__main__': + sys.exit(main()) -- GitLab