[Piglit] [PATCH] results: assume version is 0 when loading from file
Dylan Baker
baker.dylan.c at gmail.com
Wed Dec 31 11:01:06 PST 2014
Okay, that makes sense.
Reviewed-by: Dylan Baker <dylanx.c.baker at intel.com>
On Wednesday, December 31, 2014 01:58:53 PM Ilia Mirkin wrote:
> On Wed, Dec 31, 2014 at 1:46 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> > What are you hitting that makes this necessary? I wrote a little test
>
> My old results files :) They _load_ just fine, just that the fixups
> aren't applied because the results_version is initialized to
> CURRENT_JSON_VERSION in the TestrunResult constructor.
>
> Sample file at http://people.freedesktop.org/~imirkin/piglit/nv18-2014-01-29-imirkin.xz
>
> > 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/4398d321/attachment.sig>
More information about the Piglit
mailing list