--- framework/profile.py | 14 +--- framework/programs/print_commands.py | 8 +- framework/test/__init__.py | 1 - framework/test/gleantest.py | 77 ------------------ unittests/framework/test/test_gleantest.py | 122 ----------------------------- unittests/framework/test_profile.py | 12 --- 6 files changed, 6 insertions(+), 228 deletions(-) delete mode 100644 framework/test/gleantest.py delete mode 100644 unittests/framework/test/test_gleantest.py
diff --git a/framework/profile.py b/framework/profile.py index a19b4d2..d77ac09 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -219,17 +219,11 @@ class TestDict(collections.MutableMapping): kwargs -- Any additional args will be passed directly to the test constructor as keyword args. """ - # If there is no name, then either - # a) join the arguments list together to make the name - # b) use the argument string as the name - # The former is used by the Piglit{G,C}LTest classes, the latter by - # GleanTest + # If there is no name, join the arguments list together to make + # the name if not name: - if isinstance(args, list): - name = ' '.join(args) - else: - assert isinstance(args, six.string_types) - name = args + assert isinstance(args, list) # // + name = ' '.join(args) assert isinstance(name, six.string_types) lgroup = grouptools.join(group, name) diff --git a/framework/programs/print_commands.py b/framework/programs/print_commands.py index 8accb2b..511ccdb 100644 --- a/framework/programs/print_commands.py +++ b/framework/programs/print_commands.py @@ -36,21 +36,17 @@ import six from . import parsers from framework import options, profile, exceptions -from framework.test import Test, GleanTest +from framework.test import Test def get_command(test, piglit_dir): """Get just the name of the command with a path relative to bin.""" - command = '' - if isinstance(test, GleanTest): - for var, val in test.env.items(): - command += "{}='{}'".format(var, val) # Make the test command relative to the piglit_dir test_command = test.command[:] test_command[0] = os.path.relpath(test_command[0], piglit_dir) - command += ' '.join(test_command) + command = ' '.join(test_command) return command diff --git a/framework/test/__init__.py b/framework/test/__init__.py index edb4d3e..d305929 100644 --- a/framework/test/__init__.py +++ b/framework/test/__init__.py @@ -29,7 +29,6 @@ from __future__ import ( ) from .base import * from .piglit_test import * -from .gleantest import * from .glsl_parser_test import * from .shader_test import * from .gtest import * diff --git a/framework/test/gleantest.py b/framework/test/gleantest.py deleted file mode 100644 index 0220c1a..0000000 --- a/framework/test/gleantest.py +++ /dev/null @@ -1,77 +0,0 @@ -# Permission is hereby granted, free of charge, to any person - -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# This permission notice shall be included in all copies or -# substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -""" Glean support """ - -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) -import os - -from framework import options -from .base import Test, TestIsSkip -from .piglit_test import TEST_BIN_DIR - -__all__ = [ - 'GleanTest', -] - - -# GleanTest: Execute a sub-test of Glean -class GleanTest(Test): - """ Execute a glean subtest - - This class descendes from exectest.Test, and provides methods for running - glean tests. - - """ - GLOBAL_PARAMS = [] - _EXECUTABLE = os.path.join(TEST_BIN_DIR, "glean") - - def __init__(self, name, **kwargs): - super(GleanTest, self).__init__( - [self._EXECUTABLE, "-o", "-v", "-v", "-v", "-t", "+" + name], - **kwargs) - - @Test.command.getter - def command(self): - return super(GleanTest, self).command + self.GLOBAL_PARAMS - - @command.setter - def command(self, new): - self._command = [n for n in new if not n in self.GLOBAL_PARAMS] - - def interpret_result(self): - if self.result.returncode != 0 or 'FAIL' in self.result.out: - self.result.result = 'fail' - else: - self.result.result = 'pass' - super(GleanTest, self).interpret_result() - - def is_skip(self): - # Glean tests require glx - if options.OPTIONS.env['PIGLIT_PLATFORM'] not in ['glx', 'mixed_glx_egl']: - raise TestIsSkip( - 'Glean tests require platform to support glx, ' - 'but the platform is "{}"'.format( - options.OPTIONS.env['PIGLIT_PLATFORM'])) - super(GleanTest, self).is_skip() diff --git a/unittests/framework/test/test_gleantest.py b/unittests/framework/test/test_gleantest.py deleted file mode 100644 index 3ff2b8c..0000000 --- a/unittests/framework/test/test_gleantest.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright (c) 2014 Intel Corporation - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -""" Tests for the glean class. Requires Nose """ - -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - -import pytest - -from framework.options import _Options as Options -from framework import status -from framework.test import GleanTest -from framework.test.base import TestIsSkip as _TestIsSkip # make py.test happy - -# pylint: disable=invalid-name -# pylint: disable=protected-access - - -def test_GLOBAL_PARAMS_assignment(): - """test.gleantest.GleanTest: GLOBAL_PARAMS apply to instances created - after GLABL_PARAMS is set. - - Specifically this tests for a bug where GLOBAL_PARAMS only affected - instances of GleanTest created after GLOBAL_PARAMS were set, so changing the - GLOBAL_PARAMS value had unexpected results. - - If this test passes the GleanTest.command attributes will be the same in - the instance created before the GLOBAL_PARAMS assignment and the one created - after. A failure means the that GLOBAL_PARAMS are not being added to tests - initialized before it is set. - - """ - test1 = GleanTest('basic') - GleanTest.GLOBAL_PARAMS = ['--quick'] - test2 = GleanTest('basic') - assert test1.command == test2.command - assert '--quick' in test1.command - - -def test_global_params_setter(): - """Values from self.GLOBAL_ARGS are not pushed into self._command by a - setter. - """ - test = GleanTest('basic') - GleanTest.GLOBAL_PARAMS = ['--quick'] - test.command += '-foo' - assert '--quick' not in test._command - - - -def test_bad_returncode(): - """test.gleantest.GleanTest: If returncode is 0 the result is 'fail'. - - Currently glean returns 127 if piglit can't find it's libs (LD_LIBRARY_PATH - isn't set properly), and then marks such tests as pass, when they obviously - are not. - - """ - test = GleanTest('basic') - test.result.returncode = 1 - test.interpret_result() - assert test.result.result == 'fail' - - -def test_is_skip_not_glx(mocker): - """test.gleantest.GleanTest.is_skip: Skips when platform isn't glx.""" - opts = mocker.patch('framework.test.gleantest.options.OPTIONS', - new_callable=Options) - opts.env['PIGLIT_PLATFORM'] = 'gbm' - - test = GleanTest('foo') - with pytest.raises(_TestIsSkip): - test.is_skip() - - -def test_is_skip_glx(mocker): - """test.gleantest.GleanTest.is_skip: Does not skip when platform is glx.""" - opts = mocker.patch('framework.test.gleantest.options.OPTIONS', - new_callable=Options) - opts.env['PIGLIT_PLATFORM'] = 'glx' - - test = GleanTest('foo') - test.is_skip() - - -def test_is_skip_glx_egl(mocker): - """test.gleantest.GleanTest.is_skip: Does not skip when platform is - mixed_glx_egl.""" - opts = mocker.patch('framework.test.gleantest.options.OPTIONS', - new_callable=Options) - opts.env['PIGLIT_PLATFORM'] = 'mixed_glx_egl' - - test = GleanTest('foo') - test.is_skip() - - -def test_crash(): - """test.gleantest.GleanTest.interpret_result: Crashes are set to crash""" - test = GleanTest('foo') - test.result.returncode = -5 - test.interpret_result() - - assert test.result.result is status.CRASH diff --git a/unittests/framework/test_profile.py b/unittests/framework/test_profile.py index 99403cc..d86db1b 100644 --- a/unittests/framework/test_profile.py +++ b/unittests/framework/test_profile.py @@ -30,7 +30,6 @@ import six from framework import exceptions from framework import grouptools from framework import profile -from framework.test.gleantest import GleanTest from . import utils # pylint: disable=invalid-name,no-self-use,protected-access @@ -255,17 +254,6 @@ class TestTestDict(object): test = inst[grouptools.join('foo', 'a')] assert test.run_concurrent is False - def test_name_as_str(self, inst): - """if args is a string it is not joined. - - This is a "feature" of glean, and no longer needs to be protected - whenever glean dies. - """ - with inst.group_manager(GleanTest, 'foo') as g: - g('abc') - - assert grouptools.join('foo', 'abc') in inst - class TestRegexFilter(object): """Tests for the RegexFilter class.""" -- 2.7.4 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit