[ACT][PATCH] UBUNTU: SAUCE: ubuntu_boot: use dmesg collected by autotest
Po-Hsu Lin
po-hsu.lin at canonical.com
Tue Aug 3 11:30:26 UTC 2021
BugLink: https://bugs.launchpad.net/bugs/1937276
Checking error from syslog works for freshly provisioned systems, but
with the manually provisioned systems since the log is not guaranteed
to be the boot log for the current session, it can be contaminated by
other tests and trigger false-positives.
Use dmesg collected by the autotest framework for this instead.
Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
ubuntu_boot/ubuntu_boot.py | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/ubuntu_boot/ubuntu_boot.py b/ubuntu_boot/ubuntu_boot.py
index 8782818f..7d7799b2 100644
--- a/ubuntu_boot/ubuntu_boot.py
+++ b/ubuntu_boot/ubuntu_boot.py
@@ -14,15 +14,24 @@ class ubuntu_boot(test.test):
def log_check(self):
'''Test for checking error patterns in log files'''
- '''Centos Specific Boot Test Checks'''
- os_dist = platform.linux_distribution()[0].split(' ')[0]
+ '''Please run this on a freshly rebooted / provisioned system'''
- # dmesg will be cleared out in autotest with dmesg -c before the test starts
- # Let's check for /var/log/syslog instead
- if os_dist == 'CentOS':
- logfile = '/var/log/messages'
+ # dmesg before the test will be compressed and cleared with dmesg -c
+ # the log will be stored in autotest/client/results/default/sysinfo/dmesg.gz
+ dmesg_gz = os.path.join(os.environ['AUTODIR'], 'results/default/sysinfo/dmesg.gz')
+ if os.path.exists(dmesg_gz):
+ logfile = '/tmp/dmesg-ubuntu-boot'
+ cmd = 'gzip -dk {} -c > {}'.format(dmesg_gz, logfile)
+ utils.system(cmd, ignore_status=True)
else:
+ # Fallback to syslog, which works for newly deployed node but not ideal for
+ # manually provisioned SUTs as the content is not just for the current session
logfile = '/var/log/syslog'
+ # Centos Specific Boot Test Checks
+ os_dist = platform.linux_distribution()[0].split(' ')[0]
+ if os_dist == 'CentOS':
+ logfile = '/var/log/messages'
+
patterns = [
'kernel: \[ *\d+\.\d+\] BUG:.*',
'kernel: \[ *\d+\.\d+\] Oops:.*',
--
2.25.1
More information about the kernel-team
mailing list