def test_timeout(): """test.base.Test.run(): kills tests that exceed timeout when set""" utils.binary_check("sleep", 1) class _Test(Test): def interpret_result(self): super(_Test, self).interpret_result() test = _Test(["sleep", "60"]) test.timeout = 1 test.run() nt.eq_(test.result.result, "timeout")
def test_timeout(): """test.base.Test.run(): kills tests that exceed timeout when set""" utils.binary_check('sleep') def helper(): if (test.result['returncode'] == 0): test.result['result'] = "pass" test = TestTest(['sleep', '60']) test.test_interpret_result = helper test.timeout = 1 test.run() assert test.result['result'] == 'timeout'
def test_timeout_pass(): """ Test that the correct result is returned if a test does not timeout """ utils.binary_check('true') def helper(): if (test.result['returncode'] == 0): test.result['result'] = "pass" test = TestTest("true") test.test_interpret_result = helper test.timeout = 1 test.run() assert test.result['result'] == 'pass'
def test_timeout(): """ Test that Test.timeout works correctly """ utils.binary_check('sleep') def helper(): if (test.result['returncode'] == 0): test.result['result'] = "pass" test = TestTest("sleep 60") test.test_interpret_result = helper test.timeout = 1 test.run() assert test.result['result'] == 'timeout'
def test_timeout_pass(): """test.base.Test.run(): Result is returned when timeout is set but not exceeded """ utils.binary_check('true') def helper(): if (test.result['returncode'] == 0): test.result['result'] = "pass" test = TestTest(['true']) test.test_interpret_result = helper test.timeout = 1 test.run() assert test.result['result'] == 'pass'
def test_timeout_pass(): """test.base.Test.run(): Result is returned when timeout is set but not exceeded """ utils.binary_check("true") def helper(): if test.result.returncode == 0: test.result.result = "pass" test = TestTest(["true"]) test.test_interpret_result = helper test.timeout = 1 test.run() nt.eq_(test.result.result, "pass")
def test_execute_dmesg(): """test.base.Test.execute: dmesg statuses are applied This tests only one contrived test for dmesg handling. It does though test that the path in execute to change the status works, which makes it a comprehensive test. """ if not os.path.exists("bin"): raise SkipTest("This tests requires a working, built version of " "piglit") utils.binary_check("true") # Create the test and then write to dmesg to ensure that it actually works class _localclass(utils.Test): def run(self): _write_dev_kmesg() super(_localclass, self).run() def interpret_result(self): self.result.result = "pass" test = _localclass(["true"]) test.execute(None, DummyLog(), _get_dmesg()) nt.eq_(test.result.result, "dmesg-warn")
def test_root_lspci(self): """JSON: lspci is a root key.""" utils.platform_check('linux') utils.binary_check('lspci') nt.assert_in('lspci', self.json)
def test_root_glxinfo(self): """JSON: glxinfo is a root key.""" utils.platform_check('linux') utils.binary_check('glxinfo') nt.assert_in('glxinfo', self.json)
def test_root_uname(self): """JSON: uname is a root key.""" utils.platform_check('linux') utils.binary_check('uname') nt.assert_in('uname', self.json)