Skip to contentSkip to conversation

qtest: fix 'expression is always false' build failure in qtest_has_accel()

PATCH In review Igor Mammedov 2 participants 2 messages Oct 27, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qtest: fix 'expression is always false' build failure in qtest_has_accel()

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")
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 2c5b53cbe2..ff85e9c2af 100644
@@ -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
Signature · 1 line
2.27.0
Tested-by on v2 1/1
#1 lore raw
Quoted 8 lines · Igor Mammedov

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++) {

Quoted 7 lines

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")

Thanks,
Jason