コード例 #1
0
ファイル: opengl.py プロジェクト: austriancoder/piglit
class FastSkipDisabled(object):
    """A no-op version of FastSkip."""

    __slots__ = ['api', 'extensions', 'api_version', 'shader_version']

    info = wflinfo.WflInfo()

    def __init__(self, api=None, extensions=None, api_version=None,
                 shader_version=None):
        self.extensions = set()
        self.api = api
        self.api_version = api_version
        self.shader_version = shader_version

    def test(self):
        pass
コード例 #2
0
ファイル: opengl.py プロジェクト: pnmanolova/piglit
class FastSkip(object):
    """A class for testing OpenGL requirements.

    This class provides a mechanism for testing OpenGL requirements, and
    skipping tests that have unmet requirements

    This requires wflinfo to be installed and accessible to provide its
    functionality, however, it will no-op if wflinfo is not accessible.

    The design of this function is conservative. The design goal is that it
    it is better to run a few tests that could have been skipped, than to skip
    all the tests that could have, but also a few that should have run.

    Keyword Arguments:
    gl_required     -- This is a set of extensions that are required for
                       running the test.
    gl_version      -- A float that is the required version number for an
                       OpenGL test.
    gles_version    -- A float that is the required version number for an
                       OpenGL ES test
    glsl_version    -- A float that is the required version number of OpenGL
                       Shader Language for a test
    glsl_es_version -- A float that is the required version number of OpenGL ES
                       Shader Language for a test
    """
    __slots__ = [
        'gl_required', 'gl_version', 'gles_version', 'glsl_version',
        'glsl_es_version'
    ]

    info = wflinfo.WflInfo()

    def __init__(self,
                 gl_required=None,
                 gl_version=None,
                 gles_version=None,
                 glsl_version=None,
                 glsl_es_version=None):
        self.gl_required = gl_required or set()
        self.gl_version = gl_version
        self.gles_version = gles_version
        self.glsl_version = glsl_version
        self.glsl_es_version = glsl_es_version

    def test(self):
        """Skip this test if any of its feature requirements are unmet.

        If no extensions were calculated (if wflinfo isn't installed) then run
        all tests.

        Raises:
        TestIsSkip   -- if any of the conditions passed to self are false
        """
        if self.info.gl_extensions:
            for extension in self.gl_required:
                if extension not in self.info.gl_extensions:
                    raise TestIsSkip(
                        'Test requires extension {} '
                        'which is not available'.format(extension))

        # TODO: Be able to handle any operator
        if (self.info.gl_version is not None and self.gl_version is not None
                and self.gl_version > self.info.gl_version):
            raise TestIsSkip('Test requires OpenGL version {}, '
                             'but only {} is available'.format(
                                 self.gl_version, self.info.gl_version))

        # TODO: Be able to handle any operator
        if (self.info.gles_version is not None
                and self.gles_version is not None
                and self.gles_version > self.info.gles_version):
            raise TestIsSkip('Test requires OpenGL ES version {}, '
                             'but only {} is available'.format(
                                 self.gles_version, self.info.gles_version))

        # TODO: Be able to handle any operator
        if (self.info.glsl_version is not None
                and self.glsl_version is not None
                and self.glsl_version > self.info.glsl_version):
            raise TestIsSkip(
                'Test requires OpenGL Shader Language version {}, '
                'but only {} is available'.format(self.glsl_version,
                                                  self.info.glsl_version))

        # TODO: Be able to handle any operator
        if (self.info.glsl_es_version is not None
                and self.glsl_es_version is not None
                and self.glsl_es_version > self.info.glsl_es_version):
            raise TestIsSkip(
                'Test requires OpenGL ES Shader Language version {}, '
                'but only {} is available'.format(self.glsl_es_version,
                                                  self.info.glsl_es_version))
コード例 #3
0
ファイル: test_wflinfo.py プロジェクト: yaongtime/piglit
 def setup(self):
     """Setup each instance, patching necissary bits."""
     self._test = wflinfo.WflInfo()
コード例 #4
0
ファイル: test_wflinfo.py プロジェクト: yaongtime/piglit
 def inst(self):
     return wflinfo.WflInfo()
コード例 #5
0
ファイル: opengl.py プロジェクト: austriancoder/piglit
class FastSkip(object):
    """A class for testing OpenGL requirements.

    This class provides a mechanism for testing OpenGL requirements, and
    skipping tests that have unmet requirements

    This requires wflinfo to be installed and accessible to provide its
    functionality, however, it will no-op if wflinfo is not accessible.

    The design of this function is conservative. The design goal is that it
    it is better to run a few tests that could have been skipped, than to skip
    all the tests that could have, but also a few that should have run.

    Keyword Arguments:
    api            -- The API required.
                      One of [gles1, gles2, gles3, core, compat]
    extensions     -- A set of extensions required
    api_version    -- The version of the API required
    shader_version -- The versoin of the shader language required
    """
    __slots__ = ['api', 'extensions', 'api_version', 'shader_version']

    info = wflinfo.WflInfo()

    def __init__(self, api=None, extensions=None, api_version=None,
                 shader_version=None):
        self.extensions = extensions or set()
        self.api = api
        self.api_version = api_version
        self.shader_version = shader_version

    def test(self):
        """Skip this test if any of its feature requirements are unmet.

        If no extensions were calculated (if wflinfo isn't installed) then run
        all tests.

        Raises:
        TestIsSkip   -- if any of the conditions passed to self are false
        """
        if not self.api:
            check = self.info.compat
        elif self.api in ['gles2', 'gles3']:
            check = self.info.es2
        elif self.api == 'gles1':
            check = self.info.es1
        else:
            check = getattr(self.info, self.api)

        if check.extensions:
            for extension in self.extensions:
                if extension not in check.extensions:
                    raise TestIsSkip(
                        'Test requires extension {} '
                        'which is not available'.format(extension))

        # TODO: Be able to handle any operator
        if (check.api_version is not None
                and self.api_version is not None
                and self.api_version > check.api_version):
            raise TestIsSkip(
                'Test requires OpenGL {} version {}, '
                'but only {} is available'.format(
                    self.api, self.api_version, check.api_version))

        # TODO: Be able to handle any operator
        if (check.shader_version is not None
                and self.shader_version is not None
                and self.shader_version > check.shader_version):
            raise TestIsSkip(
                'Test requires OpenGL {} Shader Language version {}, '
                'but only {} is available'.format(
                    self.api, self.shader_version, check.shader_version))