From 4675d65dbb2c7e16283e3045c7ca90cec41ed0af Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 9 Dec 2019 16:08:11 +1300 Subject: runqemu: log parameters correctly within testimage It is not a good idea to mix logging and calls to print() - if the output is being captured the result can be that the two types of output are not recorded contiguously; this could be observed if an error occurred running runqemu from inside testimage: ---------- snip ---------- ERROR: core-image-minimal-1.0-r0 do_testimage: Output from runqemu: runqemu - INFO - Continuing with the following parameters: runqemu - INFO - Setting up tap interface under sudo sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper runqemu - ERROR - Setting up tap device failed: Command '('sudo', '/home/paul/poky/poky/scripts/runqemu-ifup', '1000', '1000', '/home/paul/poky/poky/build/tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin')' returned non-zero exit status 1. Run runqemu-gen-tapdevs to manually create one. runqemu - INFO - Cleaning up KERNEL: [/home/paul/poky/poky/build/tmp/deploy/images/qemux86-64/bzImage--5.2.20+git0+bd0762cd13_dd25a04fc5-r0-qemux86-64-20191205213021.bin] MACHINE: [qemux86-64] FSTYPE: [ext4] ROOTFS: [/home/paul/poky/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.ext4] CONFFILE: [/home/paul/poky/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.qemuboot.conf] ---------- snip ---------- What we should see here is the KERNEL, MACHINE, etc. lines appearing immediately after the "Continuing with the following parameters:" line as they do when you run runqemu directly. If we put all of the lines through the logger instead then it works properly. Signed-off-by: Paul Eggleton --- scripts/runqemu | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/runqemu b/scripts/runqemu index 5c56c3fe6c..f061917c4b 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -933,29 +933,30 @@ class BaseConfig(object): self.set('STAGING_BINDIR_NATIVE', '%s/usr/bin' % self.get('STAGING_DIR_NATIVE')) def print_config(self): - logger.info('Continuing with the following parameters:\n') + logoutput = ['Continuing with the following parameters:'] if not self.fstype in self.vmtypes: - print('KERNEL: [%s]' % self.kernel) + logoutput.append('KERNEL: [%s]' % self.kernel) if self.bios: - print('BIOS: [%s]' % self.bios) + logoutput.append('BIOS: [%s]' % self.bios) if self.dtb: - print('DTB: [%s]' % self.dtb) - print('MACHINE: [%s]' % self.get('MACHINE')) + logoutput.append('DTB: [%s]' % self.dtb) + logoutput.append('MACHINE: [%s]' % self.get('MACHINE')) try: fstype_flags = ' (' + ', '.join(self.fsinfo[self.fstype]) + ')' except KeyError: fstype_flags = '' - print('FSTYPE: [%s%s]' % (self.fstype, fstype_flags)) + logoutput.append('FSTYPE: [%s%s]' % (self.fstype, fstype_flags)) if self.fstype == 'nfs': - print('NFS_DIR: [%s]' % self.rootfs) + logoutput.append('NFS_DIR: [%s]' % self.rootfs) else: - print('ROOTFS: [%s]' % self.rootfs) + logoutput.append('ROOTFS: [%s]' % self.rootfs) if self.ovmf_bios: - print('OVMF: %s' % self.ovmf_bios) + logoutput.append('OVMF: %s' % self.ovmf_bios) if (self.ovmf_secboot_pkkek1): - print('SECBOOT PKKEK1: [%s...]' % self.ovmf_secboot_pkkek1[0:100]) - print('CONFFILE: [%s]' % self.qemuboot) - print('') + logoutput.append('SECBOOT PKKEK1: [%s...]' % self.ovmf_secboot_pkkek1[0:100]) + logoutput.append('CONFFILE: [%s]' % self.qemuboot) + logoutput.append('') + logger.info('\n'.join(logoutput)) def setup_nfs(self): if not self.nfs_server: -- cgit 1.2.3-korg