Skip to content

Commit b5fd302

Browse files
committed
io/iommu: Check test specific logs without clearing dmesg
While running iommu_tests.py test, dmesg is cleared for checking test specific kernel logs. This affects other tests that depends on dmesg. Update the process of capturing test specific 'warn,crit,alert,err' logs without clearing dmesg. Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
1 parent 2c1ad6f commit b5fd302

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

io/iommu/iommu_tests.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def setUp(self):
120120
self.cancel(f"{pci_addr} belongs to iommu group having more "
121121
"than one device but system does not support "
122122
"domain type change for such device")
123-
cmd = "dmesg -C"
123+
124+
cmd = "dmesg -T --level=alert,crit,err,warn > dmesg_initial.txt"
124125
process.run(cmd, ignore_status=True, shell=True, sudo=True)
125126

126127
# TODO: Need to push this to avocado utils later
@@ -391,8 +392,17 @@ def check_dmesg(self):
391392
"""
392393
Checks for any error or failure messages in dmesg after test
393394
"""
394-
cmd = "dmesg -T --level=alert,crit,err,warn"
395-
out = process.run(cmd, ignore_status=True, shell=True, sudo=True)
396-
output = out.stdout_text
397-
if output:
398-
self.fail(f"Kernel Errors: {output}")
395+
396+
cmd = "dmesg -T --level=alert,crit,err,warn > dmesg_final.txt"
397+
process.run(cmd, ignore_status=True, shell=True, sudo=True)
398+
399+
cmd = "diff dmesg_final.txt dmesg_initial.txt"
400+
dmesg_diff = process.run(cmd, ignore_status=True, shell=True, sudo=True).stdout_text
401+
if dmesg_diff != '':
402+
self.whiteboard = f"{dmesg_diff}"
403+
self.fail("Running test logged warn,err,alert,crit logs in dmesg. "
404+
"Please refer whiteboard of the test result")
405+
406+
# Clean temprorary files created
407+
cmd = "rm dmesg_final.txt dmesg_initial.txt"
408+
process.run(cmd, ignore_status=True, shell=True, sudo=True)

0 commit comments

Comments
 (0)