예제 #1
0
파일: profile.py 프로젝트: mesa3d/piglit
def make_test(element):
    """Rebuild a test instance from xml."""
    def process(elem, opt):
        k = elem.attrib['name']
        v = elem.attrib['value']
        try:
            opt[k] = ast.literal_eval(v)
        except ValueError:
            opt[k] = v

    type_ = element.attrib['type']
    options = {}
    for e in element.findall('./option'):
        process(e, options)
    options['env'] = {
        e.attrib['name']: e.attrib['value']
        for e in element.findall('./environment/env')
    }

    if type_ == 'gl':
        return PiglitGLTest(**options)
    if type_ == 'gl_builtin':
        return BuiltInConstantsTest(**options)
    if type_ == 'cl':
        return PiglitCLTest(**options)
    if type_ == 'cl_prog':
        return CLProgramTester(**options)
    if type_ == 'shader':
        return ShaderTest(**options)
    if type_ == 'glsl_parser':
        return GLSLParserTest(**options)
    if type_ == 'asm_parser':
        return ASMParserTest(**options)
    if type_ == 'vkrunner':
        return VkRunnerTest(**options)
    if type_ == 'multi_shader':
        options['skips'] = []
        for e in element.findall('./Skips/Skip/option'):
            skips = {}
            process(e, skips)
            options['skips'].append(skips)
        return MultiShaderTest(**options)
    if type_ == 'xts':
        return XTSTest(**options)
    if type_ == 'rendercheck':
        return RendercheckTest(**options)
    raise Exception('Unreachable')
예제 #2
0
def test_PiglitGLTest_include_and_exclude():
    """test.piglit_test.PiglitGLTest.is_skip(): raises if include and exclude are given."""
    with nt.assert_raises(AssertionError):
        PiglitGLTest(['foo'],
                     require_platforms=['glx'],
                     exclude_platforms=['gbm'])
예제 #3
0
def test_piglittest_command_getter_concurrent():
    """test.piglit_test.PiglitGLTest.command: adds -fbo and -auto to concurrent tests"""
    test = PiglitGLTest(['foo'], run_concurrent=True)
    nt.assert_in('-auto', test.command)
    nt.assert_in('-fbo', test.command)
예제 #4
0
def test_piglittest_command_getter_serial():
    """ PiglitGLTest.command adds -auto to serial tests """
    test = PiglitGLTest('foo')
    nt.assert_in('-auto', test.command)
예제 #5
0
 def test_platform_in_exclude(self, mock_options):
     """skips if platform is in exclude_platforms."""
     mock_options.env['PIGLIT_PLATFORM'] = 'glx'
     test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
     with pytest.raises(_TestIsSkip):
         test.is_skip()
예제 #6
0
 def test_platform_in_require(self, mock_options):
     """does not skip if platform is in require_platforms."""
     mock_options.env['PIGLIT_PLATFORM'] = 'glx'
     test = PiglitGLTest(['foo'], require_platforms=['glx'])
     test.is_skip()
예제 #7
0
 def test_getter_concurrent(self):
     """adds -fbo and -auto to concurrent tests."""
     test = PiglitGLTest(['foo'], run_concurrent=True)
     assert '-auto' in test.command
     assert '-fbo' in test.command
예제 #8
0
def test_PiglitGLTest_platform_not_in_exclude():
    """test.piglit_test.PiglitGLTest.is_skip(): does not skip if platform is in exclude_platforms"""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
    test.is_skip()
예제 #9
0
def test_initialize_piglitgltest():
    """ Test that PiglitGLTest initializes correctly """
    try:
        PiglitGLTest(['/bin/true'])
    except Exception as e:
        raise AssertionError(e)
예제 #10
0
def test_PiglitGLTest_platform_not_in_exclude():
    """PiglitGLTest.is_skip() does not skip if platform is in exclude_platforms."""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
    nt.assert_false(test.is_skip())
예제 #11
0
def test_PiglitGLTest_platform_in_exclude():
    """PiglitGLTest.is_skip() skips if platform is in exclude_platforms.."""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'glx'
    test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
    nt.assert_true(test.is_skip())
예제 #12
0
def test_PiglitGLTest_platform_not_in_require():
    """PiglitGLTest.is_skip() skips if platform is not in require_platforms."""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], require_platforms=['glx'])
    nt.assert_true(test.is_skip())
def test_PiglitGLTest_platform_in_exclude(mock_opts):
    """test.piglit_test.PiglitGLTest.is_skip(): skips if platform is in exclude_platforms"""
    mock_opts.env['PIGLIT_PLATFORM'] = 'glx'
    test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
    test.is_skip()
def test_PiglitGLTest_platform_in_require(mock_opts):
    """test.piglit_test.PiglitGLTest.is_skip(): does not skip if platform is in require_platforms"""
    mock_opts.env['PIGLIT_PLATFORM'] = 'glx'
    test = PiglitGLTest(['foo'], require_platforms=['glx'])
    test.is_skip()
예제 #15
0
 def test_setter_no_add_auto(self):
     """Doesn't add -fbo or -auto when setting."""
     test = PiglitGLTest(['foo'], run_concurrent=True)
     test.command += ['bar']
     assert '-auto' not in test._command
     assert '-fbo' not in test._command
예제 #16
0
def test_PiglitGLTest_platform_in_require():
    """PiglitGLTest.is_skip() does not skip if platform is in require_platforms."""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'glx'
    test = PiglitGLTest(['foo'], require_platforms=['glx'])
    nt.assert_false(test.is_skip())
예제 #17
0
def test_PiglitGLTest_platform_not_in_require():
    """test.piglit_test.PiglitGLTest.is_skip(): skips if platform is not in require_platforms"""
    PiglitGLTest.OPTS.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], require_platforms=['glx'])
    test.is_skip()
예제 #18
0
def test_PiglitGLTest_platform_not_in_require(mock_opts):
    """test.piglit_test.PiglitGLTest.is_skip(): skips if platform is not in require_platforms"""
    mock_opts.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], require_platforms=['glx'])
    test.is_skip()
예제 #19
0
 def test_getter_serial(self):
     """adds -auto to serial tests."""
     test = PiglitGLTest(['foo'])
     assert '-auto' in test.command
예제 #20
0
def test_PiglitGLTest_platform_not_in_exclude(mock_opts):
    """test.piglit_test.PiglitGLTest.is_skip(): does not skip if platform is in exclude_platforms"""
    mock_opts.env['PIGLIT_PLATFORM'] = 'gbm'
    test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
    test.is_skip()
예제 #21
0
 def test_include_and_exclude(self):
     """ raises if include and exclude are given."""
     with pytest.raises(AssertionError):
         PiglitGLTest(['foo'],
                      require_platforms=['glx'],
                      exclude_platforms=['gbm'])
예제 #22
0
def test_initialize_piglitgltest():
    """test.piglit_test.PiglitGLTest: Class initializes"""
    PiglitGLTest(['/bin/true'])
예제 #23
0
 def test_platform_not_in_require(self, mock_options):
     """skips if platform is not in require_platforms."""
     mock_options.env['PIGLIT_PLATFORM'] = 'gbm'
     test = PiglitGLTest(['foo'], require_platforms=['glx'])
     with pytest.raises(_TestIsSkip):
         test.is_skip()
예제 #24
0
def test_piglittest_command_getter_serial():
    """test.piglit_test.PiglitGLTest.command: adds -auto to serial tests"""
    test = PiglitGLTest(['foo'])
    nt.assert_in('-auto', test.command)
예제 #25
0
 def test_platform_not_in_exclude(self, mock_options):
     """does not skip if platform is in exclude_platforms."""
     mock_options.env['PIGLIT_PLATFORM'] = 'gbm'
     test = PiglitGLTest(['foo'], exclude_platforms=['glx'])
     test.is_skip()
예제 #26
0
 def test_signature(self):
     test = PiglitGLTest(['foo'], env=None)