shithub: libvpx

Download patch

ref: 01aae92dcfb879c7b5a965f40e46f1beec77a30a
parent: e8c1c95cdef8047478f0a3e36d8b6cefd0c5a106
parent: 15931a1df230523c18cf11189d95c3d1ddc64b07
author: Joshua Litt <joshualitt@google.com>
date: Mon Apr 7 10:43:56 EDT 2014

Merge "Small fixes to script based off of cry-infra"

--- a/test/android/scrape_gtest_log.py
+++ b/test/android/scrape_gtest_log.py
@@ -13,16 +13,45 @@
 dubious software engineering.
 """
 
+import getopt
 import json
+import os
 import re
 import sys
 
 
 def main():
+  if len(sys.argv) != 3:
+    print "Expects a file to write json to!"
+    exit(1)
+
+  try:
+    opts, _ = \
+        getopt.getopt(sys.argv[1:], \
+                      'o:', ['output-json='])
+  except getopt.GetOptError:
+    print 'scrape_gtest_log.py -o <output_json>'
+    sys.exit(2)
+
+  output_json = ''
+  for opt, arg in opts:
+    if opt in ('-o', '--output-json'):
+      output_json = os.path.join(arg)
+
   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)
+  print blob
+
+  output = json.dumps(json.loads(json_string), indent=4, sort_keys=True)
+  print output
+
+  path = os.path.dirname(output_json)
+  if path and not os.path.exists(path):
+    os.makedirs(path)
+
+  outfile = open(output_json, 'w')
+  outfile.write(output)
 
 if __name__ == '__main__':
   sys.exit(main())
--