mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 06:49:33 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
c8de46cb06
commit
2999a7f684
@@ -10,25 +10,29 @@
|
|||||||
import os, re, mmap
|
import os, re, mmap
|
||||||
import unittest
|
import unittest
|
||||||
import inspect
|
import inspect
|
||||||
|
import subprocess
|
||||||
from oeqa.utils.decorators import LogResults
|
from oeqa.utils.decorators import LogResults
|
||||||
|
|
||||||
def loadTests(tc):
|
def loadTests(tc, type="runtime"):
|
||||||
|
if type == "runtime":
|
||||||
# set the context object passed from the test class
|
# set the context object passed from the test class
|
||||||
setattr(oeTest, "tc", tc)
|
setattr(oeTest, "tc", tc)
|
||||||
# set ps command to use
|
# set ps command to use
|
||||||
setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps")
|
setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps")
|
||||||
# prepare test suite, loader and runner
|
# prepare test suite, loader and runner
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
|
elif type == "sdk":
|
||||||
|
# set the context object passed from the test class
|
||||||
|
setattr(oeSDKTest, "tc", tc)
|
||||||
testloader = unittest.TestLoader()
|
testloader = unittest.TestLoader()
|
||||||
testloader.sortTestMethodsUsing = None
|
testloader.sortTestMethodsUsing = None
|
||||||
suite = testloader.loadTestsFromNames(tc.testslist)
|
suite = testloader.loadTestsFromNames(tc.testslist)
|
||||||
|
|
||||||
return suite
|
return suite
|
||||||
|
|
||||||
def runTests(tc):
|
def runTests(tc, type="runtime"):
|
||||||
|
|
||||||
suite = loadTests(tc)
|
suite = loadTests(tc, type)
|
||||||
print("Test modules %s" % tc.testslist)
|
print("Test modules %s" % tc.testslist)
|
||||||
print("Found %s tests" % suite.countTestCases())
|
print("Found %s tests" % suite.countTestCases())
|
||||||
runner = unittest.TextTestRunner(verbosity=2)
|
runner = unittest.TextTestRunner(verbosity=2)
|
||||||
@@ -58,11 +62,14 @@ class oeTest(unittest.TestCase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
class oeRuntimeTest(oeTest):
|
class oeRuntimeTest(oeTest):
|
||||||
|
|
||||||
def __init__(self, methodName='runTest'):
|
def __init__(self, methodName='runTest'):
|
||||||
self.target = oeRuntimeTest.tc.target
|
self.target = oeRuntimeTest.tc.target
|
||||||
super(oeRuntimeTest, self).__init__(methodName)
|
super(oeRuntimeTest, self).__init__(methodName)
|
||||||
|
|
||||||
|
class oeSDKTest(unittest.TestCase):
|
||||||
|
def __init__(self, methodName='runTest'):
|
||||||
|
self.sdktestdir = oeSDKTest.tc.sdktestdir
|
||||||
|
super(oeSDKTest, self).__init__(methodName)
|
||||||
|
|
||||||
def getmodule(pos=2):
|
def getmodule(pos=2):
|
||||||
# stack returns a list of tuples containg frame information
|
# stack returns a list of tuples containg frame information
|
||||||
|
|||||||
Reference in New Issue
Block a user