Skip to contentSkip to conversation

virtio-rng: do not use g_assert_cmpint

PATCH In review Paolo Bonzini 2 participants 2 messages Nov 27, 2012 – Nov 29, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-rng: do not use g_assert_cmpint

g_assert_cmpint is not available on glib 2.12, which is the minimum version required to build QEMU (we only require 2.16 to run tests, since that is the first version including GTester). Do not use it in hardware models, use a normal assertion instead.

This fixes the buildbot failure for default_x86_64_rhel5.

---
 hw/virtio-rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/virtio-rng.c +1 -2
index f4ed9cf..df329f2 100644
@@ -173,10 +173,9 @@ VirtIODevice *virtio_rng_init(DeviceState *dev, VirtIORNGConf *conf)
     vrng->qdev = dev;
     vrng->conf = conf;
 
+    assert(vrng->conf->max_bytes <= INT64_MAX);
     vrng->quota_remaining = vrng->conf->max_bytes;
 
-    g_assert_cmpint(vrng->conf->max_bytes, <=, INT64_MAX);
-
     vrng->rate_limit_timer = qemu_new_timer_ms(vm_clock,
                                                check_rate_limit, vrng);
 
Signature · 1 line
1.8.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Paolo Bonzini

g_assert_cmpint is not available on glib 2.12, which is the minimum version required to build QEMU (we only require 2.16 to run tests, since that is the first version including GTester). Do not use it in hardware models, use a normal assertion instead.

This fixes the buildbot failure for default_x86_64_rhel5.

---
 hw/virtio-rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)