Makefile.am 13.4 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
	-I$(top_builddir) -I$(top_srcdir) \
10 11 12
	-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 \
13
	-I$(top_srcdir)/src/util \
14 15
	-I$(top_srcdir)/src/conf \
	$(GETTEXT_CPPFLAGS)
E
Eric Blake 已提交
16 17

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

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

32
PROBES_O =
33
if WITH_DTRACE_PROBES
34
PROBES_O += ../src/libvirt_probes.lo
35 36
endif

K
Karel Zak 已提交
37
LDADDS = \
38
        $(WARN_CFLAGS) \
39
	$(PROBES_O) \
40 41
	../src/libvirt.la \
	../gnulib/lib/libgnu.la
K
Karel Zak 已提交
42

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

87 88
test_helpers = commandhelper ssh conftest
test_programs = virshtest sockettest \
E
Eric Blake 已提交
89
	nodeinfotest virbuftest \
90 91
	commandtest seclabeltest \
	virhashtest virnetmessagetest virnetsockettest \
92
	utiltest virnettlscontexttest shunloadtest \
93 94
	virtimetest viruritest virkeyfiletest \
	virauthconfigtest
95

96 97 98 99
if WITH_DRIVER_MODULES
test_programs += virdrivermoduletest
endif

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

104
if WITH_XEN
105
test_programs += xml2sexprtest sexpr2xmltest \
106
	xmconfigtest xencapstest statstest reconnect
107
endif
108
if WITH_QEMU
109
test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \
110 111
	qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
	qemumonitortest
112 113
endif

114
if WITH_LXC
115
test_programs += lxcxml2xmltest
116 117
endif

118
if WITH_OPENVZ
119
test_programs += openvzutilstest
120 121
endif

122
if WITH_ESX
123
test_programs += esxutilstest
124 125 126
endif

if WITH_VMX
127
test_programs += vmx2xmltest xml2vmxtest
128 129
endif

130
if WITH_CIL
131
test_programs += object-locking
132 133
endif

134
if HAVE_YAJL
135
test_programs += jsontest
136 137
endif

138
test_programs += networkxml2xmltest
139

140
if WITH_NETWORK
141
test_programs += networkxml2argvtest
142
endif
143

144
test_programs += nwfilterxml2xmltest
145

146
test_programs += storagevolxml2xmltest storagepoolxml2xmltest
147

148
test_programs += nodedevxml2xmltest
M
Mark McLoughlin 已提交
149

150
test_programs += interfacexml2xmltest
151

152
test_programs += cputest
153

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

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

183 184 185
test_programs += 			\
	eventtest			\
	libvirtdconftest
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
else
EXTRA_DIST += 				\
	test_conf.sh			\
	cpuset				\
	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 已提交
203
endif
204

J
Jamie Strandboge 已提交
205 206
if WITH_SECDRIVER_APPARMOR
test_scripts += virt-aa-helper-test
207 208
else
EXTRA_DIST += virt-aa-helper-test
J
Jamie Strandboge 已提交
209
endif
210

211 212
EXTRA_DIST += $(test_scripts)

213 214 215 216 217 218
if WITH_TESTS
noinst_PROGRAMS = $(test_programs) $(test_helpers)
noinst_LTLIBRARIES = libshunload.la
else
check_PROGRAMS = $(test_programs) $(test_helpers)
check_LTLIBRARIES = libshunload.la
219
endif
220

221 222
TESTS = $(test_programs) \
	$(test_scripts)
223

224
# NB, automake < 1.10 does not provide the real
225
# abs_top_{src/build}dir or builddir variables, so don't rely
226
# on them here. Fake them with 'pwd'
227 228 229 230 231 232
# 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

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

245

246
valgrind:
247
	$(MAKE) check VG="libtool --mode=execute valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"
248

249 250 251
sockettest_SOURCES = \
	sockettest.c \
	testutils.c testutils.h
252
sockettest_LDADD = $(LDADDS)
253

254
if WITH_XEN
255 256 257
xen_LDADDS = ../src/libvirt_driver_xen.la
xen_LDADDS += $(LDADDS)

258
xml2sexprtest_SOURCES = \
259
	xml2sexprtest.c testutilsxen.c testutilsxen.h \
260
	testutils.c testutils.h
261
xml2sexprtest_LDADD = $(xen_LDADDS)
262 263

sexpr2xmltest_SOURCES = \
264
	sexpr2xmltest.c testutilsxen.c testutilsxen.h \
265
	testutils.c testutils.h
266
sexpr2xmltest_LDADD = $(xen_LDADDS)
267

268
xmconfigtest_SOURCES = \
269
	xmconfigtest.c testutilsxen.c testutilsxen.h \
270
	testutils.c testutils.h
271
xmconfigtest_LDADD = $(xen_LDADDS)
272

273 274
xencapstest_SOURCES = \
	xencapstest.c testutils.h testutils.c
275
xencapstest_LDADD = $(xen_LDADDS)
276 277

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

281 282
statstest_SOURCES = \
	statstest.c testutils.h testutils.c
283
statstest_LDADD = $(xen_LDADDS)
284

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

291
if WITH_QEMU
292 293 294 295 296

qemu_LDADDS = ../src/libvirt_driver_qemu.la
if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la
endif
297
if WITH_DTRACE_PROBES
298
qemu_LDADDS += ../src/libvirt_qemu_probes.lo
299
endif
300
qemu_LDADDS += $(LDADDS)
301

302
qemuxml2argvtest_SOURCES = \
303
	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
304
	testutils.c testutils.h
305
qemuxml2argvtest_LDADD = $(qemu_LDADDS)
306 307

qemuxml2xmltest_SOURCES = \
308
	qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
309
	testutils.c testutils.h
310
qemuxml2xmltest_LDADD = $(qemu_LDADDS)
311

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

317 318 319
qemuargv2xmltest_SOURCES = \
	qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \
	testutils.c testutils.h
320
qemuargv2xmltest_LDADD = $(qemu_LDADDS)
321 322

qemuhelptest_SOURCES = qemuhelptest.c testutils.c testutils.h
323
qemuhelptest_LDADD = $(qemu_LDADDS)
324

325
qemumonitortest_SOURCES = qemumonitortest.c testutils.c testutils.h
326
qemumonitortest_LDADD = $(qemu_LDADDS)
327

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

338 339 340
if WITH_LXC

lxc_LDADDS = ../src/libvirt_driver_lxc.la
341 342 343 344
if WITH_NETWORK
lxc_LDADDS += ../src/libvirt_driver_network.la
endif
lxc_LDADDS += $(LDADDS)
345 346 347 348

lxcxml2xmltest_SOURCES = \
	lxcxml2xmltest.c testutilslxc.c testutilslxc.h \
	testutils.c testutils.h
349
lxcxml2xmltest_LDADD = $(lxc_LDADDS)
350 351 352 353
else
EXTRA_DIST += lxcxml2xmltest.c testutilslxc.c testutilslxc.h
endif

354 355 356 357
if WITH_OPENVZ
openvzutilstest_SOURCES = \
	openvzutilstest.c \
	testutils.c testutils.h
358
openvzutilstest_LDADD = $(LDADDS)
359 360 361 362 363
else
EXTRA_DIST += openvzutilstest.c
endif
EXTRA_DIST += openvzutilstest.conf

364 365 366 367
if WITH_ESX
esxutilstest_SOURCES = \
	esxutilstest.c \
	testutils.c testutils.h
368
esxutilstest_LDADD = $(LDADDS)
369 370 371
else
EXTRA_DIST += esxutilstest.c
endif
372

373
if WITH_VMX
374 375 376
vmx2xmltest_SOURCES = \
	vmx2xmltest.c \
	testutils.c testutils.h
377
vmx2xmltest_LDADD = $(LDADDS)
378 379 380 381

xml2vmxtest_SOURCES = \
	xml2vmxtest.c \
	testutils.c testutils.h
382
xml2vmxtest_LDADD = $(LDADDS)
383
else
384
EXTRA_DIST += vmx2xmltest.c xml2vmxtest.c
385 386
endif

387 388 389 390 391
networkxml2xmltest_SOURCES = \
	networkxml2xmltest.c \
	testutils.c testutils.h
networkxml2xmltest_LDADD = $(LDADDS)

392
if WITH_NETWORK
393 394 395 396
networkxml2argvtest_SOURCES = \
	networkxml2argvtest.c \
	testutils.c testutils.h
networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
397 398 399
else
EXTRA_DIST += networkxml2argvtest.c
endif
400

401 402 403 404 405
nwfilterxml2xmltest_SOURCES = \
	nwfilterxml2xmltest.c \
	testutils.c testutils.h
nwfilterxml2xmltest_LDADD = $(LDADDS)

406 407 408 409 410
storagevolxml2xmltest_SOURCES = \
	storagevolxml2xmltest.c \
	testutils.c testutils.h
storagevolxml2xmltest_LDADD = $(LDADDS)

411 412 413 414 415
storagepoolxml2xmltest_SOURCES = \
	storagepoolxml2xmltest.c \
	testutils.c testutils.h
storagepoolxml2xmltest_LDADD = $(LDADDS)

M
Mark McLoughlin 已提交
416 417 418
nodedevxml2xmltest_SOURCES = \
	nodedevxml2xmltest.c \
	testutils.c testutils.h
419
nodedevxml2xmltest_LDADD = $(LDADDS)
M
Mark McLoughlin 已提交
420

421 422 423 424 425
interfacexml2xmltest_SOURCES = \
	interfacexml2xmltest.c \
	testutils.c testutils.h
interfacexml2xmltest_LDADD = $(LDADDS)

426 427 428 429 430
cputest_SOURCES = \
	cputest.c \
	testutils.c testutils.h
cputest_LDADD = $(LDADDS)

431 432 433 434 435
virshtest_SOURCES = \
	virshtest.c \
	testutils.c testutils.h
virshtest_LDADD = $(LDADDS)

D
Daniel Veillard 已提交
436 437 438 439
conftest_SOURCES = \
	conftest.c
conftest_LDADD = $(LDADDS)

440 441 442 443
nodeinfotest_SOURCES = \
	nodeinfotest.c testutils.h testutils.c
nodeinfotest_LDADD = $(LDADDS)

444 445
commandtest_SOURCES = \
	commandtest.c testutils.h testutils.c
E
Eric Blake 已提交
446
commandtest_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS)
447 448 449 450
commandtest_LDADD = $(LDADDS)

commandhelper_SOURCES = \
	commandhelper.c
E
Eric Blake 已提交
451
commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS)
452
commandhelper_LDADD = $(LDADDS)
453
commandhelper_LDFLAGS = -static
454

455 456 457 458 459 460 461 462 463 464
if WITH_LIBVIRTD
libvirtdconftest_SOURCES = \
	libvirtdconftest.c testutils.h testutils.c \
	../daemon/libvirtd-config.c
libvirtdconftest_CFLAGS = $(AM_CFLAGS)
libvirtdconftest_LDADD = $(LDADDS)
else
EXTRA_DIST += libvirtdconftest.c
endif

465 466
virnetmessagetest_SOURCES = \
	virnetmessagetest.c testutils.h testutils.c
E
Eric Blake 已提交
467 468
virnetmessagetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" \
		$(XDR_CFLAGS) $(AM_CFLAGS)
469
virnetmessagetest_LDADD = $(LDADDS)
470

471 472
virnetsockettest_SOURCES = \
	virnetsockettest.c testutils.h testutils.c
E
Eric Blake 已提交
473
virnetsockettest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
474
virnetsockettest_LDADD = $(LDADDS)
475

476
virnettlscontexttest_SOURCES = \
E
Eric Blake 已提交
477
	virnettlscontexttest.c testutils.h testutils.c
478
virnettlscontexttest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
479
virnettlscontexttest_LDADD = $(LDADDS)
E
Eric Blake 已提交
480 481 482 483 484 485
if HAVE_LIBTASN1
virnettlscontexttest_SOURCES += pkix_asn1_tab.c
virnettlscontexttest_LDADD += -ltasn1
else
EXTRA_DIST += pkix_asn1_tab.c
endif
486

487 488 489
virtimetest_SOURCES = \
	virtimetest.c testutils.h testutils.c
virtimetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
490
virtimetest_LDADD = $(LDADDS)
491

492 493 494
viruritest_SOURCES = \
	viruritest.c testutils.h testutils.c
viruritest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
495
viruritest_LDADD = $(LDADDS)
496

497 498 499
virkeyfiletest_SOURCES = \
	virkeyfiletest.c testutils.h testutils.c
virkeyfiletest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
500
virkeyfiletest_LDADD = $(LDADDS)
501

502 503 504
virauthconfigtest_SOURCES = \
	virauthconfigtest.c testutils.h testutils.c
virauthconfigtest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
505
virauthconfigtest_LDADD = $(LDADDS)
506

507 508
seclabeltest_SOURCES = \
	seclabeltest.c
509
seclabeltest_LDADD = $(LDADDS)
J
Jamie Strandboge 已提交
510

511 512 513 514
virbuftest_SOURCES = \
	virbuftest.c testutils.h testutils.c
virbuftest_LDADD = $(LDADDS)

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

519
jsontest_SOURCES = \
520
	jsontest.c testutils.h testutils.c
521 522
jsontest_LDADD = $(LDADDS)

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

527 528 529 530 531 532 533
if WITH_DRIVER_MODULES
virdrivermoduletest_SOURCES = \
	virdrivermoduletest.c testutils.h testutils.c
virdrivermoduletest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS)
virdrivermoduletest_LDADD = $(LDADDS)
endif

534 535
if WITH_LIBVIRTD
eventtest_SOURCES = \
536
	eventtest.c testutils.h testutils.c
537 538 539
eventtest_LDADD = -lrt $(LDADDS)
endif

540 541 542 543 544 545
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
546
shunloadtest_LDADD = $(LIB_PTHREAD)
547 548
shunloadtest_DEPENDENCIES = libshunload.la

549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
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

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