Makefile.am 12.9 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 32 33 34 35
PROBES_O =
if WITH_DTRACE
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 \
E
Eric Blake 已提交
63 64 65
	networkschematest \
	networkxml2xmlin \
	networkxml2xmlout \
66
	networkxml2argvdata \
E
Eric Blake 已提交
67 68 69 70 71 72 73 74 75 76
	nodedevschemadata \
	nodedevschematest \
	nodeinfodata     \
	nwfilterschematest \
	nwfilterxml2xmlin \
	nwfilterxml2xmlout \
	oomtrace.pl \
	qemuhelpdata \
	qemuxml2argvdata \
	qemuxml2xmloutdata \
P
Philipp Hahn 已提交
77
	qemuxmlnsdata \
E
Eric Blake 已提交
78 79
	schematestutils.sh \
	sexpr2xmldata \
80
	storagepoolschematest \
81
	storagepoolxml2xmlin \
E
Eric Blake 已提交
82
	storagepoolxml2xmlout \
83
	storagevolschematest \
84
	storagevolxml2xmlin \
E
Eric Blake 已提交
85 86
	storagevolxml2xmlout \
	test-lib.sh	\
87
	vmx2xmldata \
E
Eric Blake 已提交
88 89 90
	xencapsdata \
	xmconfigdata \
	xml2sexprdata \
91 92
	xml2vmxdata \
	.valgrind.supp
K
Karel Zak 已提交
93

94
check_PROGRAMS = virshtest conftest sockettest \
95
	nodeinfotest qparamtest virbuftest \
96
	commandtest commandhelper seclabeltest \
97
	virhashtest virnetmessagetest virnetsockettest ssh \
98 99
	utiltest virnettlscontexttest shunloadtest \
	virtimetest
100 101

check_LTLIBRARIES = libshunload.la
102 103 104 105

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

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

116 117 118 119
if WITH_OPENVZ
check_PROGRAMS += openvzutilstest
endif

120
if WITH_ESX
121 122 123 124 125
check_PROGRAMS += esxutilstest
endif

if WITH_VMX
check_PROGRAMS += vmx2xmltest xml2vmxtest
126 127
endif

128
if WITH_CIL
129
check_PROGRAMS += object-locking
130 131
endif

132 133 134 135
if HAVE_YAJL
check_PROGRAMS += jsontest
endif

136
check_PROGRAMS += networkxml2xmltest
137

138
if WITH_NETWORK
139
check_PROGRAMS += networkxml2argvtest
140
endif
141

142
check_PROGRAMS += nwfilterxml2xmltest
143

144
check_PROGRAMS += storagevolxml2xmltest storagepoolxml2xmltest
145

146
check_PROGRAMS += nodedevxml2xmltest
M
Mark McLoughlin 已提交
147

148
check_PROGRAMS += interfacexml2xmltest
149

150 151
check_PROGRAMS += cputest

152 153
test_scripts = \
	capabilityschematest \
154
	interfaceschematest \
155 156 157 158
	networkschematest \
	storagepoolschematest \
	storagevolschematest \
	domainschematest \
159
	nodedevschematest \
160 161
	nwfilterschematest \
	domainsnapshotschematest
162

A
Atsushi SAKAI 已提交
163
if WITH_LIBVIRTD
164 165 166 167 168 169
test_scripts +=				\
	test_conf.sh			\
	cpuset				\
	daemon-conf			\
	define-dev-segfault		\
	int-overflow			\
J
Jim Meyering 已提交
170 171
	libvirtd-fail			\
	libvirtd-pool			\
172 173 174 175 176 177
	read-bufsiz			\
	read-non-seekable		\
	start				\
	undefine			\
	vcpupin				\
	virsh-all			\
178
	virsh-optparse			\
179
	virsh-schedinfo			\
J
Jim Meyering 已提交
180
	virsh-synopsis
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
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 已提交
199
endif
200

J
Jamie Strandboge 已提交
201 202
if WITH_SECDRIVER_APPARMOR
test_scripts += virt-aa-helper-test
203 204
else
EXTRA_DIST += virt-aa-helper-test
J
Jamie Strandboge 已提交
205
endif
206

207 208
EXTRA_DIST += $(test_scripts)

209 210 211
TESTS = virshtest \
        nodeinfotest \
	qparamtest \
212
	virbuftest \
213
	sockettest \
214
	commandtest \
215
	seclabeltest \
216
	virhashtest \
217
	virnetmessagetest \
218
	virnetsockettest \
219
	virnettlscontexttest \
220
	virtimetest \
221
	shunloadtest \
M
Matthias Bolte 已提交
222
	utiltest \
223 224
	$(test_scripts)

225 226 227 228
if HAVE_YAJL
TESTS += jsontest
endif

229 230 231 232
if WITH_XEN
TESTS += xml2sexprtest \
	sexpr2xmltest \
	xmconfigtest \
233 234 235
	xencapstest \
	reconnect \
	statstest
236
endif
237

238
if WITH_QEMU
239 240
TESTS += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest qemuargv2xmltest \
	 qemuhelptest domainsnapshotxml2xmltest nwfilterxml2xmltest
241
endif
K
Karel Zak 已提交
242

243 244 245 246
if WITH_OPENVZ
TESTS += openvzutilstest
endif

247
if WITH_ESX
248 249 250 251 252
TESTS += esxutilstest
endif

if WITH_VMX
TESTS += vmx2xmltest xml2vmxtest
253 254
endif

255
if WITH_LIBVIRTD
256
check_PROGRAMS += eventtest
257 258 259
TESTS += eventtest
endif

260 261
TESTS += networkxml2xmltest

262
if WITH_NETWORK
263
TESTS += networkxml2argvtest
264
endif
265

266
TESTS += storagevolxml2xmltest storagepoolxml2xmltest
267

M
Mark McLoughlin 已提交
268 269
TESTS += nodedevxml2xmltest

270 271
TESTS += interfacexml2xmltest

272 273
TESTS += cputest

274
# NB, automake < 1.10 does not provide the real
275
# abs_top_{src/build}dir or builddir variables, so don't rely
276
# on them here. Fake them with 'pwd'
277 278 279 280 281 282
# 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

283
TESTS_ENVIRONMENT =				\
284
  abs_top_builddir=$(lv_abs_top_builddir)	\
J
Jim Meyering 已提交
285
  abs_top_srcdir=`cd '$(top_srcdir)'; pwd`	\
286
  abs_builddir=`pwd`				\
287
  abs_srcdir=`cd '$(srcdir)'; pwd`		\
288
  CONFIG_HEADER="`cd '$(top_builddir)'; pwd`/config.h"	\
J
Jim Meyering 已提交
289
  PATH="$(path_add)$(PATH_SEPARATOR)$$PATH"	\
290
  SHELL="$(SHELL)"				\
291
  LIBVIRT_DRIVER_DIR="$(abs_top_builddir)/src/.libs" \
292
  LC_ALL=C					\
293 294
  $(VG)

295
valgrind:
296
	$(MAKE) check VG="valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"
297

298 299 300 301 302
sockettest_SOURCES = \
	sockettest.c \
	testutils.c testutils.h
sockettest_LDADD = ../src/libvirt_util.la $(LDADDS)

303
if WITH_XEN
304
xml2sexprtest_SOURCES = \
305
	xml2sexprtest.c testutilsxen.c testutilsxen.h \
306
	testutils.c testutils.h
307
xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
308 309

sexpr2xmltest_SOURCES = \
310
	sexpr2xmltest.c testutilsxen.c testutilsxen.h \
311
	testutils.c testutils.h
312
sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
313

314
xmconfigtest_SOURCES = \
315
	xmconfigtest.c testutilsxen.c testutilsxen.h \
316
	testutils.c testutils.h
317
xmconfigtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
318

319 320 321 322 323
xencapstest_SOURCES = \
	xencapstest.c testutils.h testutils.c
xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)

reconnect_SOURCES = \
324
	reconnect.c testutils.h testutils.c
325 326
reconnect_LDADD = $(LDADDS)

327 328 329 330
statstest_SOURCES = \
	statstest.c testutils.h testutils.c
statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)

331 332 333 334 335 336
else
EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
	xencapstest.c reconnect.c \
	testutilsxen.c testutilsxen.h
endif

337
if WITH_QEMU
338 339 340 341 342 343 344

qemu_LDADDS = ../src/libvirt_driver_qemu.la

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

345
qemuxml2argvtest_SOURCES = \
346
	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
347
	testutils.c testutils.h
348
qemuxml2argvtest_LDADD = $(qemu_LDADDS)  $(LDADDS)
349 350

qemuxml2xmltest_SOURCES = \
351
	qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
352
	testutils.c testutils.h
353
qemuxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
354

P
Philipp Hahn 已提交
355 356 357 358 359
qemuxmlnstest_SOURCES = \
	qemuxmlnstest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
qemuxmlnstest_LDADD = $(qemu_LDADDS)  $(LDADDS)

360 361 362
qemuargv2xmltest_SOURCES = \
	qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
363
qemuargv2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
364 365

qemuhelptest_SOURCES = qemuhelptest.c testutils.c testutils.h
366
qemuhelptest_LDADD = $(qemu_LDADDS) $(LDADDS)
367 368 369 370 371

domainsnapshotxml2xmltest_SOURCES = \
	domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
372
else
373 374 375
EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
	qemuxmlnstest.c qemuhelptest.c domainsnapshotxml2xmltest.c \
	testutilsqemu.c testutilsqemu.h
376
endif
377

378 379 380 381 382 383 384 385 386 387
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

388 389 390 391 392
if WITH_ESX
esxutilstest_SOURCES = \
	esxutilstest.c \
	testutils.c testutils.h
esxutilstest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS)
393 394 395
else
EXTRA_DIST += esxutilstest.c
endif
396

397
if WITH_VMX
398 399 400
vmx2xmltest_SOURCES = \
	vmx2xmltest.c \
	testutils.c testutils.h
401
vmx2xmltest_LDADD = ../src/libvirt_vmx.la $(LDADDS)
402 403 404 405

xml2vmxtest_SOURCES = \
	xml2vmxtest.c \
	testutils.c testutils.h
406
xml2vmxtest_LDADD = ../src/libvirt_vmx.la $(LDADDS)
407
else
408
EXTRA_DIST += vmx2xmltest.c xml2vmxtest.c
409 410
endif

411 412 413 414 415
networkxml2xmltest_SOURCES = \
	networkxml2xmltest.c \
	testutils.c testutils.h
networkxml2xmltest_LDADD = $(LDADDS)

416
if WITH_NETWORK
417 418 419 420
networkxml2argvtest_SOURCES = \
	networkxml2argvtest.c \
	testutils.c testutils.h
networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
421 422 423
else
EXTRA_DIST += networkxml2argvtest.c
endif
424

425 426 427 428 429
nwfilterxml2xmltest_SOURCES = \
	nwfilterxml2xmltest.c \
	testutils.c testutils.h
nwfilterxml2xmltest_LDADD = $(LDADDS)

430 431 432 433 434
storagevolxml2xmltest_SOURCES = \
	storagevolxml2xmltest.c \
	testutils.c testutils.h
storagevolxml2xmltest_LDADD = $(LDADDS)

435 436 437 438 439
storagepoolxml2xmltest_SOURCES = \
	storagepoolxml2xmltest.c \
	testutils.c testutils.h
storagepoolxml2xmltest_LDADD = $(LDADDS)

M
Mark McLoughlin 已提交
440 441 442
nodedevxml2xmltest_SOURCES = \
	nodedevxml2xmltest.c \
	testutils.c testutils.h
443
nodedevxml2xmltest_LDADD = $(LDADDS)
M
Mark McLoughlin 已提交
444

445 446 447 448 449
interfacexml2xmltest_SOURCES = \
	interfacexml2xmltest.c \
	testutils.c testutils.h
interfacexml2xmltest_LDADD = $(LDADDS)

450 451 452 453 454
cputest_SOURCES = \
	cputest.c \
	testutils.c testutils.h
cputest_LDADD = $(LDADDS)

455 456 457 458 459
virshtest_SOURCES = \
	virshtest.c \
	testutils.c testutils.h
virshtest_LDADD = $(LDADDS)

D
Daniel Veillard 已提交
460 461 462 463
conftest_SOURCES = \
	conftest.c
conftest_LDADD = $(LDADDS)

464 465 466 467
nodeinfotest_SOURCES = \
	nodeinfotest.c testutils.h testutils.c
nodeinfotest_LDADD = $(LDADDS)

468 469
commandtest_SOURCES = \
	commandtest.c testutils.h testutils.c
E
Eric Blake 已提交
470
commandtest_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS)
471 472 473 474
commandtest_LDADD = $(LDADDS)

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

478 479
virnetmessagetest_SOURCES = \
	virnetmessagetest.c testutils.h testutils.c
E
Eric Blake 已提交
480
virnetmessagetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
481 482
virnetmessagetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

483 484
virnetsockettest_SOURCES = \
	virnetsockettest.c testutils.h testutils.c
E
Eric Blake 已提交
485
virnetsockettest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
486 487
virnetsockettest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

488
virnettlscontexttest_SOURCES = \
E
Eric Blake 已提交
489
	virnettlscontexttest.c testutils.h testutils.c
490
virnettlscontexttest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
E
Eric Blake 已提交
491 492 493 494 495 496 497
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
498

499 500 501 502 503
virtimetest_SOURCES = \
	virtimetest.c testutils.h testutils.c
virtimetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
virtimetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS)

504

505 506 507
seclabeltest_SOURCES = \
	seclabeltest.c
seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS)
J
Jamie Strandboge 已提交
508

509 510 511 512
qparamtest_SOURCES = \
	qparamtest.c testutils.h testutils.c
qparamtest_LDADD = $(LDADDS)

513 514 515 516
virbuftest_SOURCES = \
	virbuftest.c testutils.h testutils.c
virbuftest_LDADD = $(LDADDS)

517 518 519
virhashtest_SOURCES = \
	virhashtest.c virhashdata.h testutils.h testutils.c
virhashtest_LDADD = $(LDADDS)
520

521
jsontest_SOURCES = \
522
	jsontest.c testutils.h testutils.c
523 524
jsontest_LDADD = $(LDADDS)

M
Matthias Bolte 已提交
525 526 527 528
utiltest_SOURCES = \
	utiltest.c testutils.h testutils.c
utiltest_LDADD = $(LDADDS)

529 530
if WITH_LIBVIRTD
eventtest_SOURCES = \
531
	eventtest.c testutils.h testutils.c
532 533 534
eventtest_LDADD = -lrt $(LDADDS)
endif

535 536 537 538 539 540 541 542 543
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

544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
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

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