diff options
| author | Ross Burton <ross@burtonini.com> | 2022-03-31 19:29:09 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-01 23:11:37 +0100 |
| commit | fcc9c0ab37d1280538490a8069baf94984b38853 (patch) | |
| tree | c70166d56bdbfdddce182ce9c55880b85dfcf977 /meta | |
| parent | 416cce968d3abb85177287cc1e497867d0472755 (diff) | |
| download | poky-fcc9c0ab37d1280538490a8069baf94984b38853.tar.gz | |
oeqa: rationalise skipifqemu decorators
(From OE-Core rev: 1a3a37cc2b16a8d5cd2258b0b35be43baa363f67)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 44 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/boot.py | 2 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py | 3 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/ltp_stress.py | 3 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/storage.py | 16 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/suspend.py | 2 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/usb_hid.py | 2 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 4 |
8 files changed, 25 insertions, 51 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 12197be246..3ce10e5499 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py | |||
| @@ -27,17 +27,6 @@ def has_machine(td, machine): | |||
| 27 | return True | 27 | return True |
| 28 | return False | 28 | return False |
| 29 | 29 | ||
| 30 | def is_qemu(td, qemu): | ||
| 31 | """ | ||
| 32 | Checks if MACHINE is qemu. | ||
| 33 | """ | ||
| 34 | |||
| 35 | machine = td.get('MACHINE', '') | ||
| 36 | if (qemu in td.get('MACHINE', '') or | ||
| 37 | machine.startswith('qemu')): | ||
| 38 | return True | ||
| 39 | return False | ||
| 40 | |||
| 41 | @registerDecorator | 30 | @registerDecorator |
| 42 | class skipIfDataVar(OETestDecorator): | 31 | class skipIfDataVar(OETestDecorator): |
| 43 | """ | 32 | """ |
| @@ -189,34 +178,19 @@ class skipIfMachine(OETestDecorator): | |||
| 189 | @registerDecorator | 178 | @registerDecorator |
| 190 | class skipIfNotQemu(OETestDecorator): | 179 | class skipIfNotQemu(OETestDecorator): |
| 191 | """ | 180 | """ |
| 192 | Skip test based on MACHINE. | 181 | Skip test if MACHINE is not qemu* |
| 193 | |||
| 194 | value must be a qemu MACHINE or it will skip the test | ||
| 195 | with msg as the reason. | ||
| 196 | """ | 182 | """ |
| 197 | |||
| 198 | attrs = ('value', 'msg') | ||
| 199 | |||
| 200 | def setUpDecorator(self): | 183 | def setUpDecorator(self): |
| 201 | msg = ('Checking if %s is not this MACHINE' % self.value) | 184 | self.logger.debug("Checking if not qemu MACHINE") |
| 202 | self.logger.debug(msg) | 185 | if not self.case.td.get('MACHINE', '').startswith('qemu'): |
| 203 | if not is_qemu(self.case.td, self.value): | 186 | self.case.skipTest('Test only runs on qemu machines') |
| 204 | self.case.skipTest(self.msg) | ||
| 205 | 187 | ||
| 206 | @registerDecorator | 188 | @registerDecorator |
| 207 | class skipIfQemu(OETestDecorator): | 189 | class skipIfQemu(OETestDecorator): |
| 208 | """ | 190 | """ |
| 209 | Skip test based on Qemu Machine. | 191 | Skip test if MACHINE is qemu* |
| 210 | 192 | """ | |
| 211 | value must not be a qemu machine or it will skip the test | ||
| 212 | with msg as the reason. | ||
| 213 | """ | ||
| 214 | |||
| 215 | attrs = ('value', 'msg') | ||
| 216 | |||
| 217 | def setUpDecorator(self): | 193 | def setUpDecorator(self): |
| 218 | msg = ('Checking if %s is this MACHINE' % self.value) | 194 | self.logger.debug("Checking if qemu MACHINE") |
| 219 | self.logger.debug(msg) | 195 | if self.case.td.get('MACHINE', '').startswith('qemu'): |
| 220 | if is_qemu(self.case.td, self.value): | 196 | self.case.skipTest('Test only runs on real hardware') |
| 221 | self.case.skipTest(self.msg) | ||
| 222 | |||
diff --git a/meta/lib/oeqa/runtime/cases/boot.py b/meta/lib/oeqa/runtime/cases/boot.py index 2142f400a0..e1ad88a174 100644 --- a/meta/lib/oeqa/runtime/cases/boot.py +++ b/meta/lib/oeqa/runtime/cases/boot.py | |||
| @@ -13,7 +13,7 @@ from oeqa.core.decorator.data import skipIfQemu | |||
| 13 | class BootTest(OERuntimeTestCase): | 13 | class BootTest(OERuntimeTestCase): |
| 14 | 14 | ||
| 15 | @OETimeout(120) | 15 | @OETimeout(120) |
| 16 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 16 | @skipIfQemu() |
| 17 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 17 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 18 | def test_reboot(self): | 18 | def test_reboot(self): |
| 19 | output = '' | 19 | output = '' |
diff --git a/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py b/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py index e010612838..b93ee29941 100644 --- a/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py +++ b/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py | |||
| @@ -11,7 +11,7 @@ class Ethernet_Test(OERuntimeTestCase): | |||
| 11 | x = '.'.join(x) | 11 | x = '.'.join(x) |
| 12 | return x | 12 | return x |
| 13 | 13 | ||
| 14 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 14 | @skipIfQemu() |
| 15 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 15 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 16 | def test_set_virtual_ip(self): | 16 | def test_set_virtual_ip(self): |
| 17 | (status, output) = self.target.run("ifconfig eth0 | grep 'inet ' | awk '{print $2}'") | 17 | (status, output) = self.target.run("ifconfig eth0 | grep 'inet ' | awk '{print $2}'") |
| @@ -22,6 +22,7 @@ class Ethernet_Test(OERuntimeTestCase): | |||
| 22 | (status, output) = self.target.run("ifconfig eth0:1 %s netmask 255.255.255.0 && sleep 2 && ping -c 5 %s && ifconfig eth0:1 down" % (virtual_ip,virtual_ip)) | 22 | (status, output) = self.target.run("ifconfig eth0:1 %s netmask 255.255.255.0 && sleep 2 && ping -c 5 %s && ifconfig eth0:1 down" % (virtual_ip,virtual_ip)) |
| 23 | self.assertEqual(status, 0, msg='Failed to create virtual ip address, output: %s' % output) | 23 | self.assertEqual(status, 0, msg='Failed to create virtual ip address, output: %s' % output) |
| 24 | 24 | ||
| 25 | @skipIfQemu() | ||
| 25 | @OETestDepends(['ethernet_ip_connman.Ethernet_Test.test_set_virtual_ip']) | 26 | @OETestDepends(['ethernet_ip_connman.Ethernet_Test.test_set_virtual_ip']) |
| 26 | def test_get_ip_from_dhcp(self): | 27 | def test_get_ip_from_dhcp(self): |
| 27 | (status, output) = self.target.run("connmanctl services | grep -E '*AO Wired|*AR Wired' | awk '{print $3}'") | 28 | (status, output) = self.target.run("connmanctl services | grep -E '*AO Wired|*AR Wired' | awk '{print $3}'") |
diff --git a/meta/lib/oeqa/runtime/cases/ltp_stress.py b/meta/lib/oeqa/runtime/cases/ltp_stress.py index 2445ffbc93..ce6f4bf59d 100644 --- a/meta/lib/oeqa/runtime/cases/ltp_stress.py +++ b/meta/lib/oeqa/runtime/cases/ltp_stress.py | |||
| @@ -89,8 +89,7 @@ class LtpStressTest(LtpStressBase): | |||
| 89 | 89 | ||
| 90 | # LTP stress runtime tests | 90 | # LTP stress runtime tests |
| 91 | # | 91 | # |
| 92 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 92 | @skipIfQemu() |
| 93 | |||
| 94 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 93 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 95 | @OEHasPackage(["ltp"]) | 94 | @OEHasPackage(["ltp"]) |
| 96 | def test_ltp_stress(self): | 95 | def test_ltp_stress(self): |
diff --git a/meta/lib/oeqa/runtime/cases/storage.py b/meta/lib/oeqa/runtime/cases/storage.py index 166d26b252..972ef8210c 100644 --- a/meta/lib/oeqa/runtime/cases/storage.py +++ b/meta/lib/oeqa/runtime/cases/storage.py | |||
| @@ -91,24 +91,24 @@ class UsbTest(StorageBase): | |||
| 91 | self.test_file = "usb.tst" | 91 | self.test_file = "usb.tst" |
| 92 | self.test_dir = os.path.join(self.mount_point, "oeqa") | 92 | self.test_dir = os.path.join(self.mount_point, "oeqa") |
| 93 | 93 | ||
| 94 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 94 | @skipIfQemu() |
| 95 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 95 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 96 | def test_usb_mount(self): | 96 | def test_usb_mount(self): |
| 97 | self.storage_umount(2) | 97 | self.storage_umount(2) |
| 98 | self.storage_mount(5) | 98 | self.storage_mount(5) |
| 99 | 99 | ||
| 100 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 100 | @skipIfQemu() |
| 101 | @OETestDepends(['storage.UsbTest.test_usb_mount']) | 101 | @OETestDepends(['storage.UsbTest.test_usb_mount']) |
| 102 | def test_usb_basic_operations(self): | 102 | def test_usb_basic_operations(self): |
| 103 | self.storage_basic() | 103 | self.storage_basic() |
| 104 | 104 | ||
| 105 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 105 | @skipIfQemu() |
| 106 | @OETestDepends(['storage.UsbTest.test_usb_basic_operations']) | 106 | @OETestDepends(['storage.UsbTest.test_usb_basic_operations']) |
| 107 | def test_usb_basic_rw(self): | 107 | def test_usb_basic_rw(self): |
| 108 | self.storage_write() | 108 | self.storage_write() |
| 109 | self.storage_read() | 109 | self.storage_read() |
| 110 | 110 | ||
| 111 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 111 | @skipIfQemu() |
| 112 | @OETestDepends(['storage.UsbTest.test_usb_mount']) | 112 | @OETestDepends(['storage.UsbTest.test_usb_mount']) |
| 113 | def test_usb_umount(self): | 113 | def test_usb_umount(self): |
| 114 | self.storage_umount(2) | 114 | self.storage_umount(2) |
| @@ -126,24 +126,24 @@ class MMCTest(StorageBase): | |||
| 126 | self.test_file = "mmc.tst" | 126 | self.test_file = "mmc.tst" |
| 127 | self.test_dir = os.path.join(self.mount_point, "oeqa") | 127 | self.test_dir = os.path.join(self.mount_point, "oeqa") |
| 128 | 128 | ||
| 129 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 129 | @skipIfQemu() |
| 130 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 130 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 131 | def test_mmc_mount(self): | 131 | def test_mmc_mount(self): |
| 132 | self.storage_umount(2) | 132 | self.storage_umount(2) |
| 133 | self.storage_mount() | 133 | self.storage_mount() |
| 134 | 134 | ||
| 135 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 135 | @skipIfQemu() |
| 136 | @OETestDepends(['storage.MMCTest.test_mmc_mount']) | 136 | @OETestDepends(['storage.MMCTest.test_mmc_mount']) |
| 137 | def test_mmc_basic_operations(self): | 137 | def test_mmc_basic_operations(self): |
| 138 | self.storage_basic() | 138 | self.storage_basic() |
| 139 | 139 | ||
| 140 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 140 | @skipIfQemu() |
| 141 | @OETestDepends(['storage.MMCTest.test_mmc_basic_operations']) | 141 | @OETestDepends(['storage.MMCTest.test_mmc_basic_operations']) |
| 142 | def test_mmc_basic_rw(self): | 142 | def test_mmc_basic_rw(self): |
| 143 | self.storage_write() | 143 | self.storage_write() |
| 144 | self.storage_read() | 144 | self.storage_read() |
| 145 | 145 | ||
| 146 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 146 | @skipIfQemu() |
| 147 | @OETestDepends(['storage.MMCTest.test_mmc_mount']) | 147 | @OETestDepends(['storage.MMCTest.test_mmc_mount']) |
| 148 | def test_mmc_umount(self): | 148 | def test_mmc_umount(self): |
| 149 | self.storage_umount(2) | 149 | self.storage_umount(2) |
diff --git a/meta/lib/oeqa/runtime/cases/suspend.py b/meta/lib/oeqa/runtime/cases/suspend.py index 67b6f7e56f..0382d48f45 100644 --- a/meta/lib/oeqa/runtime/cases/suspend.py +++ b/meta/lib/oeqa/runtime/cases/suspend.py | |||
| @@ -23,7 +23,7 @@ class Suspend_Test(OERuntimeTestCase): | |||
| 23 | (status, output) = self.target.run('sudo rtcwake -m mem -s 10') | 23 | (status, output) = self.target.run('sudo rtcwake -m mem -s 10') |
| 24 | self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output) | 24 | self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output) |
| 25 | 25 | ||
| 26 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 26 | @skipIfQemu() |
| 27 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 27 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 28 | def test_suspend(self): | 28 | def test_suspend(self): |
| 29 | self.test_date() | 29 | self.test_date() |
diff --git a/meta/lib/oeqa/runtime/cases/usb_hid.py b/meta/lib/oeqa/runtime/cases/usb_hid.py index 3c292cf661..8743174370 100644 --- a/meta/lib/oeqa/runtime/cases/usb_hid.py +++ b/meta/lib/oeqa/runtime/cases/usb_hid.py | |||
| @@ -14,7 +14,7 @@ class USB_HID_Test(OERuntimeTestCase): | |||
| 14 | return self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output) | 14 | return self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output) |
| 15 | 15 | ||
| 16 | @OEHasPackage(['xdotool']) | 16 | @OEHasPackage(['xdotool']) |
| 17 | @skipIfQemu('qemuall', 'Test only runs on real hardware') | 17 | @skipIfQemu() |
| 18 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 18 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 19 | def test_USB_Hid_input(self): | 19 | def test_USB_Hid_input(self): |
| 20 | self.keyboard_mouse_simulation() | 20 | self.keyboard_mouse_simulation() |
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 7b7371b6e0..2ad89490fc 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
| @@ -281,7 +281,7 @@ class Postinst(OESelftestTestCase): | |||
| 281 | 281 | ||
| 282 | 282 | ||
| 283 | 283 | ||
| 284 | @skipIfNotQemu('qemuall', 'Test only runs in qemu') | 284 | @skipIfNotQemu() |
| 285 | def test_postinst_rootfs_and_boot_sysvinit(self): | 285 | def test_postinst_rootfs_and_boot_sysvinit(self): |
| 286 | """ | 286 | """ |
| 287 | Summary: The purpose of this test case is to verify Post-installation | 287 | Summary: The purpose of this test case is to verify Post-installation |
| @@ -302,7 +302,7 @@ class Postinst(OESelftestTestCase): | |||
| 302 | self.init_manager_loop("sysvinit") | 302 | self.init_manager_loop("sysvinit") |
| 303 | 303 | ||
| 304 | 304 | ||
| 305 | @skipIfNotQemu('qemuall', 'Test only runs in qemu') | 305 | @skipIfNotQemu() |
| 306 | def test_postinst_rootfs_and_boot_systemd(self): | 306 | def test_postinst_rootfs_and_boot_systemd(self): |
| 307 | """ | 307 | """ |
| 308 | Summary: The purpose of this test case is to verify Post-installation | 308 | Summary: The purpose of this test case is to verify Post-installation |
