Skip to contentSkip to conversation

: Added installcheck target in Makefiles

PATCH New Marian Csontos 2 participants 2 messages May 21, 2010 – May 24, 2010

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 : Added installcheck target in Makefiles

Hi,

a couple of issues, see comments inline.

Quoted 11 lines
Makefile.in +2 -0
@@ -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 $(@)
 

[snip]

Quoted 5 lines
Makefile.in +0 -0
@@ -46,47 +46,63 @@
 	$(MAKE) -C api vgtest
 endif

Makefile.in line 52

Quoted 10 lines
Makefile.in +4 -5
 
-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

The .PHONY additions should be a separate patch, arguably. Not directly related installcheck?

Quoted 13 lines
Makefile.in +6 -4
-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)

Makefile.in line 71

Quoted 10 lines
Makefile.in +10 -0
+
+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)

Since this is leaked into global environment, the name should start with LVM_TEST_ like with other envvars that control the testsuite (probably LVM_TEST_INSTALLED?). Another option is to use a different mechanism.

Quoted 10 lines
Makefile.in +4 -3
+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

Makefile.in line 84

Quoted 10 lines
Makefile.in +5 -4
-	$(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 $@

Why are those changes in this patch? Same as with PHONY above.

Makefile.in line 94

Quoted 11 lines
Makefile.in +5 -1
-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

Why sbin? Looks unrelated and superfluous.

Quoted 5 lines
Makefile.in +0 -0
 	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"; \

Makefile.in line 105

Quoted 10 lines
Makefile.in +2 -4
 	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

Other than the sbin bit, this is the actual relevant change -- do not override PATH and LD_LIBRARY_PATH for the tests if INSTALLCHECK is set in the environment (see above wrt naming).

Makefile.in line 115

Quoted 6 lines
Makefile.in +2 -0
@@ -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

This does not look very canonic. It is probably also quite superfluous.

Quoted 1 line

From GNU make manual, section 3.7:

| To this end, after reading in all makefiles, make will consider each
| as a goal target and attempt to update it. If a makefile has a rule
| which says how to update it (found either in that very makefile or in
| another one) or if an implicit rule applies to it (see Using Implicit
| Rules), it will be updated if necessary. After all makefiles have been
| checked, if any have actually been changed, make starts with a clean
| slate and reads all the makefiles over again. (It will also attempt to
| update each of them over again, but normally this will not change them
| again, since they are already up to date.)
Quoted 5 lines

.bin-dir-stamp: lvm-wrapper

Makefile.in +2 -2
-	rm -rf bin
-	mkdir bin
+	rm -rf sbin
+	mkdir sbin

Makefile.in

Quoted 10 lines
Makefile.in +4 -4
 	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

Just bin -> sbin again.

Quoted 14 lines
Makefile.in +1 -1
@@ -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

diff -a -u -r1.9 t-000-basic.sh

t-000-basic.sh line 25

Quoted 9 lines
t-000-basic.sh +5 -1
@@ -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

Makes sense.

Please separate out the actual relevant changes and submit again. I think that can go in. I don't see the reasoning behind "sbin", but I am not opposed to the other refactors -- but please submit them separately.

Thanks,
Petr.