diff options
author | Corneliu Stoicescu <corneliux.stoicescu@intel.com> | 2014-08-09 13:59:07 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-18 08:55:54 +0100 |
commit | 2999a7f6845c72d8ddb19ec8d8dfccdc1cb1e23d (patch) | |
tree | 6f202088d2c3ac2125334c2f99f698529cebf3ec /meta | |
parent | c8de46cb068ae5fc17301e6f37f5f679ec25e2a0 (diff) | |
download | poky-2999a7f6845c72d8ddb19ec8d8dfccdc1cb1e23d.tar.gz |
oeqa/oetest.py: enable sdk testing
- add support for sdk tests in the loadTests and runTests methods
- add new oeSDKTest test object
NOTE: Original patch made by: Richard Purdie <richard.purdie@linuxfoundation.org>
(From OE-Core rev: 6c147e5c82b39773e135ca828b37905cbb31be3b)
Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 |