2010-04-09 21:42:48 +00:00
# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
2007-09-18 14:02:22 +00: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 14:00:42 +00:00
#TEST_OPTS=--verbose --debug
SHELL_PATH ?= $( SHELL)
TAR ?= $( TAR)
RM ?= rm -f
subdir := $( shell pwd| sed 's,.*/,,' )
2007-09-18 14:02:22 +00:00
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
abs_srcdir = @abs_srcdir@
2007-10-09 13:13:06 +00:00
abs_builddir = @abs_builddir@
2007-09-18 14:02:22 +00:00
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
2011-01-13 14:58:59 +00:00
i n c l u d e $( top_builddir ) / m a k e . t m p l
2007-09-18 14:00:42 +00:00
2010-04-13 06:45:53 +00:00
T ?= .
2010-10-12 16:17:25 +00:00
S ?= @ # never match anything by default
2010-10-14 14:36:26 +00:00
VERBOSE ?= 0
2010-12-12 20:36:38 +00:00
RUN = $( shell find $( srcdir) -regextype posix-egrep \( -name t-\* .sh -or -path */api/\* .sh \) -and -regex " $( srcdir) /.*( $( T) ).* " -and -not -regex " $( srcdir) /.*( $( S) ).* " | sort)
2010-12-14 17:38:42 +00:00
RUN_BASE = $( shell echo $( RUN) | xargs -n 1 echo | sed -e s,^$( srcdir) /,,)
2010-04-13 06:45:53 +00:00
2009-11-30 14:59:26 +00:00
# Shell quote;
SHELL_PATH_SQ = $( subst ',' \' ' ,$( SHELL_PATH) )
2010-01-11 15:48:49 +00:00
i f e q ( "@UDEV_SYNC@" , "yes" )
2010-02-15 16:30:13 +00:00
dm_udev_synchronisation = 1
2010-01-11 15:48:49 +00:00
e n d i f
2011-01-05 00:16:18 +00:00
all check : .tests -stamp
2010-12-12 21:08:00 +00:00
make -C api tests
2010-03-18 09:19:30 +00:00
@echo Testing with locking_type 1
2011-01-05 00:16:18 +00:00
VERBOSE = $( VERBOSE) ./lib/harness $( RUN_BASE)
2010-03-18 09:19:30 +00:00
@echo Testing with locking_type 3
2011-01-05 00:16:18 +00:00
VERBOSE = $( VERBOSE) LVM_TEST_LOCKING = 3 ./lib/harness $( RUN_BASE)
2008-09-29 16:07:02 +00:00
2011-01-05 00:16:18 +00:00
check_cluster : .tests -stamp
2010-12-12 21:08:00 +00:00
make -C api tests
2010-04-13 13:28:52 +00:00
@echo Testing with locking_type 3
2011-01-05 00:16:18 +00:00
VERBOSE = $( VERBOSE) LVM_TEST_LOCKING = 3 ./lib/harness $( RUN_BASE)
2010-04-13 13:28:52 +00:00
2011-01-05 00:16:18 +00:00
check_local : .tests -stamp
2010-12-12 21:08:00 +00:00
make -C api tests
2010-04-13 13:28:52 +00:00
@echo Testing with locking_type 1
2011-01-05 00:16:18 +00:00
VERBOSE = $( VERBOSE) LVM_TEST_LOCKING = 1 ./lib/harness $( RUN_BASE)
2010-04-13 13:28:52 +00:00
2011-01-05 00:16:18 +00:00
lib/should : lib /not
ln -sf not lib/should
2009-01-12 18:45:44 +00:00
2011-01-05 00:16:18 +00:00
lib/% : $( srcdir ) /lib /%.c .lib -dir -stamp
2011-01-13 14:58:59 +00:00
$( CC) $( DEFS) $( CFLAGS) -o $@ $<
2009-02-12 19:54:45 +00:00
2011-01-05 00:16:18 +00:00
lib/% : $( srcdir ) /lib /%.sh .lib -dir -stamp
cp $< $@
chmod +x $@
2010-04-12 19:02:59 +00:00
2011-01-05 00:16:18 +00:00
lib/paths : $( srcdir ) /Makefile .in .lib -dir -stamp
rm -f $@ -t
2007-09-18 14:00:42 +00:00
echo 'top_srcdir=$(top_srcdir)' >> $@ -t
echo 'abs_top_builddir=$(abs_top_builddir)' >> $@ -t
echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@ -t
echo 'abs_srcdir=$(abs_srcdir)' >> $@ -t
2007-10-09 13:13:06 +00:00
echo 'abs_builddir=$(abs_builddir)' >> $@ -t
2010-02-15 16:30:13 +00:00
echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@ -t
2007-09-18 14:00:42 +00:00
mv $@ -t $@
2011-01-05 00:16:18 +00:00
LIB = lib/not lib/should lib/harness \
lib/check lib/aux lib/test lib/utils lib/get lib/lvm-wrapper \
lib/paths
.tests-stamp : $( RUN ) $( LIB )
2010-12-12 20:36:38 +00:00
@if test " $( srcdir) " != . ; then \
echo "Copying tests to builddir." ; \
2010-12-14 23:23:45 +00:00
for f in $( RUN) ; do cp $$ f ` echo $$ f | sed -e s,^$( srcdir) /,,` ; done ; \
2010-12-12 20:36:38 +00:00
fi
2011-01-05 00:16:18 +00:00
touch .tests-stamp
2009-09-04 12:54:23 +00:00
2007-09-18 14:00:42 +00:00
Makefile : $( srcdir ) /Makefile .in $( top_builddir ) /config .status
cd $( top_builddir) && $( SHELL) ./config.status $( subdir) /$@
2011-01-05 00:16:18 +00:00
.lib-dir-stamp :
mkdir -p lib
2009-11-02 15:16:21 +00:00
for i in lvm $$ ( cat ../tools/.commands) ; do \
2011-01-05 00:16:18 +00:00
ln -fs lvm-wrapper lib/$$ i; \
2007-09-18 14:00:42 +00:00
done
2011-01-05 00:16:18 +00:00
ln -s " $( abs_top_builddir) /tools/dmsetup " lib/dmsetup
ln -s " $( abs_top_builddir) /daemons/clvmd/clvmd " lib/clvmd
ln -s " $( abs_top_builddir) /daemons/dmeventd/dmeventd " lib/dmeventd
2007-09-18 14:00:42 +00:00
touch $@
clean :
2011-01-07 12:26:02 +00:00
for i in lvm $$ ( cat ../tools/.commands) ; do rm -f lib/$$ i; done
2010-12-12 20:36:38 +00:00
if test " $( srcdir) " != . ; then rm -f $( subst $( srcdir) /, ,$( RUN) ) lvm2app.sh ; fi
2007-09-18 14:00:42 +00:00
2011-01-17 15:18:10 +00:00
CLEAN_TARGETS += .lib-dir-stamp .test-stamp $( LIB) lib/dmsetup lib/clvmd lib/dmeventd
2008-06-27 19:24:17 +00:00
2007-09-18 14:00:42 +00:00
.NOTPARALLEL :