summaryrefslogtreecommitdiffstats
path: root/test/Makefile.in
blob: 67a7c546b3195d6eb6a361b94af1270f20e00a40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#TEST_OPTS=--verbose --debug
SHELL_PATH ?= $(SHELL)
TAR ?= $(TAR)
RM ?= rm -f

subdir := $(shell pwd|sed 's,.*/,,')

srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
abs_srcdir = @abs_srcdir@
abs_builddir = @abs_builddir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@

# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))

T = $(wildcard $(srcdir)/t-*.sh)

ifeq ("@UDEV_SYNC@", "yes")
dm_udev_synchronisation = 1
endif

ifeq ("@APPLIB@", "yes")
T += $(srcdir)/lvm2app.sh
all: api/vgtest
api/vgtest:
	$(MAKE) -C api vgtest
endif

all: init.sh
	@echo Testing with locking_type 1
	#./bin/harness t-*.sh
	@echo Testing with locking_type 3
	LVM_TEST_LOCKING=3 ./bin/harness t-*.sh

bin/not: $(srcdir)/not.c .bin-dir-stamp
	$(CC) -o bin/not $<

bin/harness: $(srcdir)/harness.c .bin-dir-stamp
	$(CC) -o bin/harness $<

init.sh: $(srcdir)/Makefile.in $(srcdir)/test-utils.sh .bin-dir-stamp bin/not bin/harness $(T)
	rm -f $@-t $@
	echo 'top_srcdir=$(top_srcdir)' >> $@-t
	echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
	echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t
	echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t
	echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/liblvm:$(abs_top_builddir)/daemons/dmeventd"' >> $@-t
	echo 'abs_srcdir=$(abs_srcdir)' >> $@-t
	echo 'abs_builddir=$(abs_builddir)' >> $@-t
	echo 'export PATH' >> $@-t
	echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
	chmod a-w $@-t
	mv $@-t $@
	if test "$(srcdir)" != "."; then cp $(srcdir)/test-utils.sh \
	                                    $(srcdir)/test-lib.sh \
	                                    $(T) .; fi

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

.bin-dir-stamp: lvm-wrapper
	rm -rf bin
	mkdir bin
	for i in lvm $$(cat ../tools/.commands); do \
	  ln -s ../lvm-wrapper bin/$$i; \
	done
	ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
	ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" bin/clvmd
	touch $@

lvm-wrapper: Makefile
	rm -f $@-t $@
	echo '#!/bin/sh'                                          >  $@-t
	echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")'                   >> $@-t
	echo 'test "$$cmd" = lvm &&'                              >> $@-t
	echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"'         >> $@-t
	echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t
	chmod a-w,a+x $@-t
	mv $@-t $@

clean:
	rm -rf init.sh lvm-wrapper bin .bin-dir-stamp

distclean: clean
	rm -f Makefile

.PHONY: clean distclean
.NOTPARALLEL: