]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa: rationalise skipifqemu decorators
authorRoss Burton <ross@burtonini.com>
Thu, 31 Mar 2022 18:29:09 +0000 (19:29 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 1 Apr 2022 22:05:31 +0000 (23:05 +0100)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/lib/oeqa/core/decorator/data.py
meta/lib/oeqa/runtime/cases/boot.py
meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py
meta/lib/oeqa/runtime/cases/ltp_stress.py
meta/lib/oeqa/runtime/cases/storage.py
meta/lib/oeqa/runtime/cases/suspend.py
meta/lib/oeqa/runtime/cases/usb_hid.py
meta/lib/oeqa/selftest/cases/runtime_test.py

index 12197be246e61349d7744d3d2bcc741dff5d6492..3ce10e5499968bcaf46baeb1f6453e2530009ed3 100644 (file)
@@ -27,17 +27,6 @@ def has_machine(td, machine):
         return True
     return False
 
-def is_qemu(td, qemu):
-    """
-        Checks if MACHINE is qemu.
-    """
-
-    machine = td.get('MACHINE', '')
-    if (qemu in td.get('MACHINE', '') or
-    machine.startswith('qemu')):
-        return True
-    return False
-
 @registerDecorator
 class skipIfDataVar(OETestDecorator):
     """
@@ -189,34 +178,19 @@ class skipIfMachine(OETestDecorator):
 @registerDecorator
 class skipIfNotQemu(OETestDecorator):
     """
-        Skip test based on MACHINE.
-
-        value must be a qemu MACHINE or it will skip the test
-        with msg as the reason.
+    Skip test if MACHINE is not qemu*
     """
-
-    attrs = ('value', 'msg')
-
     def setUpDecorator(self):
-        msg = ('Checking if %s is not this MACHINE' % self.value)
-        self.logger.debug(msg)
-        if not is_qemu(self.case.td, self.value):
-            self.case.skipTest(self.msg)
+        self.logger.debug("Checking if not qemu MACHINE")
+        if not self.case.td.get('MACHINE', '').startswith('qemu'):
+            self.case.skipTest('Test only runs on qemu machines')
 
 @registerDecorator
 class skipIfQemu(OETestDecorator):
     """
-        Skip test based on Qemu Machine.
-
-        value must not be a qemu machine or it will skip the test
-        with msg as the reason.
-   """
-
-    attrs = ('value', 'msg')
-
+    Skip test if MACHINE is qemu*
+    """
     def setUpDecorator(self):
-        msg = ('Checking if %s is this MACHINE' % self.value)
-        self.logger.debug(msg)
-        if is_qemu(self.case.td, self.value):
-             self.case.skipTest(self.msg)
-
+        self.logger.debug("Checking if qemu MACHINE")
+        if self.case.td.get('MACHINE', '').startswith('qemu'):
+             self.case.skipTest('Test only runs on real hardware')
index 2142f400a05971fff11976ed3df526a6c07e3f8b..e1ad88a17443ef1e76613903b1532bc90ad13b08 100644 (file)
@@ -13,7 +13,7 @@ from oeqa.core.decorator.data import skipIfQemu
 class BootTest(OERuntimeTestCase):
 
     @OETimeout(120)
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_reboot(self):
         output = ''
index e0106128389c8aa63b16813f3599fb3657940435..b93ee2994150bda01c728e4552a4b0e2769e644e 100644 (file)
@@ -11,7 +11,7 @@ class Ethernet_Test(OERuntimeTestCase):
         x = '.'.join(x)
         return x
     
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')    
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_set_virtual_ip(self):
         (status, output) = self.target.run("ifconfig eth0 | grep 'inet ' | awk '{print $2}'")
@@ -22,6 +22,7 @@ class Ethernet_Test(OERuntimeTestCase):
         (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))
         self.assertEqual(status, 0, msg='Failed to create virtual ip address, output: %s' % output)
         
+    @skipIfQemu()
     @OETestDepends(['ethernet_ip_connman.Ethernet_Test.test_set_virtual_ip'])  
     def test_get_ip_from_dhcp(self): 
         (status, output) = self.target.run("connmanctl services | grep -E '*AO Wired|*AR Wired' | awk '{print $3}'")
index 2445ffbc93997142dbebf3508a911d6443d13e2d..ce6f4bf59d345467cedad63ca6506fd2ddab9f14 100644 (file)
@@ -89,8 +89,7 @@ class LtpStressTest(LtpStressBase):
 
     # LTP stress runtime tests
     #
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
-
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(["ltp"])
     def test_ltp_stress(self):
index 166d26b252bf9f2dbc1b69ae41a111511f755125..972ef8210c0ea6848fce064c0e068304cc904935 100644 (file)
@@ -91,24 +91,24 @@ class UsbTest(StorageBase):
         self.test_file = "usb.tst"
         self.test_dir = os.path.join(self.mount_point, "oeqa")
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_usb_mount(self):
         self.storage_umount(2)
         self.storage_mount(5)
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.UsbTest.test_usb_mount'])
     def test_usb_basic_operations(self):
         self.storage_basic()
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.UsbTest.test_usb_basic_operations'])
     def test_usb_basic_rw(self):
         self.storage_write()
         self.storage_read()
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.UsbTest.test_usb_mount'])
     def test_usb_umount(self):
         self.storage_umount(2)
@@ -126,24 +126,24 @@ class MMCTest(StorageBase):
         self.test_file = "mmc.tst"
         self.test_dir = os.path.join(self.mount_point, "oeqa")
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_mmc_mount(self):
         self.storage_umount(2)
         self.storage_mount()
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.MMCTest.test_mmc_mount'])
     def test_mmc_basic_operations(self):
         self.storage_basic()
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.MMCTest.test_mmc_basic_operations'])
     def test_mmc_basic_rw(self):
         self.storage_write()
         self.storage_read()
 
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['storage.MMCTest.test_mmc_mount'])
     def test_mmc_umount(self):
         self.storage_umount(2)
index 67b6f7e56fab68880a65afe84dd75d2ce20a2108..0382d48f45805820e639f741450a76bcae0915d2 100644 (file)
@@ -23,7 +23,7 @@ class Suspend_Test(OERuntimeTestCase):
         (status, output) = self.target.run('sudo rtcwake -m mem -s 10')
         self.assertEqual(status, 0,  msg = 'Failed to suspends your system to RAM, output : %s' % output)
     
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_suspend(self):
         self.test_date()
index 3c292cf661c7f2d65e1cc61f98fcb2c092d0fbda..8743174370d592d450eaf1d785bb8fe764643447 100644 (file)
@@ -14,7 +14,7 @@ class USB_HID_Test(OERuntimeTestCase):
         return self.assertEqual(status, 0,  msg = 'Failed to suspends your system to RAM, output : %s' % output)
     
     @OEHasPackage(['xdotool'])
-    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @skipIfQemu()
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_USB_Hid_input(self):
         self.keyboard_mouse_simulation()
index 7b7371b6e073ba9817bde7134b25cf2ed3d6c5b4..2ad89490fcf177cda23a056e06146179ef44e5ea 100644 (file)
@@ -281,7 +281,7 @@ class Postinst(OESelftestTestCase):
 
 
 
-    @skipIfNotQemu('qemuall', 'Test only runs in qemu')
+    @skipIfNotQemu()
     def test_postinst_rootfs_and_boot_sysvinit(self):
         """
         Summary:        The purpose of this test case is to verify Post-installation
@@ -302,7 +302,7 @@ class Postinst(OESelftestTestCase):
         self.init_manager_loop("sysvinit")
 
 
-    @skipIfNotQemu('qemuall', 'Test only runs in qemu')
+    @skipIfNotQemu()
     def test_postinst_rootfs_and_boot_systemd(self):
         """
         Summary:        The purpose of this test case is to verify Post-installation