diff options
author | Stefan Stanacar <stefanx.stanacar@intel.com> | 2013-11-26 11:18:22 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-03 17:45:51 +0000 |
commit | b4d9b4208b1c06164c4eeea2110408fb404dba1c (patch) | |
tree | 12709d6e6b26777f9a2973022a2e7b32ea0e3d2b /meta/lib/oeqa/oetest.py | |
parent | fd2d16519d964ef3420cb83ac9680a4b6206cefa (diff) | |
download | poky-b4d9b4208b1c06164c4eeea2110408fb404dba1c.tar.gz |
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 <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/oetest.py')
-rw-r--r-- | meta/lib/oeqa/oetest.py | 20 |
1 files changed, 10 insertions, 10 deletions
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 | |||
14 | from oeqa.utils.sshcontrol import SSHControl | 14 | from oeqa.utils.sshcontrol import SSHControl |
15 | 15 | ||
16 | 16 | ||
17 | def runTests(tc): | 17 | def loadTests(tc): |
18 | 18 | ||
19 | # set the context object passed from the test class | 19 | # set the context object passed from the test class |
20 | setattr(oeTest, "tc", tc) | 20 | setattr(oeTest, "tc", tc) |
@@ -24,12 +24,16 @@ def runTests(tc): | |||
24 | suite = unittest.TestSuite() | 24 | suite = unittest.TestSuite() |
25 | testloader = unittest.TestLoader() | 25 | testloader = unittest.TestLoader() |
26 | testloader.sortTestMethodsUsing = None | 26 | testloader.sortTestMethodsUsing = None |
27 | runner = unittest.TextTestRunner(verbosity=2) | 27 | suite = testloader.loadTestsFromNames(tc.testslist) |
28 | |||
29 | return suite | ||
30 | |||
31 | def runTests(tc): | ||
28 | 32 | ||
33 | suite = loadTests(tc) | ||
29 | bb.note("Test modules %s" % tc.testslist) | 34 | bb.note("Test modules %s" % tc.testslist) |
30 | suite = testloader.loadTestsFromNames(tc.testslist) | ||
31 | bb.note("Found %s tests" % suite.countTestCases()) | 35 | bb.note("Found %s tests" % suite.countTestCases()) |
32 | 36 | runner = unittest.TextTestRunner(verbosity=2) | |
33 | result = runner.run(suite) | 37 | result = runner.run(suite) |
34 | 38 | ||
35 | return result | 39 | return result |
@@ -81,11 +85,7 @@ class oeRuntimeTest(oeTest): | |||
81 | 85 | ||
82 | @classmethod | 86 | @classmethod |
83 | def restartTarget(self,params=None): | 87 | def restartTarget(self,params=None): |
84 | 88 | oeRuntimeTest.tc.target.restart(params) | |
85 | if oeRuntimeTest.tc.qemu.restart(params): | ||
86 | oeRuntimeTest.tc.target.host = oeRuntimeTest.tc.qemu.ip | ||
87 | else: | ||
88 | raise Exception("Restarting target failed") | ||
89 | 89 | ||
90 | 90 | ||
91 | def getmodule(pos=2): | 91 | def getmodule(pos=2): |
@@ -103,7 +103,7 @@ def skipModule(reason, pos=2): | |||
103 | else: | 103 | else: |
104 | raise Exception("\nTest %s wants to be skipped.\nReason is: %s" \ | 104 | raise Exception("\nTest %s wants to be skipped.\nReason is: %s" \ |
105 | "\nTest was required in TEST_SUITES, so either the condition for skipping is wrong" \ | 105 | "\nTest was required in TEST_SUITES, so either the condition for skipping is wrong" \ |
106 | "\nor the image really doesn't have the requred feature/package when it should." % (modname, reason)) | 106 | "\nor the image really doesn't have the required feature/package when it should." % (modname, reason)) |
107 | 107 | ||
108 | def skipModuleIf(cond, reason): | 108 | def skipModuleIf(cond, reason): |
109 | 109 | ||