diff options
| -rw-r--r-- | meta/lib/oeqa/oetest.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py index dcbd498fca..5552c4322e 100644 --- a/meta/lib/oeqa/oetest.py +++ b/meta/lib/oeqa/oetest.py | |||
| @@ -10,25 +10,29 @@ | |||
| 10 | import os, re, mmap | 10 | import os, re, mmap |
| 11 | import unittest | 11 | import unittest |
| 12 | import inspect | 12 | import inspect |
| 13 | import subprocess | ||
| 13 | from oeqa.utils.decorators import LogResults | 14 | from oeqa.utils.decorators import LogResults |
| 14 | 15 | ||
| 15 | def loadTests(tc): | 16 | def loadTests(tc, type="runtime"): |
| 16 | 17 | if type == "runtime": | |
| 17 | # set the context object passed from the test class | 18 | # set the context object passed from the test class |
| 18 | setattr(oeTest, "tc", tc) | 19 | setattr(oeTest, "tc", tc) |
| 19 | # set ps command to use | 20 | # set ps command to use |
| 20 | setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps") | 21 | setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps") |
| 21 | # prepare test suite, loader and runner | 22 | # prepare test suite, loader and runner |
| 22 | suite = unittest.TestSuite() | 23 | suite = unittest.TestSuite() |
| 24 | elif type == "sdk": | ||
| 25 | # set the context object passed from the test class | ||
| 26 | setattr(oeSDKTest, "tc", tc) | ||
| 23 | testloader = unittest.TestLoader() | 27 | testloader = unittest.TestLoader() |
| 24 | testloader.sortTestMethodsUsing = None | 28 | testloader.sortTestMethodsUsing = None |
| 25 | suite = testloader.loadTestsFromNames(tc.testslist) | 29 | suite = testloader.loadTestsFromNames(tc.testslist) |
| 26 | 30 | ||
| 27 | return suite | 31 | return suite |
| 28 | 32 | ||
| 29 | def runTests(tc): | 33 | def runTests(tc, type="runtime"): |
| 30 | 34 | ||
| 31 | suite = loadTests(tc) | 35 | suite = loadTests(tc, type) |
| 32 | print("Test modules %s" % tc.testslist) | 36 | print("Test modules %s" % tc.testslist) |
| 33 | print("Found %s tests" % suite.countTestCases()) | 37 | print("Found %s tests" % suite.countTestCases()) |
| 34 | runner = unittest.TextTestRunner(verbosity=2) | 38 | runner = unittest.TextTestRunner(verbosity=2) |
| @@ -58,11 +62,14 @@ class oeTest(unittest.TestCase): | |||
| 58 | return False | 62 | return False |
| 59 | 63 | ||
| 60 | class oeRuntimeTest(oeTest): | 64 | class oeRuntimeTest(oeTest): |
| 61 | |||
| 62 | def __init__(self, methodName='runTest'): | 65 | def __init__(self, methodName='runTest'): |
| 63 | self.target = oeRuntimeTest.tc.target | 66 | self.target = oeRuntimeTest.tc.target |
| 64 | super(oeRuntimeTest, self).__init__(methodName) | 67 | super(oeRuntimeTest, self).__init__(methodName) |
| 65 | 68 | ||
| 69 | class oeSDKTest(unittest.TestCase): | ||
| 70 | def __init__(self, methodName='runTest'): | ||
| 71 | self.sdktestdir = oeSDKTest.tc.sdktestdir | ||
| 72 | super(oeSDKTest, self).__init__(methodName) | ||
| 66 | 73 | ||
| 67 | def getmodule(pos=2): | 74 | def getmodule(pos=2): |
| 68 | # stack returns a list of tuples containg frame information | 75 | # stack returns a list of tuples containg frame information |
