@@ -7,6 +7,6 @@ from oeqa.runtime.case import OERuntimeTestCase
class QemuTinyTest(OERuntimeTestCase):
def test_boot_tiny(self):
- status, output = self.target.run_serial('uname -a')
+ status, output = self.target.run_serial_socket('uname -a')
msg = "Cannot detect poky tiny boot!"
self.assertTrue("yocto-tiny" in output, msg)
@@ -180,20 +180,20 @@ EOT
with runqemu('core-image-minimal') as qemu:
# Check that application service started
- status, output = qemu.run_serial("systemctl status my-application")
+ status, output = qemu.run_serial_socket("systemctl status my-application")
self.assertTrue("active (exited)" in output, msg=output)
# Check that overlay mounts are dependencies of our application unit
- status, output = qemu.run_serial("systemctl list-dependencies my-application")
+ status, output = qemu.run_serial_socket("systemctl list-dependencies my-application")
self.assertTrue("overlayfs-user-overlays.service" in output, msg=output)
- status, output = qemu.run_serial("systemctl list-dependencies overlayfs-user-overlays")
+ status, output = qemu.run_serial_socket("systemctl list-dependencies overlayfs-user-overlays")
self.assertTrue("usr-share-another\\x2doverlay\\x2dmount.mount" in output, msg=output)
self.assertTrue("usr-share-my\\x2dapplication.mount" in output, msg=output)
# Check that we have /mnt/overlay fs mounted as tmpfs and
# /usr/share/my-application as an overlay (see overlayfs-user recipe)
- status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
+ status, output = qemu.run_serial_socket("/bin/mount -t tmpfs,overlay")
line = getline_qemu(output, "on /mnt/overlay")
self.assertTrue(line and line.startswith("tmpfs"), msg=output)
@@ -372,7 +372,7 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3"
bitbake('core-image-minimal')
with runqemu('core-image-minimal', image_fstype='wic') as qemu:
- status, output = qemu.run_serial("/bin/mount")
+ status, output = qemu.run_serial_socket("/bin/mount")
line = getline_qemu(output, "upperdir=/data/overlay-etc/upper")
self.assertFalse(line, msg=output)
@@ -424,7 +424,7 @@ OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}"
testFile = "/etc/my-test-data"
with runqemu('core-image-minimal', image_fstype='wic', discard_writes=False) as qemu:
- status, output = qemu.run_serial("/bin/mount")
+ status, output = qemu.run_serial_socket("/bin/mount")
line = getline_qemu(output, "/dev/sda3")
self.assertTrue("/data" in output, msg=output)
@@ -432,14 +432,14 @@ OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}"
line = getline_qemu(output, "upperdir=/data/overlay-etc/upper")
self.assertTrue(line and line.startswith("/data/overlay-etc/upper on /etc type overlay"), msg=output)
- status, output = qemu.run_serial("touch " + testFile)
- status, output = qemu.run_serial("sync")
- status, output = qemu.run_serial("ls -1 " + testFile)
+ status, output = qemu.run_serial_socket("touch " + testFile)
+ status, output = qemu.run_serial_socket("sync")
+ status, output = qemu.run_serial_socket("ls -1 " + testFile)
line = getline_qemu(output, testFile)
self.assertTrue(line and line.startswith(testFile), msg=output)
# Check that file exists in /etc after reboot
with runqemu('core-image-minimal', image_fstype='wic') as qemu:
- status, output = qemu.run_serial("ls -1 " + testFile)
+ status, output = qemu.run_serial_socket("ls -1 " + testFile)
line = getline_qemu(output, testFile)
self.assertTrue(line and line.startswith(testFile), msg=output)
@@ -126,7 +126,7 @@ class PackageTests(OESelftestTestCase):
Check that gdb ``binary`` to read symbols from separated debug file
"""
self.logger.info("gdbtest %s" % binary)
- status, output = qemu.run_serial('/usr/bin/gdb.sh %s' % binary, timeout=60)
+ status, output = qemu.run_serial_socket('/usr/bin/gdb.sh %s' % binary, timeout=60)
for l in output.split('\n'):
# Check debugging symbols exists
if '(no debugging symbols found)' in l:
@@ -157,7 +157,7 @@ class PackageTests(OESelftestTestCase):
sysconfdir = get_bb_var('sysconfdir', 'selftest-chown')
def check_ownership(qemu, gid, uid, path):
self.logger.info("Check ownership of %s", path)
- status, output = qemu.run_serial(r'/bin/stat -c "%U %G" ' + path, timeout=60)
+ status, output = qemu.run_serial_socket(r'/bin/stat -c "%U %G" ' + path, timeout=60)
output = output.split(" ")
if output[0] != uid or output[1] != gid :
self.logger.error("Incrrect ownership %s [%s:%s]", path, output[0], output[1])
@@ -169,7 +169,7 @@ class QemuTest(OESelftestTestCase):
# (such as the exception "Console connection closed unexpectedly")
# as qemu will disappear when we shut it down
qemu.runner.allowexit()
- qemu.run_serial("shutdown -h now")
+ qemu.run_serial_socket("shutdown -h now")
time_track = 0
try:
while True:
@@ -312,9 +312,9 @@ class Postinst(OESelftestTestCase):
with runqemu('core-image-minimal') as qemu:
# Make the test echo a string and search for that as
- # run_serial()'s status code is useless.'
+ # run_serial_socket()'s status code is useless.'
for filename in ("rootfs", "delayed-a", "delayed-b"):
- status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
+ status, output = qemu.run_serial_socket("test -f %s && echo found" % os.path.join(targettestdir, filename))
self.assertIn("found", output, "%s was not present on boot" % filename)
@@ -850,12 +850,12 @@ class Wic2(WicTestCase):
with runqemu('wic-image-minimal', ssh=False, runqemuparams='nographic') as qemu:
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(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, 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))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, 'UUID=2c71ef06-a81d-4735-9d3a-379b69c6bdba\t/media\text4\tdefaults\t0\t0')
@only_for_arch(['i586', 'i686', 'x86_64'])
@@ -870,8 +870,8 @@ class Wic2(WicTestCase):
with runqemu('core-image-minimal', ssh=False,
runqemuparams='nographic ovmf', image_fstype='wic') as qemu:
cmd = "grep sda. /proc/partitions |wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '3')
@staticmethod
@@ -1060,8 +1060,8 @@ class Wic2(WicTestCase):
with runqemu('core-image-minimal-mtdutils', ssh=False,
runqemuparams='nographic', image_fstype='wic') as qemu:
cmd = "grep sda. /proc/partitions |wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '2')
def _rawcopy_plugin(self, fstype):
@@ -1122,24 +1122,24 @@ class Wic2(WicTestCase):
runqemuparams='nographic', image_fstype='wic') as qemu:
# Check that we have ONLY two /dev/sda* partitions (/boot and /)
cmd = "grep sda. /proc/partitions | wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '2')
# Check that /dev/sda1 is /boot and that either /dev/root OR /dev/sda2 is /
cmd = "mount | grep '^/dev/' | cut -f1,3 -d ' ' | egrep -c -e '/dev/sda1 /boot' -e '/dev/root /|/dev/sda2 /'"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '2')
# Check that /boot has EFI bootx64.efi (required for EFI)
cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '1')
# Check that "BOOTABLE" flag is set on boot partition (required for PC-Bios)
- # Trailing "cat" seems to be required; otherwise run_serial() sends back echo of the input command
+ # Trailing "cat" seems to be required; otherwise run_serial_socket() sends back echo of the input command
cmd = "fdisk -l /dev/sda | grep /dev/sda1 | awk {print'$2'} | cat"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '*')
@only_for_arch(['i586', 'i686', 'x86_64'])
@@ -1185,18 +1185,18 @@ class Wic2(WicTestCase):
runqemuparams='nographic ovmf', image_fstype='wic') as qemu:
# Check that /boot has EFI bootx64.efi (required for EFI)
cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '1')
# Check that /boot has EFI/Linux/linux.efi (required for Unified Kernel Images auto detection)
cmd = "ls /boot/EFI/Linux/linux.efi | wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '1')
# Check that /boot doesn't have loader/entries/boot.conf (Unified Kernel Images are auto detected by the bootloader)
cmd = "ls /boot/loader/entries/boot.conf 2&>/dev/null | wc -l"
- status, output = qemu.run_serial(cmd)
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket(cmd)
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '0')
def test_fs_types(self):
@@ -1333,8 +1333,8 @@ class Wic2(WicTestCase):
# Check if it boots in qemu
with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic') as qemu:
cmd = "ls /etc/"
- status, output = qemu.run_serial('true')
- self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+ status, output = qemu.run_serial_socket('true')
+ self.assertEqual(0, status, 'Failed to run command "%s": %s' % (cmd, output))
finally:
if os.path.exists(new_image_path):
os.unlink(new_image_path)
@@ -103,7 +103,7 @@ class TargetDumper(BaseDumper):
for cmd in self.cmds:
# We can continue with the testing if serial commands fail
try:
- (status, output) = self.runner.run_serial(cmd)
+ (status, output) = self.runner.run_serial_socket(cmd)
self._write_dump(cmd.split()[0], output)
except:
print("Tried to dump info from target but "
change tests to use the new serial runner run_serial_socket instead of the deprecated run_serial. Signed-off-by: Louis Rannou <lrannou@baylibre.com> --- meta/lib/oeqa/runtime/cases/_qemutiny.py | 2 +- meta/lib/oeqa/selftest/cases/overlayfs.py | 20 ++++---- meta/lib/oeqa/selftest/cases/package.py | 4 +- meta/lib/oeqa/selftest/cases/runqemu.py | 2 +- meta/lib/oeqa/selftest/cases/runtime_test.py | 4 +- meta/lib/oeqa/selftest/cases/wic.py | 50 ++++++++++---------- meta/lib/oeqa/utils/dump.py | 2 +- 7 files changed, 42 insertions(+), 42 deletions(-)