Commit 0618aa38 authored by Dylan Baker's avatar Dylan Baker

piglit-run.py: Record all attributes of Environment and restore them

This causes all attributes in the Environment instance env to be dumped
into the json and reloaded on a resume. It adds an __iter__ magic method
to core.Environment to allow this.

Reviewed by: Kenney Phillis <Kkphillisjr@gmail.com>
Signed-off-by: Dylan Baker's avatarDylan Baker <baker.dylan.c@gmail.com>
parent cb29ebf7
......@@ -62,6 +62,8 @@ class PiglitJSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, status.Status):
return str(o)
elif isinstance(o, set):
return list(o)
return json.JSONEncoder.default(self, o)
class JSONWriter:
......@@ -414,6 +416,9 @@ class Environment:
for each in exclude_filter:
self.exclude_filter.append(re.compile(each))
def __iter__(self):
return self.__dict__.iteritems()
def run(self, command):
try:
p = subprocess.Popen(command,
......
......@@ -137,9 +137,8 @@ def main():
json_writer.write_dict_key('options')
json_writer.open_dict()
json_writer.write_dict_item('profile', args.test_profile)
json_writer.write_dict_item('filter', args.include_tests)
json_writer.write_dict_item('exclude_filter', args.exclude_tests)
json_writer.write_dict_item('concurrency', args.concurrency)
for key, value in env:
json_writer.write_dict_item(key, value)
json_writer.close_dict()
json_writer.write_dict_item('name', results.name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment