Skip to contentSkip to conversation

rteval: Fix the unit test in osinfo

PATCH New John Kacur 1 participant 1 message May 26, 2023

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/1 rteval: Fix the unit test in osinfo

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.

---
 rteval/sysinfo/osinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rteval/sysinfo/osinfo.py +1 -1
index 7b7bfe9ce4ec..ead5e3939cfa 100644
@@ -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]:
Signature · 1 line
2.40.1