]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qtest: fix 'expression is always false' build failure in qtest_has_accel()
authorIgor Mammedov <imammedo@redhat.com>
Wed, 27 Oct 2021 15:10:12 +0000 (11:10 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 1 Nov 2021 22:49:10 +0000 (18:49 -0400)
If KVM is disabled or not present, qtest library build
may fail with:
   libqtest.c: In function 'qtest_has_accel':
      comparison of unsigned expression < 0 is always false
      [-Werror=type-limits]
         for (i = 0; i < ARRAY_SIZE(targets); i++) {

due to empty 'targets' array.
Fix it by making sure that CONFIG_KVM_TARGETS isn't empty.

Fixes: e741aff0f43343 ("tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator")
Reported-by: Jason Andryuk <jandryuk@gmail.com>
Suggested-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20211027151012.2639284-1-imammedo@redhat.com>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
meson.build

index b09272839765b9847dee7091c5e3911c17c7def7..ab4a5723f058d1a86b99e970915ed26c890a10f4 100644 (file)
@@ -75,7 +75,7 @@ else
   kvm_targets = []
 endif
 
-kvm_targets_c = ''
+kvm_targets_c = '""'
 if not get_option('kvm').disabled() and targetos == 'linux'
   kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
 endif