From: Radoslaw Jablonski Date: Wed, 7 Mar 2018 14:40:35 +0000 (+0000) Subject: virt: Fix unit tests build with libvirt versions < 1.3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1faf3478bc1e3fedea3781510554277876429793;p=collectd.git virt: Fix unit tests build with libvirt versions < 1.3 Previously too much code was disabled in ifdefs, and during compilation with old libvirt (version < 1.3.x) warning was shown because of unused test variables. Change-Id: I631c9446add4ccef068a3c4585f8750a5930f406 Signed-off-by: Radoslaw Jablonski --- diff --git a/src/virt_test.c b/src/virt_test.c index 6201571b..4596e5df 100644 --- a/src/virt_test.c +++ b/src/virt_test.c @@ -25,8 +25,6 @@ #include "testing.h" #include "virt.c" /* sic */ -#ifdef HAVE_LIST_ALL_DOMAINS - virDomainPtr *domains; static int setup(void) { @@ -52,6 +50,7 @@ static int teardown(void) { return 0; } +#ifdef HAVE_LIST_ALL_DOMAINS DEF_TEST(get_domain_state_notify) { if (setup() == 0) { int n_domains = virConnectListAllDomains( @@ -68,6 +67,7 @@ DEF_TEST(get_domain_state_notify) { return 0; } +#endif DEF_TEST(persistent_domains_state_notification) { if (setup() == 0) { @@ -78,13 +78,12 @@ DEF_TEST(persistent_domains_state_notification) { return 0; } -#endif int main(void) { #ifdef HAVE_LIST_ALL_DOMAINS RUN_TEST(get_domain_state_notify); - RUN_TEST(persistent_domains_state_notification); #endif + RUN_TEST(persistent_domains_state_notification); END_TEST; }