diff mbox series

rteval: Fix the unit test in osinfo

Message ID 20230526211444.32063-1-jkacur@redhat.com
State New
Headers show
Series rteval: Fix the unit test in osinfo | expand

Commit Message

John Kacur May 26, 2023, 9:14 p.m. UTC
Fix the unit test in osinfo

The unit test will fail if /var/log/dmesg doesn't exist.

However, the copy_dmesg method in the OSInfo Class will just return
if the file doesn't exist.

Fix the unit test by mimicing this behaviour by continuing
if the /var/log/dmesg doesn't exist.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval/sysinfo/osinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py
index 7b7bfe9ce4ec..ead5e3939cfa 100644
--- a/rteval/sysinfo/osinfo.py
+++ b/rteval/sysinfo/osinfo.py
@@ -122,7 +122,7 @@  def unit_test(rootdir):
 
         print("Testing OSInfo::copy_dmesg('/tmp'): ", end=' ')
         osi.copy_dmesg('/tmp')
-        if os.path.isfile("/tmp/dmesg"):
+        if os.path.isfile("/tmp/dmesg") and os.path.isfile("/var/log/dmesg"):
             md5orig = subprocess.check_output(("md5sum", "/var/log/dmesg"))
             md5copy = subprocess.check_output(("md5sum", "/tmp/dmesg"))
             if md5orig.split(" ")[0] == md5copy.split(" ")[0]: