[Piglit] [PATCH 13/19] python: Rename json_writer instances to backend
Dylan Baker
baker.dylan.c at gmail.com
Thu Aug 28 15:35:41 PDT 2014
Since we are adding additional backends it makes sense to give the
backend instances a more generic name.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/profile.py | 9 +++++----
framework/programs/run.py | 18 +++++++++---------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/framework/profile.py b/framework/profile.py
index 8dfb741..b801147 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -167,7 +167,7 @@ class TestProfile(object):
"""
pass
- def run(self, opts, json_writer):
+ def run(self, opts, backend):
""" Runs all tests using Thread pool
When called this method will flatten out self.tests into
@@ -182,7 +182,8 @@ class TestProfile(object):
Arguments:
opts -- a core.Options instance
- json_writer -- a core.JSONWriter instance
+ backend -- a results.Backend derived instance
+
"""
@@ -197,12 +198,12 @@ class TestProfile(object):
def test(pair):
""" Function to call test.execute from .map
- Adds opts and json_writer which are needed by Test.execute()
+ Adds opts which are needed by Test.execute()
"""
name, test = pair
test.execute(name, log, self.dmesg)
- json_writer.write_test(name, test.result)
+ backend.write_test(name, test.result)
def run_threads(pool, testlist):
""" Open a pool, close it, and join it """
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 3639a16..8493611 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -220,7 +220,7 @@ def run(input_):
# Begin json.
result_filepath = path.join(args.results_path, 'results.json')
- json_writer = framework.results.JSONWriter(
+ backend = framework.results.JSONWriter(
result_filepath,
options,
file_fsync=opts.sync)
@@ -232,11 +232,11 @@ def run(input_):
# Set the dmesg type
if args.dmesg:
profile.dmesg = args.dmesg
- profile.run(opts, json_writer)
+ profile.run(opts, backend)
time_end = time.time()
results.time_elapsed = time_end - time_start
- json_writer.finalize({'time_elapsed': results.time_elapsed})
+ backend.finalize({'time_elapsed': results.time_elapsed})
print('Thank you for running Piglit!\n'
'Results have been written to ' + result_filepath)
@@ -271,12 +271,12 @@ def resume(input_):
results.options['env'] = core.collect_system_info()
results_path = path.join(args.results_path, 'results.json')
- json_writer = framework.results.JSONWriter(results_path,
- results.options,
- file_fsync=opts.sync)
+ backend = framework.results.JSONWriter(results_path,
+ results.options,
+ file_fsync=opts.sync)
for key, value in results.tests.iteritems():
- json_writer.write_test(key, value)
+ backend.write_test(key, value)
opts.exclude_tests.add(key)
profile = framework.profile.merge_test_profiles(results.options['profile'])
@@ -285,9 +285,9 @@ def resume(input_):
profile.dmesg = opts.dmesg
# This is resumed, don't bother with time since it wont be accurate anyway
- profile.run(opts, json_writer)
+ profile.run(opts, backend)
- json_writer.finalize()
+ backend.finalize()
print("Thank you for running Piglit!\n"
"Results have ben wrriten to {0}".format(results_path))
--
2.1.0
More information about the Piglit
mailing list