]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
tests/functional: Fix bad usage of has_cmd
authorThomas Huth <thuth@redhat.com>
Tue, 10 Sep 2024 07:58:20 +0000 (09:58 +0200)
committerThomas Huth <thuth@redhat.com>
Wed, 11 Sep 2024 07:49:12 +0000 (09:49 +0200)
has_cmd returns a tuple, not a boolean value. This fixes a crash when
e.g. "tesseract" is not available in the test_m68k_nextcube test.

Reported-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240910075820.51346-1-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/cmd.py
tests/functional/qemu_test/tesseract.py

index 3acd61732444573084c2d1bd03cf23fd9d22dcb4..cbabb1ceed3ca954d83fe648b63038e3255816de 100644 (file)
@@ -187,7 +187,7 @@ def get_qemu_img(test):
     qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
     if os.path.exists(qemu_img):
         return qemu_img
-    if has_cmd('qemu-img'):
+    (has_system_qemu_img, errmsg) = has_cmd('qemu-img')
+    if has_system_qemu_img:
         return 'qemu-img'
-    test.skipTest('Could not find "qemu-img", which is required to '
-                  'create temporary images')
+    test.skipTest(errmsg)
index c4087b7c11988f33748a41a15392dc37823e82b3..db441027b9cf1fe9ed4193b0950184cf1416019e 100644 (file)
@@ -11,7 +11,8 @@ import logging
 from . import has_cmd, run_cmd
 
 def tesseract_available(expected_version):
-    if not has_cmd('tesseract'):
+    (has_tesseract, _) = has_cmd('tesseract')
+    if not has_tesseract:
         return False
     (stdout, stderr, ret) = run_cmd([ 'tesseract', '--version'])
     if ret: