From b4d9b4208b1c06164c4eeea2110408fb404dba1c Mon Sep 17 00:00:00 2001 From: Stefan Stanacar Date: Tue, 26 Nov 2013 11:18:22 +0200 Subject: testimage: use the new targetcontrol.py module for running tests This patch makes the necessary changes for using the targetcontrol.py module so that one can run the same tests on a qemu instance or a remote machine based on the value of TEST_TARGET variable: "qemu" or "simpleremote". The default value is "qemu" which starts a qemu instance and it's the with what we currently have. With "simpleremote", the remote machine must be up with network and ssh and you need to set TEST_TARGET_IP with the IP address of the remote machine (it can still be a qemu instance that was manually started). Basically testimage.bbclass now does something along the lines of: - load tests -> deploy (prepare) / start target -> run tests. There were a couple of changes necessary for tests and also some cleanups/renames that were needed to adjust this change. (use ip everywhere when refering to target and server_ip when refering to host/build machine) Also two unnecessary and unsed methods were dropped from sshcontrol. [ YOCTO #5554 ] (From OE-Core rev: a7820350fa3271d78ed7476e02f4aef593be1125) Signed-off-by: Stefan Stanacar Signed-off-by: Richard Purdie --- meta/lib/oeqa/oetest.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'meta/lib/oeqa/oetest.py') diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py index 95661506e3..70d12a225e 100644 --- a/meta/lib/oeqa/oetest.py +++ b/meta/lib/oeqa/oetest.py @@ -14,7 +14,7 @@ import bb from oeqa.utils.sshcontrol import SSHControl -def runTests(tc): +def loadTests(tc): # set the context object passed from the test class setattr(oeTest, "tc", tc) @@ -24,12 +24,16 @@ def runTests(tc): suite = unittest.TestSuite() testloader = unittest.TestLoader() testloader.sortTestMethodsUsing = None - runner = unittest.TextTestRunner(verbosity=2) + suite = testloader.loadTestsFromNames(tc.testslist) + + return suite + +def runTests(tc): + suite = loadTests(tc) bb.note("Test modules %s" % tc.testslist) - suite = testloader.loadTestsFromNames(tc.testslist) bb.note("Found %s tests" % suite.countTestCases()) - + runner = unittest.TextTestRunner(verbosity=2) result = runner.run(suite) return result @@ -81,11 +85,7 @@ class oeRuntimeTest(oeTest): @classmethod def restartTarget(self,params=None): - - if oeRuntimeTest.tc.qemu.restart(params): - oeRuntimeTest.tc.target.host = oeRuntimeTest.tc.qemu.ip - else: - raise Exception("Restarting target failed") + oeRuntimeTest.tc.target.restart(params) def getmodule(pos=2): @@ -103,7 +103,7 @@ def skipModule(reason, pos=2): else: raise Exception("\nTest %s wants to be skipped.\nReason is: %s" \ "\nTest was required in TEST_SUITES, so either the condition for skipping is wrong" \ - "\nor the image really doesn't have the requred feature/package when it should." % (modname, reason)) + "\nor the image really doesn't have the required feature/package when it should." % (modname, reason)) def skipModuleIf(cond, reason): -- cgit v1.2.3-54-g00ecf