Skip to contentSkip to conversation

selftest/wic: update test case test_qemu

PATCH New [email protected] 1 participant 2 messages Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

v2 cover selftest/wic: update test case test_qemu

From: Kai Kang <[email protected]>

V2:
* check mounted partition with egrep rather than check output

Kai Kang (1):
selftest/wic: update test case test_qemu

 meta/lib/oeqa/selftest/cases/wic.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 1/1 selftest/wic: update test case test_qemu

From: Kai Kang <[email protected]>

This test case boots the image in qemu and checks for mounted partitions. But the outputs of mount are different between sysvinit and systemd:

sysvinit:
/dev/root /\r\n/dev/sda1 /boot\r\n/dev/sda3 /media\r\n/dev/sda4 /mnt systemd:
/dev/sda1 /boot\r\n/dev/sda2 /\r\n/dev/sda3 /media\r\n/dev/sda4 /mnt

So check mounted partitions by egrep rather than check output of runqemu.

---
 meta/lib/oeqa/selftest/cases/wic.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +4 -2
index 36ee5e5a14..79925f942f 100644
@@ -625,9 +625,11 @@ class Wic2(WicTestCase):
         self.remove_config(config)
 
         with runqemu('wic-image-minimal', ssh=False) as qemu:
-            cmd = "mount |grep '^/dev/' | cut -f1,3 -d ' ' | sort"
+            cmd = "mount | grep '^/dev/' | cut -f1,3 -d ' ' | egrep -c -e '/dev/sda1 /boot' " \
+                  "-e '/dev/root /|/dev/sda2 /' -e '/dev/sda3 /media' -e '/dev/sda4 /mnt'"
             status, output = qemu.run_serial(cmd)
-            self.assertEqual(output, '/dev/root /\r\n/dev/sda1 /boot\r\n/dev/sda3 /media\r\n/dev/sda4 /mnt')
+            self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+            self.assertEqual(output, '4')
             cmd = "grep UUID= /etc/fstab"
             status, output = qemu.run_serial(cmd)
             self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
Signature · 1 line
2.18.0