Makefile.am 13.2 KB
Newer Older
K
Karel Zak 已提交
1 2
## Process this file with automake to produce Makefile.in

3
## Copyright (C) 2005-2012 Red Hat, Inc.
4 5
## See COPYING.LIB for the License of this software

6 7
SHELL = $(PREFERABLY_POSIX_SHELL)

K
Karel Zak 已提交
8
INCLUDES = \
9 10 11
	-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
	-I$(top_builddir)/include -I$(top_srcdir)/include \
	-I$(top_builddir)/src -I$(top_srcdir)/src \
12
	-I$(top_srcdir)/src/util \
13 14
	-I$(top_srcdir)/src/conf \
	$(GETTEXT_CPPFLAGS)
E
Eric Blake 已提交
15 16

AM_CFLAGS = \
17 18
	$(LIBXML_CFLAGS) \
	$(GNUTLS_CFLAGS) \
19
	$(SASL_CFLAGS) \
20
	$(SELINUX_CFLAGS) \
J
Jamie Strandboge 已提交
21
	$(APPARMOR_CFLAGS) \
22
	$(YAJL_CFLAGS) \
E
Eric Blake 已提交
23 24
	$(COVERAGE_CFLAGS) \
	$(WARN_CFLAGS)
25

26 27 28 29 30
if WITH_DRIVER_MODULES
INCLUDES += \
	-DTEST_DRIVER_DIR=\"$(top_builddir)/src/.libs\"
endif

31
PROBES_O =
32
if WITH_DTRACE_PROBES
33 34 35
PROBES_O += ../src/probes.o
endif

K
Karel Zak 已提交
36
LDADDS = \
37
	$(STATIC_BINARIES) \
38 39
	$(LIBXML_LIBS) \
        $(GNUTLS_LIBS) \
40
        $(SASL_LIBS) \
41
        $(SELINUX_LIBS) \
J
Jamie Strandboge 已提交
42
        $(APPARMOR_LIBS) \
43
        $(YAJL_LIBS) \
44
        $(WARN_CFLAGS) \
45
	../src/libvirt_test.la \
46
	$(PROBES_O) \
47
	../gnulib/lib/libgnu.la \
J
John Levon 已提交
48
	$(LIBSOCKET) \
49
        $(COVERAGE_LDFLAGS)
K
Karel Zak 已提交
50

51
EXTRA_DIST =		\
52
	capabilityschemadata \
E
Eric Blake 已提交
53 54 55 56
	capabilityschematest \
	commanddata \
	confdata \
	cputestdata \
57
	domainschemadata \
E
Eric Blake 已提交
58 59 60 61
	domainschematest \
	domainsnapshotschematest \
	domainsnapshotxml2xmlin \
	domainsnapshotxml2xmlout \
62
	interfaceschemadata \
63
	lxcxml2xmldata \
E
Eric Blake 已提交
64 65 66
	networkschematest \
	networkxml2xmlin \
	networkxml2xmlout \
67
	networkxml2argvdata \
E
Eric Blake 已提交
68 69 70 71 72 73 74 75 76 77
	nodedevschemadata \
	nodedevschematest \
	nodeinfodata     \
	nwfilterschematest \
	nwfilterxml2xmlin \
	nwfilterxml2xmlout \
	oomtrace.pl \
	qemuhelpdata \
	qemuxml2argvdata \
	qemuxml2xmloutdata \
P
Philipp Hahn 已提交
78
	qemuxmlnsdata \
E
Eric Blake 已提交
79 80
	schematestutils.sh \
	sexpr2xmldata \
81
	storagepoolschematest \
82
	storagepoolxml2xmlin \
E
Eric Blake 已提交
83
	storagepoolxml2xmlout \
84
	storagevolschematest \
85
	storagevolxml2xmlin \
E
Eric Blake 已提交
86 87
	storagevolxml2xmlout \
	test-lib.sh	\
88
	vmx2xmldata \
E
Eric Blake 已提交
89 90 91
	xencapsdata \
	xmconfigdata \
	xml2sexprdata \
92 93
	xml2vmxdata \
	.valgrind.supp
K
Karel Zak 已提交
94

95 96
test_helpers = commandhelper ssh conftest
test_programs = virshtest sockettest \
E
Eric Blake 已提交
97
	nodeinfotest virbuftest \
98 99
	commandtest seclabeltest \
	virhashtest virnetmessagetest virnetsockettest \
100
	utiltest virnettlscontexttest shunloadtest \
101 102
	virtimetest viruritest virkeyfiletest \
	virauthconfigtest
103

104 105 106
# This is a fake SSH we use from virnetsockettest
ssh_SOURCES = ssh.c
ssh_LDADD = $(COVERAGE_LDFLAGS)
107

108
if WITH_XEN
109
test_programs += xml2sexprtest sexpr2xmltest \
110
	xmconfigtest xencapstest statstest reconnect
111
endif
112
if WITH_QEMU
113
test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \
114 115
	qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
	qemumonitortest
116 117
endif

118
if WITH_LXC
119
test_programs += lxcxml2xmltest
120 121
endif

122
if WITH_OPENVZ
123
test_programs += openvzutilstest
124 125
endif

126
if WITH_ESX
127
test_programs += esxutilstest
128 129 130
endif

if WITH_VMX
131
test_programs += vmx2xmltest xml2vmxtest
132 133
endif

134
if WITH_CIL
135
test_programs += object-locking
136 137
endif

138
if HAVE_YAJL
139
test_programs += jsontest
140 141
endif

142
test_programs += networkxml2xmltest
143

144
if WITH_NETWORK
145
test_programs += networkxml2argvtest
146
endif
147

148
test_programs += nwfilterxml2xmltest
149

150
test_programs += storagevolxml2xmltest storagepoolxml2xmltest
151

152
test_programs += nodedevxml2xmltest
M
Mark McLoughlin 已提交
153

154
test_programs += interfacexml2xmltest
155

156
test_programs += cputest
157

158 159
test_scripts = \
	capabilityschematest \
160
	interfaceschematest \
161 162 163 164
	networkschematest \
	storagepoolschematest \
	storagevolschematest \
	domainschematest \
165
	nodedevschematest \
166 167
	nwfilterschematest \
	domainsnapshotschematest
168

A
Atsushi SAKAI 已提交
169
if WITH_LIBVIRTD
170 171 172 173 174 175
test_scripts +=				\
	test_conf.sh			\
	cpuset				\
	daemon-conf			\
	define-dev-segfault		\
	int-overflow			\
J
Jim Meyering 已提交
176 177
	libvirtd-fail			\
	libvirtd-pool			\
178 179 180 181 182 183
	read-bufsiz			\
	read-non-seekable		\
	start				\
	undefine			\
	vcpupin				\
	virsh-all			\
184
	virsh-optparse			\
185
	virsh-schedinfo			\
J
Jim Meyering 已提交
186
	virsh-synopsis
187 188

test_programs += eventtest
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
else
EXTRA_DIST += 				\
	test_conf.sh			\
	cpuset				\
	daemon-conf			\
	define-dev-segfault		\
	int-overflow			\
	libvirtd-fail			\
	libvirtd-pool			\
	read-bufsiz			\
	read-non-seekable		\
	start				\
	undefine			\
	vcpupin				\
	virsh-all			\
	virsh-optparse			\
	virsh-schedinfo			\
	virsh-synopsis
A
Atsushi SAKAI 已提交
207
endif
208

J
Jamie Strandboge 已提交
209 210
if WITH_SECDRIVER_APPARMOR
test_scripts += virt-aa-helper-test
211 212
else
EXTRA_DIST += virt-aa-helper-test
J
Jamie Strandboge 已提交
213
endif
214

215 216
EXTRA_DIST += $(test_scripts)

217 218 219 220 221 222
if WITH_TESTS
noinst_PROGRAMS = $(test_programs) $(test_helpers)
noinst_LTLIBRARIES = libshunload.la
else
check_PROGRAMS = $(test_programs) $(test_helpers)
check_LTLIBRARIES = libshunload.la
223
endif
224

225 226
TESTS = $(test_programs) \
	$(test_scripts)
227

228
# NB, automake < 1.10 does not provide the real
229
# abs_top_{src/build}dir or builddir variables, so don't rely
230
# on them here. Fake them with 'pwd'
231 232 233 234 235 236
# Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an
# intermediate shell variable, but must do all the expansion in make

lv_abs_top_builddir=`cd '$(top_builddir)'; pwd`
path_add = $(lv_abs_top_builddir)/daemon$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tools$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tests

237
TESTS_ENVIRONMENT =				\
238
  abs_top_builddir=$(lv_abs_top_builddir)	\
J
Jim Meyering 已提交
239
  abs_top_srcdir=`cd '$(top_srcdir)'; pwd`	\
240
  abs_builddir=`pwd`				\
241
  abs_srcdir=`cd '$(srcdir)'; pwd`		\
242
  CONFIG_HEADER="`cd '$(top_builddir)'; pwd`/config.h"	\
J
Jim Meyering 已提交
243
  PATH="$(path_add)$(PATH_SEPARATOR)$$PATH"	\
244
  SHELL="$(SHELL)"				\
245
  LIBVIRT_DRIVER_DIR="$(abs_top_builddir)/src/.libs" \
246
  LC_ALL=C					\
247 248
  $(VG)

249

250
valgrind:
251
	$(MAKE) check VG="valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"
252

253 254 255 256 257
sockettest_SOURCES = \
	sockettest.c \
	testutils.c testutils.h
sockettest_LDADD = ../src/libvirt_util.la $(LDADDS)

258
if WITH_XEN
259
xml2sexprtest_SOURCES = \
260
	xml2sexprtest.c testutilsxen.c testutilsxen.h \
261
	testutils.c testutils.h
262
xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
263 264

sexpr2xmltest_SOURCES = \
265
	sexpr2xmltest.c testutilsxen.c testutilsxen.h \
266
	testutils.c testutils.h
267
sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
268

269
xmconfigtest_SOURCES = \
270
	xmconfigtest.c testutilsxen.c testutilsxen.h \
271
	testutils.c testutils.h
272
xmconfigtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
273

274 275 276 277 278
xencapstest_SOURCES = \
	xencapstest.c testutils.h testutils.c
xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)

reconnect_SOURCES = \
279
	reconnect.c testutils.h testutils.c
280 281
reconnect_LDADD = $(LDADDS)

282 283 284 285
statstest_SOURCES = \
	statstest.c testutils.h testutils.c
statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)

286 287 288 289 290 291
else
EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
	xencapstest.c reconnect.c \
	testutilsxen.c testutilsxen.h
endif

292
if WITH_QEMU
293 294 295 296 297 298 299

qemu_LDADDS = ../src/libvirt_driver_qemu.la

if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la
endif

300
qemuxml2argvtest_SOURCES = \
301
	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
302
	testutils.c testutils.h
303
qemuxml2argvtest_LDADD = $(qemu_LDADDS)  $(LDADDS)
304 305

qemuxml2xmltest_SOURCES = \
306
	qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
307
	testutils.c testutils.h
308
qemuxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
309

P
Philipp Hahn 已提交
310 311 312 313 314
qemuxmlnstest_SOURCES = \
	qemuxmlnstest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
qemuxmlnstest_LDADD = $(qemu_LDADDS)  $(LDADDS)

315 316 317
qemuargv2xmltest_SOURCES = \
	qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
318
qemuargv2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
319 320

qemuhelptest_SOURCES = qemuhelptest.c testutils.c testutils.h
321
qemuhelptest_LDADD = $(qemu_LDADDS) $(LDADDS)
322

323 324 325
qemumonitortest_SOURCES = qemumonitortest.c testutils.c testutils.h
qemumonitortest_LDADD = $(qemu_LDADDS) $(LDADDS)

326 327 328 329
domainsnapshotxml2xmltest_SOURCES = \
	domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
330
else
331 332
EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
	qemuxmlnstest.c qemuhelptest.c domainsnapshotxml2xmltest.c \
333
	qemumonitortest.c testutilsqemu.c testutilsqemu.h
334
endif
335

336 337 338 339 340 341 342 343 344 345 346 347
if WITH_LXC

lxc_LDADDS = ../src/libvirt_driver_lxc.la

lxcxml2xmltest_SOURCES = \
	lxcxml2xmltest.c testutilslxc.c testutilslxc.h \
	testutils.c testutils.h
lxcxml2xmltest_LDADD = $(lxc_LDADDS) $(LDADDS)
else
EXTRA_DIST += lxcxml2xmltest.c testutilslxc.c testutilslxc.h
endif

348 349 350 351 352 353 354 355 356 357
if WITH_OPENVZ
openvzutilstest_SOURCES = \
	openvzutilstest.c \
	testutils.c testutils.h
openvzutilstest_LDADD = ../src/libvirt_driver_openvz.la $(LDADDS)
else
EXTRA_DIST += openvzutilstest.c
endif
EXTRA_DIST += openvzutilstest.conf

358 359 360 361 362
if WITH_ESX
esxutilstest_SOURCES = \
	esxutilstest.c \
	testutils.c testutils.h
esxutilstest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS)
363 364 365
else
EXTRA_DIST += esxutilstest.c
endif
366

367
if WITH_VMX
368 369 370
vmx2xmltest_SOURCES = \
	vmx2xmltest.c \
	testutils.c testutils.h
371
vmx2xmltest_LDADD = ../src/libvirt_vmx.la $(LDADDS)
372 373 374 375

xml2vmxtest_SOURCES = \
	xml2vmxtest.c \
	testutils.c testutils.h
376
xml2vmxtest_LDADD = ../src/libvirt_vmx.la $(LDADDS)
377
else
378
EXTRA_DIST += vmx2xmltest.c xml2vmxtest.c
379 380
endif

381 382 383 384 385
networkxml2xmltest_SOURCES = \
	networkxml2xmltest.c \
	testutils.c testutils.h
networkxml2xmltest_LDADD = $(LDADDS)

386
if WITH_NETWORK
387 388 389 390
networkxml2argvtest_SOURCES = \
	networkxml2argvtest.c \
	testutils.c testutils.h
networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
391 392 393
else
EXTRA_DIST += networkxml2argvtest.c
endif
394

395 396 397 398 399
nwfilterxml2xmltest_SOURCES = \
	nwfilterxml2xmltest.c \
	testutils.c testutils.h
nwfilterxml2xmltest_LDADD = $(LDADDS)

400 401 402 403 404
storagevolxml2xmltest_SOURCES = \
	storagevolxml2xmltest.c \
	testutils.c testutils.h
storagevolxml2xmltest_LDADD = $(LDADDS)

405 406 407 408 409
storagepoolxml2xmltest_SOURCES = \
	storagepoolxml2xmltest.c \
	testutils.c testutils.h
storagepoolxml2xmltest_LDADD = $(LDADDS)

M
Mark McLoughlin 已提交
410 411 412
nodedevxml2xmltest_SOURCES = \
	nodedevxml2xmltest.c \
	testutils.c testutils.h
413
nodedevxml2xmltest_LDADD = $(LDADDS)
M
Mark McLoughlin 已提交
414

415 416 417 418 419
interfacexml2xmltest_SOURCES = \
	interfacexml2xmltest.c \
	testutils.c testutils.h
interfacexml2xmltest_LDADD = $(LDADDS)

420 421 422 423 424
cputest_SOURCES = \
	cputest.c \
	testutils.c testutils.h
cputest_LDADD = $(LDADDS)

425 426 427 428 429
virshtest_SOURCES = \
	virshtest.c \
	testutils.c testutils.h
virshtest_LDADD = $(LDADDS)

D
Daniel Veillard 已提交
430 431 432 433
conftest_SOURCES = \
	conftest.c
conftest_LDADD = $(LDADDS)

434 435 436 437
nodeinfotest_SOURCES = \
	nodeinfotest.c testutils.h testutils.c
nodeinfotest_LDADD = $(LDADDS)

438 439
commandtest_SOURCES = \
	commandtest.c testutils.h testutils.c
E
Eric Blake 已提交
440
commandtest_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS)
441 442 443 444
commandtest_LDADD = $(LDADDS)

commandhelper_SOURCES = \
	commandhelper.c
E
Eric Blake 已提交
445
commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS)
446 447
commandhelper_LDADD = $(LDADDS)

448 449
virnetmessagetest_SOURCES = \
	virnetmessagetest.c testutils.h testutils.c
E
Eric Blake 已提交
450
virnetmessagetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
451 452
virnetmessagetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

453 454
virnetsockettest_SOURCES = \
	virnetsockettest.c testutils.h testutils.c
E
Eric Blake 已提交
455
virnetsockettest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
456 457
virnetsockettest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

458
virnettlscontexttest_SOURCES = \
E
Eric Blake 已提交
459
	virnettlscontexttest.c testutils.h testutils.c
460
virnettlscontexttest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
E
Eric Blake 已提交
461 462 463 464 465 466 467
virnettlscontexttest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)
if HAVE_LIBTASN1
virnettlscontexttest_SOURCES += pkix_asn1_tab.c
virnettlscontexttest_LDADD += -ltasn1
else
EXTRA_DIST += pkix_asn1_tab.c
endif
468

469 470 471 472 473
virtimetest_SOURCES = \
	virtimetest.c testutils.h testutils.c
virtimetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
virtimetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

474 475 476 477
viruritest_SOURCES = \
	viruritest.c testutils.h testutils.c
viruritest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
viruritest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)
478

479 480 481 482 483
virkeyfiletest_SOURCES = \
	virkeyfiletest.c testutils.h testutils.c
virkeyfiletest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
virkeyfiletest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

484 485 486 487 488
virauthconfigtest_SOURCES = \
	virauthconfigtest.c testutils.h testutils.c
virauthconfigtest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
virauthconfigtest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

489 490 491
seclabeltest_SOURCES = \
	seclabeltest.c
seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS)
J
Jamie Strandboge 已提交
492

493 494 495 496
virbuftest_SOURCES = \
	virbuftest.c testutils.h testutils.c
virbuftest_LDADD = $(LDADDS)

497 498 499
virhashtest_SOURCES = \
	virhashtest.c virhashdata.h testutils.h testutils.c
virhashtest_LDADD = $(LDADDS)
500

501
jsontest_SOURCES = \
502
	jsontest.c testutils.h testutils.c
503 504
jsontest_LDADD = $(LDADDS)

M
Matthias Bolte 已提交
505 506 507 508
utiltest_SOURCES = \
	utiltest.c testutils.h testutils.c
utiltest_LDADD = $(LDADDS)

509 510
if WITH_LIBVIRTD
eventtest_SOURCES = \
511
	eventtest.c testutils.h testutils.c
512 513 514
eventtest_LDADD = -lrt $(LDADDS)
endif

515 516 517 518 519 520 521 522 523
libshunload_la_SOURCES = shunloadhelper.c
libshunload_la_LIBADD = ../src/libvirt.la
libshunload_la_LDFLAGS = -module -avoid-version -rpath /evil/libtool/hack/to/force/shared/lib/creation

shunloadtest_SOURCES = \
	shunloadtest.c
shunloadtest_LDADD = -lpthread
shunloadtest_DEPENDENCIES = libshunload.la

524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
if WITH_CIL
CILOPTFLAGS =
CILOPTINCS =
CILOPTPACKAGES = -package unix,str,cil
CILOPTLIBS = -linkpkg

object_locking_SOURCES = object-locking.ml

%.cmx: %.ml
	ocamlfind ocamlopt $(CILOPTFLAGS) $(CILOPTINCS) $(CILOPTPACKAGES) -c $<

object-locking: object-locking.cmx object-locking-files.txt
	ocamlfind ocamlopt $(CILOPTFLAGS) $(CILOPTINCS) $(CILOPTPACKAGES) $(CILOPTLIBS) $< -o $@

object-locking-files.txt:
	find $(top_builddir)/src/ -name '*.i' > $@

else
EXTRA_DIST += object-locking.ml
endif

545
CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.cmi *.cmx object-locking-files.txt