summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorCorneliu Stoicescu <corneliux.stoicescu@intel.com>2014-08-09 13:59:07 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-18 08:55:54 +0100
commit2999a7f6845c72d8ddb19ec8d8dfccdc1cb1e23d (patch)
tree6f202088d2c3ac2125334c2f99f698529cebf3ec /meta/lib/oeqa
parentc8de46cb068ae5fc17301e6f37f5f679ec25e2a0 (diff)
downloadpoky-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/lib/oeqa')
-rw-r--r--meta/lib/oeqa/oetest.py29
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 @@
10import os, re, mmap 10import os, re, mmap
11import unittest 11import unittest
12import inspect 12import inspect
13import subprocess
13from oeqa.utils.decorators import LogResults 14from oeqa.utils.decorators import LogResults
14 15
15def loadTests(tc): 16def 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
29def runTests(tc): 33def 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
60class oeRuntimeTest(oeTest): 64class 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
69class oeSDKTest(unittest.TestCase):
70 def __init__(self, methodName='runTest'):
71 self.sdktestdir = oeSDKTest.tc.sdktestdir
72 super(oeSDKTest, self).__init__(methodName)
66 73
67def getmodule(pos=2): 74def getmodule(pos=2):
68 # stack returns a list of tuples containg frame information 75 # stack returns a list of tuples containg frame information