[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH]: Added installcheck target in Makefiles



This patch adds installcheck* targets to be able to run test-suite against installed LVM2.

-- Marian
Index: Makefile.in
===================================================================
RCS file: /cvs/lvm2/LVM2/Makefile.in,v
retrieving revision 1.52
diff -a -u -r1.52 Makefile.in
--- Makefile.in	13 Apr 2010 13:28:52 -0000	1.52
+++ Makefile.in	21 May 2010 13:34:58 -0000
@@ -75,9 +75,14 @@
 endif
 DISTCLEAN_TARGETS += cscope.out
 
+.PHONY: check check_cluster check_local installcheck installcheck_cluster installcheck_local
+
 check check_cluster check_local: all
 	$(MAKE) -C test $(@)
 
+installcheck installcheck_cluster installcheck_local:
+	$(MAKE) -C test $(@)
+	
 LCOV_TRACES = libdm.info lib.info tools.info \
 	daemons/dmeventd.info daemons/clvmd.info
 CLEAN_TARGETS += $(LCOV_TRACES)
Index: test/Makefile.in
===================================================================
RCS file: /cvs/lvm2/LVM2/test/Makefile.in,v
retrieving revision 1.42
diff -a -u -r1.42 Makefile.in
--- test/Makefile.in	12 May 2010 11:59:46 -0000	1.42
+++ test/Makefile.in	21 May 2010 13:34:59 -0000
@@ -46,47 +46,63 @@
 	$(MAKE) -C api vgtest
 endif
 
-all check: init.sh
-	@echo Testing with locking_type 1
-	./bin/harness $(RUN)
-	@echo Testing with locking_type 3
-	LVM_TEST_LOCKING=3 ./bin/harness $(RUN)
+.PHONY: all \
+  check check_cluster check_local \
+  installcheck installcheck_cluster installcheck_local \
+  clean distclean
 
-check_cluster: init.sh
+all check: check_local check_cluster
+
+check_cluster: init.sh .bin-dir-stamp
 	@echo Testing with locking_type 3
-	LVM_TEST_LOCKING=3 ./bin/harness $(RUN)
+	INSTALLCHECK= LVM_TEST_LOCKING=3 ./bin/harness $(RUN)
 
-check_local: init.sh
+check_local: init.sh .bin-dir-stamp
 	@echo Testing with locking_type 1
-	LVM_TEST_LOCKING=1 ./bin/harness $(RUN)
+	INSTALLCHECK= LVM_TEST_LOCKING=1 ./bin/harness $(RUN)
+
+installcheck: installcheck_local installcheck_cluster
+
+installcheck_cluster: init.sh
+	@echo Testing installation with locking_type 3
+	INSTALLCHECK=1 LVM_TEST_LOCKING=3 ./bin/harness $(RUN)
+
+installcheck_local: init.sh
+	@echo Testing installation with locking_type 1
+	INSTALLCHECK=1 LVM_TEST_LOCKING=1 ./bin/harness $(RUN)
+
+bin:
+	mkdir bin
 
-bin/not: $(srcdir)/not.c .bin-dir-stamp
-	$(CC) -o bin/not $<
+bin/not: $(srcdir)/not.c Makefile bin
+	$(CC) -o $@ $<
 	ln -sf not bin/should
 
-bin/harness: $(srcdir)/harness.c .bin-dir-stamp
-	$(CC) -o bin/harness $<
+bin/harness: $(srcdir)/harness.c Makefile bin
+	$(CC) -o $@ $<
 
-bin/check: $(srcdir)/check.sh .bin-dir-stamp
-	cp $< bin/check
-	chmod +x bin/check
+bin/check: $(srcdir)/check.sh Makefile bin
+	cp $< $@
+	chmod +x $@
 
-init.sh: $(srcdir)/Makefile.in .bin-dir-stamp bin/not bin/check bin/harness $(SCRIPTS)
+init.sh: Makefile bin/not bin/check bin/harness $(SCRIPTS)
 	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 'abs_srcdir=$(abs_srcdir)' >> $ -t
+	echo 'abs_builddir=$(abs_builddir)' >> $ -t
 	echo 'PATH=$$abs_top_builddir/test/bin:$$PATH' >> $ -t
+	echo 'if test -z "$$INSTALLCHECK"; then' >> $ -t
+	echo '  PATH=$$abs_top_builddir/test/sbin:$$PATH' >> $ -t
 	LDLPATH="\$$abs_top_builddir/libdm"; \
 	LDLPATH="$$LDLPATH:\$$abs_top_builddir/tools"; \
 	LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd"; \
 	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"; \
-	echo "export LD_LIBRARY_PATH=\"$$LDLPATH\"" >> $ -t
-	echo 'top_srcdir=$(top_srcdir)' >> $ -t
-	echo 'abs_srcdir=$(abs_srcdir)' >> $ -t
-	echo 'abs_builddir=$(abs_builddir)' >> $ -t
+	echo "  export LD_LIBRARY_PATH=\"$$LDLPATH\"" >> $ -t
+	echo 'fi' >> $ -t
 	echo 'export PATH' >> $ -t
 	echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $ -t
 	chmod a-w $ -t
@@ -95,16 +111,18 @@
 
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+	echo 'Makefile rebuilt! Run again....' >&2
+	exit 1
 
 .bin-dir-stamp: lvm-wrapper
-	rm -rf bin
-	mkdir bin
+	rm -rf sbin
+	mkdir sbin
 	for i in lvm $$(cat ../tools/.commands); do \
-	  ln -s ../lvm-wrapper bin/$$i; \
+	  ln -s ../lvm-wrapper sbin/$$i; \
 	done
-	ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
-	ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" bin/clvmd
-	ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" bin/dmeventd
+	ln -s "$(abs_top_builddir)/tools/dmsetup" sbin/dmsetup
+	ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" sbin/clvmd
+	ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" sbin/dmeventd
 	touch $@
 
 lvm-wrapper: Makefile
@@ -118,7 +136,7 @@
 	mv $ -t $@
 
 clean:
-	rm -rf init.sh lvm-wrapper bin .bin-dir-stamp
+	rm -rf init.sh lvm-wrapper bin sbin .bin-dir-stamp
 	if test "$(srcdir)" != . ; then rm -f $(subst $(srcdir)/, ,$(SCRIPTS)) lvm2app.sh ; fi
 
 distclean: clean
Index: test/t-000-basic.sh
===================================================================
RCS file: /cvs/lvm2/LVM2/test/t-000-basic.sh,v
retrieving revision 1.9
diff -a -u -r1.9 t-000-basic.sh
--- test/t-000-basic.sh	20 Apr 2010 15:19:36 -0000	1.9
+++ test/t-000-basic.sh	21 May 2010 13:34:59 -0000
@@ -18,7 +18,11 @@
 lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual
 
 # ensure they are the same
-diff -u actual expected
+if test -z "$INSTALLCHECK"; then
+  diff -u actual expected
+else
+  should diff -u actual expected
+fi
 
 mknod $DM_DEV_DIR/null c 1 3 ||
   error "Can't create nodes on filesystem"

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]