Home | History | Annotate | Download | only in android
      1 # Copyright (c) 2014 The WebM project authors. All Rights Reserved.
      2 #
      3 # Use of this source code is governed by a BSD-style license
      4 # that can be found in the LICENSE file in the root of the source
      5 # tree. An additional intellectual property rights grant can be found
      6 # in the file PATENTS.  All contributing project authors may
      7 # be found in the AUTHORS file in the root of the source tree.
      8 
      9 """Standalone script which parses a gtest log for json.
     10 
     11 Json is returned returns as an array.  This script is used by the libvpx
     12 waterfall to gather json results mixed in with gtest logs.  This is
     13 dubious software engineering.
     14 """
     15 
     16 import json
     17 import re
     18 import sys
     19 
     20 
     21 def main():
     22   blob = sys.stdin.read()
     23   json_string = '[' + ','.join('{' + x + '}' for x in
     24                                re.findall(r'{([^}]*.?)}', blob)) + ']'
     25   print json.dumps(json.loads(json_string), indent=4, sort_keys=True)
     26 
     27 if __name__ == '__main__':
     28   sys.exit(main())
     29