On 17 February 2012 01:38, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When resuming an interrupted piglit run, we'll want to output both<br>
existing and new results into the same 'tests' section. Since<br>
TestProfile.run only handles newly run tests, it can't open/close the<br>
JSON dictionary.<br>
<br>
So, move it to the caller in piglit-run.py.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> [v1]<br>
---<br>
framework/core.py | 4 ----<br>
piglit-run.py | 9 +++++++--<br>
2 files changed, 7 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/framework/core.py b/framework/core.py<br>
index a84c68f..2af8ed3 100644<br>
--- a/framework/core.py<br>
+++ b/framework/core.py<br>
@@ -514,9 +514,6 @@ class TestProfile:<br>
<br>
See ``Test.schedule`` and ``Test.run``.<br>
'''<br>
- json_writer.write_dict_key('tests')<br>
- json_writer.open_dict()<br>
-<br>
def matches_any_regexp(x, re_list):<br>
return True in map(lambda r: r.search(x) != None, re_list)<br>
<br>
@@ -539,7 +536,6 @@ class TestProfile:<br>
if not env.concurrent or not test.runConcurrent:<br>
test.doRun(env, path, json_writer)<br>
ConcurrentTestPool().join()<br>
- json_writer.close_dict()<br>
<br>
def remove_test(self, test_path):<br>
"""Remove a fully qualified test from the profile.<br>
diff --git a/piglit-run.py b/piglit-run.py<br>
index b6f8bf5..2867a73 100755<br>
--- a/piglit-run.py<br>
+++ b/piglit-run.py<br>
@@ -132,11 +132,16 @@ def main():<br>
json_writer.write_dict_item(key, value)<br>
<br>
profile = core.loadTestProfile(profileFilename, resultsDir)<br>
- time_start = time.time()<br>
<br>
- profile.run(env, json_writer)<br>
+ json_writer.write_dict_key('tests')<br>
+ json_writer.open_dict()<br>
<br>
+ time_start = time.time()<br>
+ profile.run(env, json_writer)<br>
time_end = time.time()<br>
+<br>
+ json_writer.close_dict()<br>
+<br></blockquote><div><br>And as a side bonus, all of that time wasted in write_dict_key, open_dict, and close_dict is no longer accounted for in the elapsed time :P<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
results.time_elapsed = time_end - time_start<br>
json_writer.write_dict_item('time_elapsed', results.time_elapsed)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.7.7.6<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>