diff options
author | Dylan Baker <dylanx.c.baker@intel.com> | 2014-10-23 14:23:26 -0700 |
---|---|---|
committer | Dylan Baker <dylanx.c.baker@intel.com> | 2014-10-31 09:00:24 -0700 |
commit | af7a95e9471fdab30a7e274da93508b357de4924 (patch) | |
tree | 5fe8b9c4e3c36865be83598504951e2bda26ac82 | |
parent | 0da103aff229bdea3b1b0a56e73b4080e914110d (diff) |
framework: fix glxinfo, uname, and lspci in json output
Move the environment information back into the root of the json output
dictionary.
Also modifies two tests. One is removed because it is basically a
duplicate of the tests added in the last patch, the other is simplified
to be more robust.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r-- | framework/backends/json_.py | 8 | ||||
-rw-r--r-- | framework/programs/run.py | 11 | ||||
-rw-r--r-- | framework/tests/backends_tests.py | 37 |
3 files changed, 13 insertions, 43 deletions
diff --git a/framework/backends/json_.py b/framework/backends/json_.py index 4632680a7..f4a740f1d 100644 --- a/framework/backends/json_.py +++ b/framework/backends/json_.py @@ -79,14 +79,10 @@ class JSONBackend(FileBackend): """ # If metadata is None then this is a loaded result and there is no need # to initialize - out = { - 'results_version': CURRENT_JSON_VERSION, - 'name': metadata['name'], - 'options': {k: v for k, v in metadata.iteritems() if k != 'name'}, - } + metadata['results_version'] = CURRENT_JSON_VERSION with open(os.path.join(self._dest, 'metadata.json'), 'w') as f: - json.dump(out, f, default=piglit_encoder) + json.dump(metadata, f, default=piglit_encoder) # make the directory for the tests try: diff --git a/framework/programs/run.py b/framework/programs/run.py index 573a193ad..093271bf8 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -193,15 +193,18 @@ def _run_parser(input_): def _create_metadata(args, name, opts): """Create and return a metadata dict for Backend.initialize().""" - options = {'profile': args.test_profile} + options = {} + options['profile'] = args.test_profile for key, value in opts: options[key] = value if args.platform: options['platform'] = args.platform - options['name'] = name - options['env'] = core.collect_system_info() - return options + metadata = {'options': options} + metadata['name'] = name + metadata.update(core.collect_system_info()) + + return metadata def _disable_windows_exception_messages(): diff --git a/framework/tests/backends_tests.py b/framework/tests/backends_tests.py index 177225d74..dc73f2f5d 100644 --- a/framework/tests/backends_tests.py +++ b/framework/tests/backends_tests.py @@ -32,6 +32,7 @@ try: except ImportError: import json import nose.tools as nt +import framework.core as core import framework.results as results import framework.backends as backends import framework.tests.utils as utils @@ -39,8 +40,9 @@ import framework.tests.utils as utils BACKEND_INITIAL_META = { 'name': 'name', - 'env': {}, 'test_count': 0, + 'env': {}, + 'options': {k: v for k, v in core.Options()}, } JUNIT_SCHEMA = 'framework/tests/schema/junit-7.xsd' @@ -164,23 +166,11 @@ class TestJUnitMultiTest(TestJUnitSingleTest): def test_json_initialize_metadata(): """ JSONBackend.initialize() produces a metadata.json file """ - baseline = { - 'name': BACKEND_INITIAL_META['name'], - 'results_version': backends.CURRENT_JSON_VERSION, - 'options': { - 'test_count': BACKEND_INITIAL_META['test_count'], - 'env': BACKEND_INITIAL_META['env'], - } - } - with utils.tempdir() as f: test = backends.JSONBackend(f) test.initialize(BACKEND_INITIAL_META) - with open(os.path.join(f, 'metadata.json'), 'r') as t: - test = json.load(t) - - nt.assert_dict_equal(baseline, test) + nt.ok_(os.path.exists(os.path.join(f, 'metadata.json'))) class TestJSONTestMethod(utils.StaticDirectory): @@ -254,25 +244,6 @@ class TestJSONTestFinalize(utils.StaticDirectory): except Exception as e: raise AssertionError(e) - def test_results_correct(self): - """ JSONBackend.finalize() results are expected """ - baseline = { - 'name': BACKEND_INITIAL_META['name'], - 'results_version': backends.CURRENT_JSON_VERSION, - 'options': { - 'test_count': BACKEND_INITIAL_META['test_count'], - 'env': BACKEND_INITIAL_META['env'], - }, - 'tests': { - self.test_name: dict(self.result) - } - } - - with open(os.path.join(self.tdir, 'results.json'), 'r') as f: - test = json.load(f) - - nt.assert_equal(baseline, test) - def test_junit_skips_bad_tests(): """ backends.JUnitBackend skips illformed tests """ |