aboutsummaryrefslogtreecommitdiff
path: root/tests/test_lavaandroidtest_testrunner.py
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-01-03 17:46:21 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-01-03 17:46:21 +0800
commitcf7013d6e23f0a0da3bcae5fb9d8e20639b1d21f (patch)
tree4888505a53fc2070d376945391ae48bbee333166 /tests/test_lavaandroidtest_testrunner.py
downloadlava-android-test-cf7013d6e23f0a0da3bcae5fb9d8e20639b1d21f.tar.gz
first commit
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'tests/test_lavaandroidtest_testrunner.py')
-rw-r--r--tests/test_lavaandroidtest_testrunner.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/test_lavaandroidtest_testrunner.py b/tests/test_lavaandroidtest_testrunner.py
new file mode 100644
index 0000000..0d0cd7d
--- /dev/null
+++ b/tests/test_lavaandroidtest_testrunner.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2010, 2011 Linaro
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import shutil
+import tempfile
+from datetime import datetime
+from tests.tests_util import makerunner
+from tests.imposters import OutputImposter, ConfigImposter
+from tests.fixtures import TestCaseWithFixtures
+
+
+class testTestRunner(TestCaseWithFixtures):
+ def setUp(self):
+ self.config = self.add_fixture(ConfigImposter())
+ self.out = self.add_fixture(OutputImposter())
+ self.origdir = os.path.abspath(os.curdir)
+ self.tmpdir = tempfile.mkdtemp()
+ self.filename = os.path.abspath(__file__)
+ os.chdir(self.tmpdir)
+ self.test_id = "ABC"
+
+ def tearDown(self):
+ os.chdir(self.origdir)
+ shutil.rmtree(self.tmpdir)
+
+ def test_starttime(self):
+ runner = makerunner()
+ runner.run('./')
+ self.assertTrue(isinstance(runner.starttime, datetime))
+
+ def test_endtime(self):
+ runner = makerunner()
+ runner.run('./')
+ self.assertTrue(isinstance(runner.endtime, datetime))
+
+ def test_timediff(self):
+ steps = ['sleep 2']
+ runner = makerunner(steps_host_pre=steps)
+ runner.run('./')
+ self.assertNotEqual(runner.starttime, runner.endtime)
+
+ def test_runsteps(self):
+ steps = ["echo test > foo"]
+ runner = makerunner(steps_host_pre=steps)
+ runner.run('./')
+ self.assertTrue(os.path.exists("./foo"))
+
+ def test_logoutput(self):
+ steps = ["echo test"]
+ runner = makerunner(steps_host_pre=steps)
+ runner.run('./')
+ self.assertTrue('test' in self.out.getvalue())