2010-04-10 01:42:48 +04:00
# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
2007-09-18 18:02:22 +04:00
#
# 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
2007-09-18 18:00:42 +04:00
#TEST_OPTS=--verbose --debug
SHELL_PATH ?= $( SHELL)
TAR ?= $( TAR)
RM ?= rm -f
subdir := $( shell pwd| sed 's,.*/,,' )
2007-09-18 18:02:22 +04:00
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
abs_srcdir = @abs_srcdir@
2007-10-09 17:13:06 +04:00
abs_builddir = @abs_builddir@
2007-09-18 18:02:22 +04:00
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
2007-09-18 18:00:42 +04:00
2010-04-13 10:45:53 +04:00
T ?= .
RUN = $( shell find -regextype posix-egrep -name t-\* .sh -and -regex " .*( $( T) ).* " )
2009-11-30 17:59:26 +03:00
# Shell quote;
SHELL_PATH_SQ = $( subst ',' \' ' ,$( SHELL_PATH) )
2010-03-29 18:17:59 +04:00
SCRIPTS := $( wildcard $( srcdir) /t-*.sh) \
$( srcdir) /test-utils.sh \
2010-04-07 18:46:26 +04:00
$( srcdir) /lvm-utils.sh
2009-11-30 17:59:26 +03:00
2010-01-11 18:48:49 +03:00
i f e q ( "@UDEV_SYNC@" , "yes" )
2010-02-15 19:30:13 +03:00
dm_udev_synchronisation = 1
2010-01-11 18:48:49 +03:00
e n d i f
2009-11-30 17:59:26 +03:00
i f e q ( "@APPLIB@" , "yes" )
2010-03-29 18:17:59 +04:00
SCRIPTS += $( srcdir) /lvm2app.sh
2009-11-30 17:59:26 +03:00
all : api /vgtest
api/vgtest :
$( MAKE) -C api vgtest
e n d i f
2010-04-13 17:28:52 +04:00
all check : init .sh
2010-03-18 12:19:30 +03:00
@echo Testing with locking_type 1
2010-04-13 10:45:53 +04:00
./bin/harness $( RUN)
2010-03-18 12:19:30 +03:00
@echo Testing with locking_type 3
2010-04-13 10:45:53 +04:00
LVM_TEST_LOCKING = 3 ./bin/harness $( RUN)
2008-09-29 20:07:02 +04:00
2010-04-13 17:28:52 +04:00
check_cluster : init .sh
@echo Testing with locking_type 3
LVM_TEST_LOCKING = 3 ./bin/harness $( RUN)
check_local : init .sh
@echo Testing with locking_type 1
LVM_TEST_LOCKING = 1 ./bin/harness $( RUN)
2009-11-02 18:16:21 +03:00
bin/not : $( srcdir ) /not .c .bin -dir -stamp
$( CC) -o bin/not $<
2010-04-30 18:33:39 +04:00
ln -sf not bin/should
2009-01-12 21:45:44 +03:00
2009-11-02 18:16:21 +03:00
bin/harness : $( srcdir ) /harness .c .bin -dir -stamp
$( CC) -o bin/harness $<
2009-02-12 22:54:45 +03:00
2010-04-12 23:02:59 +04:00
bin/check : $( srcdir ) /check .sh .bin -dir -stamp
cp $< bin/check
chmod +x bin/check
init.sh : $( srcdir ) /Makefile .in .bin -dir -stamp bin /not bin /check bin /harness $( SCRIPTS )
2007-09-18 18:00:42 +04:00
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
2010-03-29 18:19:42 +04:00
echo 'PATH=$$abs_top_builddir/test/bin:$$PATH' >> $@ -t
LDLPATH = " \$ $abs_top_builddir /libdm " ; \
2010-05-06 22:54:51 +04:00
LDLPATH = " $$ LDLPATH:\$ $abs_top_builddir /tools " ; \
2010-03-29 18:19:42 +04:00
LDLPATH = " $$ LDLPATH:\$ $abs_top_builddir /daemons/dmeventd " ; \
2010-05-06 22:54:51 +04:00
LDLPATH = " $$ LDLPATH:\$ $abs_top_builddir /daemons/dmeventd/plugins/lvm2 " ; \
LDLPATH = " $$ LDLPATH:\$ $abs_top_builddir /daemons/dmeventd/plugins/mirror " ; \
LDLPATH = " $$ LDLPATH:\$ $abs_top_builddir /daemons/dmeventd/plugins/snapshot " ; \
2010-03-29 18:19:42 +04:00
echo " export LD_LIBRARY_PATH=\" $$ LDLPATH\" " >> $@ -t
2007-09-18 18:00:42 +04:00
echo 'abs_srcdir=$(abs_srcdir)' >> $@ -t
2007-10-09 17:13:06 +04:00
echo 'abs_builddir=$(abs_builddir)' >> $@ -t
2007-09-18 18:00:42 +04:00
echo 'export PATH' >> $@ -t
2010-02-15 19:30:13 +03:00
echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@ -t
2007-09-18 18:00:42 +04:00
chmod a-w $@ -t
mv $@ -t $@
2010-04-13 10:45:53 +04:00
@if test " $( srcdir) " != . ; then echo "Copying tests to builddir." ; cp $( SCRIPTS) . ; fi
2009-09-04 16:54:23 +04:00
2007-09-18 18:00:42 +04:00
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
2009-11-02 18:16:21 +03:00
for i in lvm $$ ( cat ../tools/.commands) ; do \
2007-09-18 18:00:42 +04:00
ln -s ../lvm-wrapper bin/$$ i; \
done
2008-11-04 17:37:10 +03:00
ln -s " $( abs_top_builddir) /tools/dmsetup " bin/dmsetup
2010-03-18 12:19:30 +03:00
ln -s " $( abs_top_builddir) /daemons/clvmd/clvmd " bin/clvmd
2010-05-06 22:54:51 +04:00
ln -s " $( abs_top_builddir) /daemons/dmeventd/dmeventd " bin/dmeventd
2007-09-18 18:00:42 +04:00
touch $@
lvm-wrapper : Makefile
rm -f $@ -t $@
2007-09-18 18:02:22 +04:00
echo '#!/bin/sh' > $@ -t
echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")' >> $@ -t
echo 'test "$$cmd" = lvm &&' >> $@ -t
echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"' >> $@ -t
2007-09-18 18:00:42 +04:00
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
2010-03-29 19:53:11 +04:00
if test " $( srcdir) " != . ; then rm -f $( subst $( srcdir) /, ,$( SCRIPTS) ) lvm2app.sh ; fi
2007-09-18 18:00:42 +04:00
2008-06-27 23:24:17 +04:00
distclean : clean
2009-03-16 21:28:04 +03:00
rm -f Makefile
2008-06-27 23:24:17 +04:00
2007-09-18 18:00:42 +04:00
.NOTPARALLEL :