def test_run(self): config = get_config() test_name = 'foo' clear_fake() testrunner = makerunner(steps_host_pre=["echo foo"]) test = maketest(name=test_name, runner=testrunner) real_installed_path = '%s/%s/%s' % (test_tmp, config.installdir_android, test_name) test.setadb(FakeAdb()) self.assertFalse(os.path.exists(real_installed_path)) test.install() self.assertTrue(os.path.exists(real_installed_path)) fake_adb(output_str=fake_output_str) result_id = test.run() self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue()) result_id_pattern = "foo\d+\.\d+" self.assertTrue(re.match(result_id_pattern, result_id)) self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue()) test.uninstall() self.assertFalse(os.path.exists(real_installed_path))
def test_run(self): config = get_config() test_name = 'foo' clear_fake() testrunner = makerunner(steps_host_pre=["echo foo"]) test = maketest(name=test_name, runner=testrunner) real_installed_path = '%s/%s/%s' % ( test_tmp, config.installdir_android, test_name) test.setadb(FakeAdb()) self.assertFalse(os.path.exists(real_installed_path)) test.install() self.assertTrue(os.path.exists(real_installed_path)) fake_adb(output_str=fake_output_str) result_id = test.run() self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue()) result_id_pattern = "foo\d+\.\d+" self.assertTrue(re.match(result_id_pattern, result_id)) self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue()) test.uninstall() self.assertFalse(os.path.exists(real_installed_path))
def test_logoutput(self): steps = ["echo test"] runner = makerunner(steps_host_pre=steps) runner.run('./') self.assertTrue('test' in self.out.getvalue())
def test_runsteps(self): steps = ["echo test > foo"] runner = makerunner(steps_host_pre=steps) runner.run('./') self.assertTrue(os.path.exists("./foo"))
def test_timediff(self): steps = ['sleep 2'] runner = makerunner(steps_host_pre=steps) runner.run('./') self.assertNotEqual(runner.starttime, runner.endtime)
def test_endtime(self): runner = makerunner() runner.run('./') self.assertTrue(isinstance(runner.endtime, datetime))