Home | History | Annotate | Line # | Download | only in test
      1 # Copyright (C) 2007 Red Hat, Inc. All rights reserved.
      2 #
      3 # This file is part of LVM2.
      4 #
      5 # This copyrighted material is made available to anyone wishing to use,
      6 # modify, copy, or redistribute it subject to the terms and conditions
      7 # of the GNU General Public License v.2.
      8 #
      9 # You should have received a copy of the GNU General Public License
     10 # along with this program; if not, write to the Free Software Foundation,
     11 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     12 
     13 #TEST_OPTS=--verbose --debug
     14 SHELL_PATH ?= $(SHELL)
     15 TAR ?= $(TAR)
     16 RM ?= rm -f
     17 
     18 subdir := $(shell pwd|sed 's,.*/,,')
     19 
     20 srcdir = .
     21 top_srcdir = ..
     22 top_builddir = ..
     23 abs_srcdir = /home/haad/src/LVM2.2.02.56/test
     24 abs_builddir = /home/haad/src/LVM2.2.02.56/test
     25 abs_top_builddir = /home/haad/src/LVM2.2.02.56
     26 abs_top_srcdir = /home/haad/src/LVM2.2.02.56
     27 
     28 all: init.sh
     29 	./bin/harness t-*.sh
     30 
     31 bin/not: $(srcdir)/not.c .bin-dir-stamp
     32 	$(CC) -o bin/not $<
     33 
     34 bin/harness: $(srcdir)/harness.c .bin-dir-stamp
     35 	$(CC) -o bin/harness $<
     36 
     37 init.sh: $(srcdir)/Makefile.in $(srcdir)/test-utils.sh .bin-dir-stamp bin/not bin/harness $(T)
     38 	rm -f $@-t $@
     39 	echo 'top_srcdir=$(top_srcdir)' >> $@-t
     40 	echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
     41 	echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t
     42 	echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t
     43 	echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/liblvm:$(abs_top_builddir)/daemons/dmeventd"' >> $@-t
     44 	echo 'abs_srcdir=$(abs_srcdir)' >> $@-t
     45 	echo 'abs_builddir=$(abs_builddir)' >> $@-t
     46 	echo 'export PATH' >> $@-t
     47 	chmod a-w $@-t
     48 	mv $@-t $@
     49 	-cp $(srcdir)/test-utils.sh .
     50 	-cp $(srcdir)/test-lib.sh .
     51 	-cp $(T) .
     52 
     53 # Shell quote;
     54 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
     55 
     56 T = $(wildcard $(srcdir)/t-*.sh)
     57 
     58 ifeq ("no", "yes")
     59 T += lvm2app.sh
     60 all: api/vgtest
     61 api/vgtest:
     62 	$(MAKE) -C api vgtest
     63 endif
     64 
     65 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     66 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
     67 
     68 #$(T): init.sh
     69 #	./bin/harness $@
     70 
     71 .bin-dir-stamp: lvm-wrapper
     72 	rm -rf bin
     73 	mkdir bin
     74 	for i in lvm $$(cat ../tools/.commands); do \
     75 	  ln -s ../lvm-wrapper bin/$$i; \
     76 	done
     77 	ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
     78 	touch $@
     79 
     80 lvm-wrapper: Makefile
     81 	rm -f $@-t $@
     82 	echo '#!/bin/sh'                                          >  $@-t
     83 	echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")'                   >> $@-t
     84 	echo 'test "$$cmd" = lvm &&'                              >> $@-t
     85 	echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"'         >> $@-t
     86 	echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t
     87 	chmod a-w,a+x $@-t
     88 	mv $@-t $@
     89 
     90 clean:
     91 	rm -rf init.sh lvm-wrapper bin .bin-dir-stamp
     92 
     93 distclean: clean
     94 	rm -f Makefile
     95 
     96 .PHONY: $(T) clean distclean
     97 .NOTPARALLEL:
     98