[Piglit] [PATCH] results: assume version is 0 when loading from file

Dylan Baker baker.dylan.c at gmail.com
Wed Dec 31 10:46:55 PST 2014


What are you hitting that makes this necessary?  I wrote a little test
which suggests to me that unversioned results are going through the
update path successfully.

piglit wip/results_no_version

def test_testrunresult_load_no_version():
    """TestrunResult.load: Works when no version number is supplied."""
    data = copy.copy(utils.JSON_DATA)
    del data['results_version']

    with utils.tempdir() as tdir:
        with open(os.path.join(tdir, 'results.json'), 'w') as tfile:
            tfile.write(json.dumps(data))

        res = results.load_results(tdir)

    nt.assert_equal(res.results_version, backends.CURRENT_JSON_VERSION)

And I was able to delete the 'results_version' out of a results file and
load it succesfully with "piglit summary console"

On Wednesday, December 31, 2014 01:03:20 PM Ilia Mirkin wrote:
> Original files didn't have a version baked into them. Assume version 0
> for those. Newer files will overwrite the version with whatever is
> stored.
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  framework/results.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/framework/results.py b/framework/results.py
> index cfc2ec4..5819af5 100644
> --- a/framework/results.py
> +++ b/framework/results.py
> @@ -126,6 +126,7 @@ class TestrunResult(object):
>      def load(cls, results_file):
>          """Create a TestrunResult from a completed file."""
>          result = cls()
> +        result.results_version = 0
>          result.__dict__.update(json.load(results_file))
>  
>          for key, value in result.tests.iteritems():
> -- 
> 2.0.5
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20141231/d403903c/attachment.sig>


More information about the Piglit mailing list