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

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

6 7
SHELL = $(PREFERABLY_POSIX_SHELL)

K
Karel Zak 已提交
8
INCLUDES = \
9
	-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
K
Karel Zak 已提交
10
	-I$(top_builddir)/include \
11
	-I$(top_srcdir)/include \
12
	-I$(top_srcdir)/src -I../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 33 34 35 36
PROBES_O =
if WITH_DTRACE
PROBES_O += ../src/probes.o
endif

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

52
EXTRA_DIST =		\
53
	capabilityschemadata \
E
Eric Blake 已提交
54 55 56 57
	capabilityschematest \
	commanddata \
	confdata \
	cputestdata \
58
	domainschemadata \
E
Eric Blake 已提交
59 60 61 62
	domainschematest \
	domainsnapshotschematest \
	domainsnapshotxml2xmlin \
	domainsnapshotxml2xmlout \
63
	interfaceschemadata \
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
check_PROGRAMS = virshtest conftest sockettest \
96
	nodeinfotest qparamtest virbuftest \
97
	commandtest commandhelper seclabeltest \
M
Matthias Bolte 已提交
98
	hashtest virnetmessagetest virnetsockettest ssh \
99 100 101
	utiltest virnettlscontexttest shunloadtest

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
	hashtest \
217
	virnetmessagetest \
218
	virnetsockettest \
219
	virnettlscontexttest \
220
	shunloadtest \
M
Matthias Bolte 已提交
221
	utiltest \
222 223
	$(test_scripts)

224 225 226 227
if HAVE_YAJL
TESTS += jsontest
endif

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

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

242 243 244 245
if WITH_OPENVZ
TESTS += openvzutilstest
endif

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

if WITH_VMX
TESTS += vmx2xmltest xml2vmxtest
252 253
endif

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

259 260
TESTS += networkxml2xmltest

261
if WITH_NETWORK
262
TESTS += networkxml2argvtest
263
endif
264

265
TESTS += storagevolxml2xmltest storagepoolxml2xmltest
266

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

269 270
TESTS += interfacexml2xmltest

271 272
TESTS += cputest

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

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

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

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

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

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

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

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

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

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

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

336
if WITH_QEMU
337 338 339 340 341 342 343

qemu_LDADDS = ../src/libvirt_driver_qemu.la

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

498

499 500 501
seclabeltest_SOURCES = \
	seclabeltest.c
seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS)
J
Jamie Strandboge 已提交
502

503 504 505 506
qparamtest_SOURCES = \
	qparamtest.c testutils.h testutils.c
qparamtest_LDADD = $(LDADDS)

507 508 509 510
virbuftest_SOURCES = \
	virbuftest.c testutils.h testutils.c
virbuftest_LDADD = $(LDADDS)

511 512 513 514
hashtest_SOURCES = \
	hashtest.c hashdata.h testutils.h testutils.c
hashtest_LDADD = $(LDADDS)

515
jsontest_SOURCES = \
516
	jsontest.c testutils.h testutils.c
517 518
jsontest_LDADD = $(LDADDS)

M
Matthias Bolte 已提交
519 520 521 522
utiltest_SOURCES = \
	utiltest.c testutils.h testutils.c
utiltest_LDADD = $(LDADDS)

523 524
if WITH_LIBVIRTD
eventtest_SOURCES = \
525
	eventtest.c testutils.h testutils.c
526 527 528
eventtest_LDADD = -lrt $(LDADDS)
endif

529 530 531 532 533 534 535 536 537
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

538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
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

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