diff options
| -rwxr-xr-x | bitbake/lib/toaster/contrib/tts/runner.py | 11 | ||||
| -rw-r--r-- | bitbake/lib/toaster/contrib/tts/tests.py | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/runner.py b/bitbake/lib/toaster/contrib/tts/runner.py index 6fc3e77523..bed665196e 100755 --- a/bitbake/lib/toaster/contrib/tts/runner.py +++ b/bitbake/lib/toaster/contrib/tts/runner.py | |||
| @@ -31,7 +31,7 @@ from __future__ import print_function | |||
| 31 | import sys, os | 31 | import sys, os |
| 32 | import unittest, importlib | 32 | import unittest, importlib |
| 33 | import logging, pprint, json | 33 | import logging, pprint, json |
| 34 | 34 | import re | |
| 35 | from shellutils import ShellCmdException, mkdirhier, run_shell_cmd | 35 | from shellutils import ShellCmdException, mkdirhier, run_shell_cmd |
| 36 | 36 | ||
| 37 | import config | 37 | import config |
| @@ -121,13 +121,16 @@ def execute_tests(dir_under_test, testname): | |||
| 121 | # pylint: disable=broad-except | 121 | # pylint: disable=broad-except |
| 122 | # we disable the broad-except because we want to actually catch all possible exceptions | 122 | # we disable the broad-except because we want to actually catch all possible exceptions |
| 123 | try: | 123 | try: |
| 124 | # sorting the tests by the numeric order in the class name | ||
| 125 | tests = sorted(tests, key=lambda x: int(re.search(r"[0-9]+", x[1]).group(0))) | ||
| 124 | config.logger.debug("Discovered test clases: %s", pprint.pformat(tests)) | 126 | config.logger.debug("Discovered test clases: %s", pprint.pformat(tests)) |
| 125 | unittest.installHandler() | 127 | unittest.installHandler() |
| 126 | suite = unittest.TestSuite() | 128 | suite = unittest.TestSuite() |
| 127 | loader = unittest.TestLoader() | 129 | loader = unittest.TestLoader() |
| 128 | result = unittest.TestResult() | 130 | result = unittest.TestResult() |
| 129 | for module_file, name in tests: | 131 | result.failfast = True |
| 130 | suite.addTest(loader.loadTestsFromName("%s.%s" % (module_file, name))) | 132 | for module_file, test_name in tests: |
| 133 | suite.addTest(loader.loadTestsFromName("%s.%s" % (module_file, test_name))) | ||
| 131 | config.logger.info("Running %d test(s)", suite.countTestCases()) | 134 | config.logger.info("Running %d test(s)", suite.countTestCases()) |
| 132 | suite.run(result) | 135 | suite.run(result) |
| 133 | 136 | ||
| @@ -202,7 +205,7 @@ def main(): | |||
| 202 | config.TESTDIR = testdir # we let tests know where to run | 205 | config.TESTDIR = testdir # we let tests know where to run |
| 203 | 206 | ||
| 204 | # ensure that the test dir only contains no *.pyc leftovers | 207 | # ensure that the test dir only contains no *.pyc leftovers |
| 205 | run_shell_cmd("find '%s' -type f -name *.pyc -exec rm {} \;" % testdir) | 208 | run_shell_cmd("find '%s' -type f -name *.pyc -exec rm {} \\;" % testdir) |
| 206 | 209 | ||
| 207 | no_failures = execute_tests(testdir, options.singletest) | 210 | no_failures = execute_tests(testdir, options.singletest) |
| 208 | 211 | ||
diff --git a/bitbake/lib/toaster/contrib/tts/tests.py b/bitbake/lib/toaster/contrib/tts/tests.py index 9acef46a38..3a4eed1e9f 100644 --- a/bitbake/lib/toaster/contrib/tts/tests.py +++ b/bitbake/lib/toaster/contrib/tts/tests.py | |||
| @@ -30,7 +30,7 @@ import config | |||
| 30 | import pexpect | 30 | import pexpect |
| 31 | import sys, os, signal, time | 31 | import sys, os, signal, time |
| 32 | 32 | ||
| 33 | class TestPyCompilable(unittest.TestCase): | 33 | class Test00PyCompilable(unittest.TestCase): |
| 34 | ''' Verifies that all Python files are syntactically correct ''' | 34 | ''' Verifies that all Python files are syntactically correct ''' |
| 35 | def test_compile_file(self): | 35 | def test_compile_file(self): |
| 36 | try: | 36 | try: |
| @@ -38,7 +38,7 @@ class TestPyCompilable(unittest.TestCase): | |||
| 38 | except ShellCmdException as exc: | 38 | except ShellCmdException as exc: |
| 39 | self.fail("Error compiling python files: %s" % (exc)) | 39 | self.fail("Error compiling python files: %s" % (exc)) |
| 40 | 40 | ||
| 41 | class TestPySystemStart(unittest.TestCase): | 41 | class Test01PySystemStart(unittest.TestCase): |
| 42 | ''' Attempts to start Toaster, verify that it is succesfull, and stop it ''' | 42 | ''' Attempts to start Toaster, verify that it is succesfull, and stop it ''' |
| 43 | def setUp(self): | 43 | def setUp(self): |
| 44 | run_shell_cmd("bash -c 'rm -f build/*log'") | 44 | run_shell_cmd("bash -c 'rm -f build/*log'") |
| @@ -55,7 +55,7 @@ class TestPySystemStart(unittest.TestCase): | |||
| 55 | except ShellCmdException as exc: | 55 | except ShellCmdException as exc: |
| 56 | self.fail("Failed starting managed mode: %s" % (exc)) | 56 | self.fail("Failed starting managed mode: %s" % (exc)) |
| 57 | 57 | ||
| 58 | class TestHTML5Compliance(unittest.TestCase): | 58 | class Test02HTML5Compliance(unittest.TestCase): |
| 59 | def setUp(self): | 59 | def setUp(self): |
| 60 | self.origdir = os.getcwd() | 60 | self.origdir = os.getcwd() |
| 61 | self.crtdir = os.path.dirname(config.TESTDIR) | 61 | self.crtdir = os.path.dirname(config.TESTDIR) |
