diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/controllers/controllerimage.py (renamed from meta/lib/oeqa/controllers/masterimage.py) | 44 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/cases/ssh.py | 4 |
2 files changed, 24 insertions, 24 deletions
diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/controllerimage.py index 0bf5917e48..78a4aaff87 100644 --- a/meta/lib/oeqa/controllers/masterimage.py +++ b/meta/lib/oeqa/controllers/controllerimage.py | |||
@@ -3,13 +3,13 @@ | |||
3 | # SPDX-License-Identifier: MIT | 3 | # SPDX-License-Identifier: MIT |
4 | # | 4 | # |
5 | # This module adds support to testimage.bbclass to deploy images and run | 5 | # This module adds support to testimage.bbclass to deploy images and run |
6 | # tests using a "master image" - this is a "known good" image that is | 6 | # tests using a "controller image" - this is a "known good" image that is |
7 | # installed onto the device as part of initial setup and will be booted into | 7 | # installed onto the device as part of initial setup and will be booted into |
8 | # with no interaction; we can then use it to deploy the image to be tested | 8 | # with no interaction; we can then use it to deploy the image to be tested |
9 | # to a second partition before running the tests. | 9 | # to a second partition before running the tests. |
10 | # | 10 | # |
11 | # For an example master image, see core-image-testmaster | 11 | # For an example controller image, see core-image-testcontroller |
12 | # (meta/recipes-extended/images/core-image-testmaster.bb) | 12 | # (meta/recipes-extended/images/core-image-testcontroller.bb) |
13 | 13 | ||
14 | import os | 14 | import os |
15 | import bb | 15 | import bb |
@@ -24,12 +24,12 @@ from oeqa.utils import CommandError | |||
24 | 24 | ||
25 | from abc import ABCMeta, abstractmethod | 25 | from abc import ABCMeta, abstractmethod |
26 | 26 | ||
27 | class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta): | 27 | class ControllerImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta): |
28 | 28 | ||
29 | supported_image_fstypes = ['tar.gz', 'tar.bz2'] | 29 | supported_image_fstypes = ['tar.gz', 'tar.bz2'] |
30 | 30 | ||
31 | def __init__(self, d): | 31 | def __init__(self, d): |
32 | super(MasterImageHardwareTarget, self).__init__(d) | 32 | super(ControllerImageHardwareTarget, self).__init__(d) |
33 | 33 | ||
34 | # target ip | 34 | # target ip |
35 | addr = d.getVar("TEST_TARGET_IP") or bb.fatal('Please set TEST_TARGET_IP with the IP address of the machine you want to run the tests on.') | 35 | addr = d.getVar("TEST_TARGET_IP") or bb.fatal('Please set TEST_TARGET_IP with the IP address of the machine you want to run the tests on.') |
@@ -61,8 +61,8 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta | |||
61 | if not os.path.isfile(self.kernel): | 61 | if not os.path.isfile(self.kernel): |
62 | bb.fatal("No kernel found. Expected path: %s" % self.kernel) | 62 | bb.fatal("No kernel found. Expected path: %s" % self.kernel) |
63 | 63 | ||
64 | # master ssh connection | 64 | # controller ssh connection |
65 | self.master = None | 65 | self.controller = None |
66 | # if the user knows what they are doing, then by all means... | 66 | # if the user knows what they are doing, then by all means... |
67 | self.user_cmds = d.getVar("TEST_DEPLOY_CMDS") | 67 | self.user_cmds = d.getVar("TEST_DEPLOY_CMDS") |
68 | self.deploy_cmds = None | 68 | self.deploy_cmds = None |
@@ -119,19 +119,19 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta | |||
119 | 119 | ||
120 | def deploy(self): | 120 | def deploy(self): |
121 | # base class just sets the ssh log file for us | 121 | # base class just sets the ssh log file for us |
122 | super(MasterImageHardwareTarget, self).deploy() | 122 | super(ControllerImageHardwareTarget, self).deploy() |
123 | self.master = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) | 123 | self.controller = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) |
124 | status, output = self.master.run("cat /etc/masterimage") | 124 | status, output = self.controller.run("cat /etc/controllerimage") |
125 | if status != 0: | 125 | if status != 0: |
126 | # We're not booted into the master image, so try rebooting | 126 | # We're not booted into the controller image, so try rebooting |
127 | bb.plain("%s - booting into the master image" % self.pn) | 127 | bb.plain("%s - booting into the controller image" % self.pn) |
128 | self.power_ctl("cycle") | 128 | self.power_ctl("cycle") |
129 | self._wait_until_booted() | 129 | self._wait_until_booted() |
130 | 130 | ||
131 | bb.plain("%s - deploying image on target" % self.pn) | 131 | bb.plain("%s - deploying image on target" % self.pn) |
132 | status, output = self.master.run("cat /etc/masterimage") | 132 | status, output = self.controller.run("cat /etc/controllerimage") |
133 | if status != 0: | 133 | if status != 0: |
134 | bb.fatal("No ssh connectivity or target isn't running a master image.\n%s" % output) | 134 | bb.fatal("No ssh connectivity or target isn't running a controller image.\n%s" % output) |
135 | if self.user_cmds: | 135 | if self.user_cmds: |
136 | self.deploy_cmds = self.user_cmds.split("\n") | 136 | self.deploy_cmds = self.user_cmds.split("\n") |
137 | try: | 137 | try: |
@@ -156,10 +156,10 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta | |||
156 | 156 | ||
157 | def stop(self): | 157 | def stop(self): |
158 | bb.plain("%s - reboot/powercycle target" % self.pn) | 158 | bb.plain("%s - reboot/powercycle target" % self.pn) |
159 | self.power_cycle(self.master) | 159 | self.power_cycle(self.controller) |
160 | 160 | ||
161 | 161 | ||
162 | class SystemdbootTarget(MasterImageHardwareTarget): | 162 | class SystemdbootTarget(ControllerImageHardwareTarget): |
163 | 163 | ||
164 | def __init__(self, d): | 164 | def __init__(self, d): |
165 | super(SystemdbootTarget, self).__init__(d) | 165 | super(SystemdbootTarget, self).__init__(d) |
@@ -184,16 +184,16 @@ class SystemdbootTarget(MasterImageHardwareTarget): | |||
184 | 184 | ||
185 | def _deploy(self): | 185 | def _deploy(self): |
186 | # make sure these aren't mounted | 186 | # make sure these aren't mounted |
187 | self.master.run("umount /boot; umount /mnt/testrootfs; umount /sys/firmware/efi/efivars;") | 187 | self.controller.run("umount /boot; umount /mnt/testrootfs; umount /sys/firmware/efi/efivars;") |
188 | # from now on, every deploy cmd should return 0 | 188 | # from now on, every deploy cmd should return 0 |
189 | # else an exception will be thrown by sshcontrol | 189 | # else an exception will be thrown by sshcontrol |
190 | self.master.ignore_status = False | 190 | self.controller.ignore_status = False |
191 | self.master.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype) | 191 | self.controller.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype) |
192 | self.master.copy_to(self.kernel, "~/test-kernel") | 192 | self.controller.copy_to(self.kernel, "~/test-kernel") |
193 | for cmd in self.deploy_cmds: | 193 | for cmd in self.deploy_cmds: |
194 | self.master.run(cmd) | 194 | self.controller.run(cmd) |
195 | 195 | ||
196 | def _start(self, params=None): | 196 | def _start(self, params=None): |
197 | self.power_cycle(self.master) | 197 | self.power_cycle(self.controller) |
198 | # there are better ways than a timeout but this should work for now | 198 | # there are better ways than a timeout but this should work for now |
199 | time.sleep(120) | 199 | time.sleep(120) |
diff --git a/meta/lib/oeqa/runtime/cases/ssh.py b/meta/lib/oeqa/runtime/cases/ssh.py index 60a5fbbfbf..e31224b3af 100644 --- a/meta/lib/oeqa/runtime/cases/ssh.py +++ b/meta/lib/oeqa/runtime/cases/ssh.py | |||
@@ -13,7 +13,7 @@ class SSHTest(OERuntimeTestCase): | |||
13 | def test_ssh(self): | 13 | def test_ssh(self): |
14 | (status, output) = self.target.run('uname -a') | 14 | (status, output) = self.target.run('uname -a') |
15 | self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) | 15 | self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) |
16 | (status, output) = self.target.run('cat /etc/masterimage') | 16 | (status, output) = self.target.run('cat /etc/controllerimage') |
17 | msg = "This isn't the right image - /etc/masterimage " \ | 17 | msg = "This isn't the right image - /etc/controllerimage " \ |
18 | "shouldn't be here %s" % output | 18 | "shouldn't be here %s" % output |
19 | self.assertEqual(status, 1, msg=msg) | 19 | self.assertEqual(status, 1, msg=msg) |