Title: [151152] trunk/Tools
Revision
151152
Author
dpra...@chromium.org
Date
2013-06-03 21:51:57 -0700 (Mon, 03 Jun 2013)

Log Message

add a script to dump the tests run most recently by a given worker
https://bugs.webkit.org/show_bug.cgi?id=116571

Reviewed by Brent Fulgham.

The tests_run*.txt results files in layout-test-results/ were removed
in r137356, in favor of collecting more data about how the tests were
run and compressing it and storing it in stats.json. However, it was
nice to just be able to look at a flat text file.

This script will extract the tests run by a given worker from a
given stats.json file, and should help to address that.

* Scripts/dump-webkit-tests-run: Added.
(main):
(convert_trie_to_flat_paths):

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (151151 => 151152)


--- trunk/Tools/ChangeLog	2013-06-04 04:02:09 UTC (rev 151151)
+++ trunk/Tools/ChangeLog	2013-06-04 04:51:57 UTC (rev 151152)
@@ -1,3 +1,22 @@
+2013-06-03  Dirk Pranke  <dpra...@chromium.org>
+
+        add a script to dump the tests run most recently by a given worker
+        https://bugs.webkit.org/show_bug.cgi?id=116571
+
+        Reviewed by Brent Fulgham.
+
+        The tests_run*.txt results files in layout-test-results/ were removed
+        in r137356, in favor of collecting more data about how the tests were
+        run and compressing it and storing it in stats.json. However, it was
+        nice to just be able to look at a flat text file.
+
+        This script will extract the tests run by a given worker from a
+        given stats.json file, and should help to address that.
+
+        * Scripts/dump-webkit-tests-run: Added.
+        (main):
+        (convert_trie_to_flat_paths):
+
 2013-06-03  Brent Fulgham  <bfulg...@apple.com>
 
         [Windows] NRWT is not putting crash logs in proper place

Added: trunk/Tools/Scripts/dump-webkit-tests-run (0 => 151152)


--- trunk/Tools/Scripts/dump-webkit-tests-run	                        (rev 0)
+++ trunk/Tools/Scripts/dump-webkit-tests-run	2013-06-04 04:51:57 UTC (rev 151152)
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+import json
+import optparse
+import os
+import sys
+
+
+def main(argv):
+    parser = optparse.OptionParser(usage='%prog worker_number [path-to-stats.json]')
+    _, args = parser.parse_args(argv)
+
+    worker_number = int(args.pop(0))
+    if args:
+        if os.path.exists(args[0]):
+            with open(args[0], 'r') as fp:
+                trie = json.load(fp)
+        else:
+            print >> sys.stderr, "file not found: %s" % args[0]
+            sys.exit(1)
+    else:
+        trie = json.load(sys.stdin)
+
+    results = convert_trie_to_flat_paths(trie)
+    tests_run = []
+    for (test, result) in results.iteritems():
+        # Each result is a dict containing
+        # { 'results': [worker #, test # in worker, driver pid,
+        #   test time in msecs, test + compare time in msecs]}
+        if result['results'][0] == worker_number:
+            tests_run.append((test, result['results'][1]))
+
+    print "\n".join(t[0] for t in sorted(tests_run, key=lambda t: t[1]))
+
+
+def convert_trie_to_flat_paths(trie, prefix=None):
+    # Cloned from webkitpy.layout_tests.layout_package.json_results_generator
+    # so that this code can stand alone.
+    result = {}
+    for name, data in trie.iteritems():
+        if prefix:
+            name = prefix + "/" + name
+
+        if len(data) and not "results" in data:
+            result.update(convert_trie_to_flat_paths(data, name))
+        else:
+            result[name] = data
+
+    return result
+
+
+if __name__ ==  '__main__':
+    main(sys.argv[1:])
Property changes on: trunk/Tools/Scripts/dump-webkit-tests-run
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to