]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional/x86_64: Use the right Python interpreter & fix format string
authorThomas Huth <thuth@redhat.com>
Wed, 14 Jan 2026 10:11:01 +0000 (11:11 +0100)
committerThomas Huth <thuth@redhat.com>
Tue, 27 Jan 2026 14:20:43 +0000 (15:20 +0100)
The bad_vmstate test currently fails if the host does not have a "python3"
binary in $PATH because the vmstate-static-checker.py script is executed
directly, so that it gets run via its shebang line. Use the right Python
interpreter from sys.executable to fix this problem.

Additionally, there was another bug with the formatting of the error
message in case of failures: The "+" operator can only concatenate strings,
but not strings with integers. Use a proper format string here instead.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260114101101.36225-1-thuth@redhat.com>

tests/functional/x86_64/test_bad_vmstate.py

index 40098a8490b061f30f64803545748333858dc5ad..71a1c0cf6386ef11b702f47d16e93a261415aaff 100755 (executable)
@@ -5,6 +5,7 @@
 '''Test whether the vmstate-static-checker script detects problems correctly'''
 
 import subprocess
+import sys
 
 from qemu_test import QemuBaseTest
 
@@ -41,12 +42,13 @@ class BadVmStateTest(QemuBaseTest):
                                        'vmstate-static-checker.py')
 
         self.log.info('Comparing %s with %s', src_json, dst_json)
-        cp = subprocess.run([checkerscript, '-s', src_json, '-d', dst_json],
+        cp = subprocess.run([sys.executable, checkerscript,
+                             '-s', src_json, '-d', dst_json],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             text=True, check=False)
         if cp.returncode != 13:
-            self.fail('Unexpected return code of vmstate-static-checker: ' +
+            self.fail('Unexpected return code of vmstate-static-checker: %d' %
                       cp.returncode)
         if cp.stdout != EXPECTED_OUTPUT:
             self.log.info('vmstate-static-checker output:\n%s', cp.stdout)