From: Yoann Congal <[email protected]> Kernel messages on console can be mixed with run_serial() command output and might even prevent run_serial() to read the command exit code.
To fix this, on the first non-raw run_serial() call, run "dmesg -n 1" first to hide the kernel message from the console we use to run commands. Note that kernel messages are still logged in dmesg buffer. man dmesg (from util-linux): > -n, --console-level > level Set the level at which printing of messages is done to the > console. The level is a level number or abbreviation of the level name. > For all supported levels see the --help output. > > For example, -n 1 or -n emerg prevents all messages, except emergency (panic) > messages, from appearing on the console. All levels of messages are still > written to /proc/kmsg, so syslogd(8) can still be used to control exactly > where > kernel messages appear. When the -n option is used, dmesg will not print or > clear the kernel ring buffer. Busybox's dmesg also support the option. Raw run_serial() calls are used during the login process when it's too early to run the dmesg command. Fixes [ YOCTO #16189 ] Signed-off-by: Yoann Congal <[email protected]> --- meta/lib/oeqa/utils/qemurunner.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 57f86970fe..1ceeeff96a 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -77,6 +77,7 @@ class QemuRunner: self.boot_patterns = boot_patterns self.tmpfsdir = tmpfsdir self.native_sysroot = native_sysroot + self.kernel_messages_disabled = False self.runqemutime = 300 if not workdir: @@ -659,6 +660,11 @@ class QemuRunner: def run_serial(self, command, raw=False, timeout=60): # Returns (status, output) where status is 1 on success and 0 on error + # Disable kernel messages before running the first non-raw command + if not raw and not self.kernel_messages_disabled: + self.kernel_messages_disabled = True + self.run_serial("dmesg -n 1\n", raw=True) + # We assume target system have echo to get command status if not raw: command = "%s; echo $?\n" % command
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#233091): https://lists.openembedded.org/g/openembedded-core/message/233091 Mute This Topic: https://lists.openembedded.org/mt/118316486/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
