[Piglit] [PATCH 3/4] Move writing of JSON 'tests' dictionary section out of TestProfile.run.

Paul Berry stereotype441 at gmail.com
Fri Feb 24 14:26:17 PST 2012


On 17 February 2012 01:38, Kenneth Graunke <kenneth at whitecape.org> wrote:

> When resuming an interrupted piglit run, we'll want to output both
> existing and new results into the same 'tests' section.  Since
> TestProfile.run only handles newly run tests, it can't open/close the
> JSON dictionary.
>
> So, move it to the caller in piglit-run.py.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> Reviewed-by: Paul Berry <stereotype441 at gmail.com> [v1]
> ---
>  framework/core.py |    4 ----
>  piglit-run.py     |    9 +++++++--
>  2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/framework/core.py b/framework/core.py
> index a84c68f..2af8ed3 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -514,9 +514,6 @@ class TestProfile:
>
>                See ``Test.schedule`` and ``Test.run``.
>                '''
> -               json_writer.write_dict_key('tests')
> -               json_writer.open_dict()
> -
>                def matches_any_regexp(x, re_list):
>                        return True in map(lambda r: r.search(x) != None,
> re_list)
>
> @@ -539,7 +536,6 @@ class TestProfile:
>                        if not env.concurrent or not test.runConcurrent:
>                                test.doRun(env, path, json_writer)
>                ConcurrentTestPool().join()
> -               json_writer.close_dict()
>
>        def remove_test(self, test_path):
>                """Remove a fully qualified test from the profile.
> diff --git a/piglit-run.py b/piglit-run.py
> index b6f8bf5..2867a73 100755
> --- a/piglit-run.py
> +++ b/piglit-run.py
> @@ -132,11 +132,16 @@ def main():
>                json_writer.write_dict_item(key, value)
>
>        profile = core.loadTestProfile(profileFilename, resultsDir)
> -       time_start = time.time()
>
> -       profile.run(env, json_writer)
> +       json_writer.write_dict_key('tests')
> +       json_writer.open_dict()
>
> +       time_start = time.time()
> +       profile.run(env, json_writer)
>        time_end = time.time()
> +
> +       json_writer.close_dict()
> +
>

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


>        results.time_elapsed = time_end - time_start
>        json_writer.write_dict_item('time_elapsed', results.time_elapsed)
>
> --
> 1.7.7.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120224/baa18e9a/attachment.htm>


More information about the Piglit mailing list