[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] tests: Handle networkxml2argvtest being configure --localstatedir dependant



networkxml2argvtest indirectly calls networkDnsmasqLeaseFileName
that depends on configure --localstatedir. Therefore, the .argv
files used in the test have to be created with this localstatedir.

Move the .argv to .argv.in files with a @localstatedir@ placeholder.
---
 tests/.gitignore                                   |    1 +
 tests/Makefile.am                                  |   13 ++++++++++++-
 ...lated-network.argv => isolated-network.argv.in} |    2 +-
 ...ns-hosts.argv => nat-network-dns-hosts.argv.in} |    2 +-
 ...ord.argv => nat-network-dns-txt-record.argv.in} |    2 +-
 .../{nat-network.argv => nat-network.argv.in}      |    2 +-
 ...etboot-network.argv => netboot-network.argv.in} |    2 +-
 ...-network.argv => netboot-proxy-network.argv.in} |    2 +-
 ...{routed-network.argv => routed-network.argv.in} |    0
 9 files changed, 19 insertions(+), 7 deletions(-)
 rename tests/networkxml2argvdata/{isolated-network.argv => isolated-network.argv.in} (68%)
 rename tests/networkxml2argvdata/{nat-network-dns-hosts.argv => nat-network-dns-hosts.argv.in} (64%)
 rename tests/networkxml2argvdata/{nat-network-dns-txt-record.argv => nat-network-dns-txt-record.argv.in} (84%)
 rename tests/networkxml2argvdata/{nat-network.argv => nat-network.argv.in} (83%)
 rename tests/networkxml2argvdata/{netboot-network.argv => netboot-network.argv.in} (80%)
 rename tests/networkxml2argvdata/{netboot-proxy-network.argv => netboot-proxy-network.argv.in} (79%)
 rename tests/networkxml2argvdata/{routed-network.argv => routed-network.argv.in} (100%)

diff --git a/tests/.gitignore b/tests/.gitignore
index 7f26dd7..be8d321 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -10,6 +10,7 @@ conftest
 esxutilstest
 eventtest
 interfacexml2xmltest
+networkxml2argvdata/*.argv
 networkxml2xmltest
 nodedevxml2xmltest
 nodeinfotest
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7db9d1f..3c4b7ee 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,7 +50,8 @@ EXTRA_DIST =		\
 	networkschematest \
 	networkxml2xmlin \
 	networkxml2xmlout \
-	networkxml2argvdata \
+	$(wildcard networkxml2argvdata/*.argv.in) \
+	$(wildcard networkxml2argvdata/*.xml) \
 	nodedevschemadata \
 	nodedevschematest \
 	nodeinfodata     \
@@ -358,10 +359,20 @@ networkxml2xmltest_SOURCES = \
 	testutils.c testutils.h
 networkxml2xmltest_LDADD = $(LDADDS)
 
+networkxml2argvdata_argv_in = $(wildcard networkxml2argvdata/*.argv.in)
+networkxml2argvdata_argv = $(networkxml2argvdata_argv_in:%.argv.in=%.argv)
+
 networkxml2argvtest_SOURCES = \
 	networkxml2argvtest.c \
 	testutils.c testutils.h
 networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
+networkxml2argvtest_DEPENDENCIES = $(networkxml2argvdata_argv)
+
+$(srcdir)/networkxml2argvdata/%.argv: $(srcdir)/networkxml2argvdata/%.argv.in
+	$(AM_V_GEN)sed						\
+	    -e 's![ ]localstatedir[@]!$(localstatedir)!g'	\
+	    < $< > $ -t &&					\
+	    mv $ -t $@
 
 nwfilterxml2xmltest_SOURCES = \
 	nwfilterxml2xmltest.c \
diff --git a/tests/networkxml2argvdata/isolated-network.argv b/tests/networkxml2argvdata/isolated-network.argv.in
similarity index 68%
rename from tests/networkxml2argvdata/isolated-network.argv
rename to tests/networkxml2argvdata/isolated-network.argv.in
index f801396..c05768d 100644
--- a/tests/networkxml2argvdata/isolated-network.argv
+++ b/tests/networkxml2argvdata/isolated-network.argv.in
@@ -1,5 +1,5 @@
 /usr/sbin/dnsmasq --strict-order --bind-interfaces --conf-file= \
 --except-interface lo --dhcp-option=3 --listen-address 192.168.152.1 \
 --dhcp-range 192.168.152.2,192.168.152.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
+--dhcp-leasefile= localstatedir@/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
 --dhcp-no-override\
diff --git a/tests/networkxml2argvdata/nat-network-dns-hosts.argv b/tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
similarity index 64%
rename from tests/networkxml2argvdata/nat-network-dns-hosts.argv
rename to tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
index dce075b..5545f9f 100644
--- a/tests/networkxml2argvdata/nat-network-dns-hosts.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
@@ -1,3 +1,3 @@
 /usr/sbin/dnsmasq --strict-order --bind-interfaces --conf-file= \
 --except-interface lo --listen-address 192.168.122.1 \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+--addn-hosts= localstatedir@/lib/libvirt/dnsmasq/default.addnhosts\
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
similarity index 84%
rename from tests/networkxml2argvdata/nat-network-dns-txt-record.argv
rename to tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
index 9d74543..f799634 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
@@ -4,5 +4,5 @@
 --listen-address 2001:db8:ac10:fe01::1 \
 --listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
 --dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-leasefile= localstatedir@/lib/libvirt/dnsmasq/default.leases \
 --dhcp-lease-max=253 --dhcp-no-override\
diff --git a/tests/networkxml2argvdata/nat-network.argv b/tests/networkxml2argvdata/nat-network.argv.in
similarity index 83%
rename from tests/networkxml2argvdata/nat-network.argv
rename to tests/networkxml2argvdata/nat-network.argv.in
index 181623f..680241b 100644
--- a/tests/networkxml2argvdata/nat-network.argv
+++ b/tests/networkxml2argvdata/nat-network.argv.in
@@ -3,5 +3,5 @@
 --listen-address 192.168.123.1 --listen-address 2001:db8:ac10:fe01::1 \
 --listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
 --dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-leasefile= localstatedir@/lib/libvirt/dnsmasq/default.leases \
 --dhcp-lease-max=253 --dhcp-no-override\
diff --git a/tests/networkxml2argvdata/netboot-network.argv b/tests/networkxml2argvdata/netboot-network.argv.in
similarity index 80%
rename from tests/networkxml2argvdata/netboot-network.argv
rename to tests/networkxml2argvdata/netboot-network.argv.in
index 27ffaa1..57cda0e 100644
--- a/tests/networkxml2argvdata/netboot-network.argv
+++ b/tests/networkxml2argvdata/netboot-network.argv.in
@@ -1,6 +1,6 @@
 /usr/sbin/dnsmasq --strict-order --bind-interfaces --domain example.com \
 --conf-file= --except-interface lo --listen-address 192.168.122.1 \
 --dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
+--dhcp-leasefile= localstatedir@/lib/libvirt/dnsmasq/netboot.leases \
 --dhcp-lease-max=253 --dhcp-no-override --enable-tftp \
 --tftp-root /var/lib/tftproot --dhcp-boot pxeboot.img\
diff --git a/tests/networkxml2argvdata/netboot-proxy-network.argv b/tests/networkxml2argvdata/netboot-proxy-network.argv.in
similarity index 79%
rename from tests/networkxml2argvdata/netboot-proxy-network.argv
rename to tests/networkxml2argvdata/netboot-proxy-network.argv.in
index 3e0c5a5..723539e 100644
--- a/tests/networkxml2argvdata/netboot-proxy-network.argv
+++ b/tests/networkxml2argvdata/netboot-proxy-network.argv.in
@@ -1,5 +1,5 @@
 /usr/sbin/dnsmasq --strict-order --bind-interfaces --domain example.com \
 --conf-file= --except-interface lo --listen-address 192.168.122.1 \
 --dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
+--dhcp-leasefile= localstatedir@/lib/libvirt/dnsmasq/netboot.leases \
 --dhcp-lease-max=253 --dhcp-no-override --dhcp-boot pxeboot.img,,10.20.30.40\
diff --git a/tests/networkxml2argvdata/routed-network.argv b/tests/networkxml2argvdata/routed-network.argv.in
similarity index 100%
rename from tests/networkxml2argvdata/routed-network.argv
rename to tests/networkxml2argvdata/routed-network.argv.in
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]