[Piglit] [PATCH] results: assume version is 0 when loading from file
Ilia Mirkin
imirkin at alum.mit.edu
Wed Dec 31 10:58:53 PST 2014
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
>>
More information about the Piglit
mailing list