mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Cleanup test makefiles
Simplify /api makefile and use SUBDIRS target for test dir. Properly cleanup Makefiles with distclean in /test. Use symbolic links for shell scripts for non-srcdir compilation.
This commit is contained in:
parent
4b795cc3a0
commit
4b42d7ae98
@ -36,7 +36,7 @@ endif
|
|||||||
ifeq ($(MAKECMDGOALS),distclean)
|
ifeq ($(MAKECMDGOALS),distclean)
|
||||||
SUBDIRS = doc include man scripts \
|
SUBDIRS = doc include man scripts \
|
||||||
lib tools daemons libdm \
|
lib tools daemons libdm \
|
||||||
udev po liblvm test/api test \
|
udev po liblvm test \
|
||||||
unit-tests/datastruct unit-tests/mm unit-tests/regex
|
unit-tests/datastruct unit-tests/mm unit-tests/regex
|
||||||
endif
|
endif
|
||||||
DISTCLEAN_DIRS += lcov_reports*
|
DISTCLEAN_DIRS += lcov_reports*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.89 -
|
Version 2.02.89 -
|
||||||
==================================
|
==================================
|
||||||
|
Use gcc warning options only with .c to .o compilation.
|
||||||
Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
|
Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
|
||||||
Replace the unit testing framework with CUnit (--enable-testing).
|
Replace the unit testing framework with CUnit (--enable-testing).
|
||||||
Fix dmeventd snapshot monitoring when multiple extensions were involved.
|
Fix dmeventd snapshot monitoring when multiple extensions were involved.
|
||||||
|
@ -12,10 +12,9 @@
|
|||||||
|
|
||||||
#TEST_OPTS=--verbose --debug
|
#TEST_OPTS=--verbose --debug
|
||||||
SHELL_PATH ?= $(SHELL)
|
SHELL_PATH ?= $(SHELL)
|
||||||
TAR ?= $(TAR)
|
|
||||||
RM ?= rm -f
|
RM ?= rm -f
|
||||||
|
|
||||||
subdir := $(shell pwd|sed 's,.*/,,')
|
subdir = $(shell pwd|sed 's,.*/,,')
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
@ -24,6 +23,9 @@ abs_srcdir = @abs_srcdir@
|
|||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
abs_top_srcdir = @abs_top_srcdir@
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
|
|
||||||
|
SUBDIRS = api unit
|
||||||
|
|
||||||
include $(top_builddir)/make.tmpl
|
include $(top_builddir)/make.tmpl
|
||||||
|
|
||||||
T ?= .
|
T ?= .
|
||||||
@ -43,24 +45,16 @@ endif
|
|||||||
all: check
|
all: check
|
||||||
|
|
||||||
check: .tests-stamp
|
check: .tests-stamp
|
||||||
@echo "Running API (liblvm2app) tests"
|
|
||||||
make -C api tests
|
|
||||||
ifeq ("$(TESTING)", "yes")
|
|
||||||
@echo Running unit tests
|
|
||||||
make unit
|
|
||||||
endif
|
|
||||||
@echo Testing with locking_type 1
|
@echo Testing with locking_type 1
|
||||||
VERBOSE=$(VERBOSE) ./lib/harness $(RUN_BASE)
|
VERBOSE=$(VERBOSE) ./lib/harness $(RUN_BASE)
|
||||||
@echo Testing with locking_type 3
|
@echo Testing with locking_type 3
|
||||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
||||||
|
|
||||||
check_cluster: .tests-stamp
|
check_cluster: .tests-stamp
|
||||||
make -C api tests
|
|
||||||
@echo Testing with locking_type 3
|
@echo Testing with locking_type 3
|
||||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
||||||
|
|
||||||
check_local: .tests-stamp
|
check_local: .tests-stamp
|
||||||
make -C api tests
|
|
||||||
@echo Testing with locking_type 1
|
@echo Testing with locking_type 1
|
||||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./lib/harness $(RUN_BASE)
|
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./lib/harness $(RUN_BASE)
|
||||||
|
|
||||||
@ -75,7 +69,7 @@ lib/%: $(srcdir)/lib/%.sh .lib-dir-stamp
|
|||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
|
lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
|
||||||
rm -f $@-t
|
$(RM) $@-t
|
||||||
echo 'top_srcdir=$(top_srcdir)' >> $@-t
|
echo 'top_srcdir=$(top_srcdir)' >> $@-t
|
||||||
echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
|
echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
|
||||||
echo 'abs_top_srcdir=$(abs_top_srcdir)' >> $@-t
|
echo 'abs_top_srcdir=$(abs_top_srcdir)' >> $@-t
|
||||||
@ -90,39 +84,34 @@ LIB = lib/not lib/should lib/harness \
|
|||||||
|
|
||||||
CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
|
CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
|
||||||
|
|
||||||
.tests-stamp: $(ALL) $(LIB)
|
.tests-stamp: $(ALL) $(LIB) $(SUBDIRS)
|
||||||
mkdir -p shell
|
|
||||||
@if test "$(srcdir)" != . ; then \
|
@if test "$(srcdir)" != . ; then \
|
||||||
echo "Copying tests to builddir."; \
|
echo "Linking tests to builddir."; \
|
||||||
for f in $(ALL); do cp $$f `echo $$f | sed -e s,^$(srcdir)/,,`; done; \
|
$(MKDIR_P) shell; \
|
||||||
|
for f in $(subst $(srcdir)/,,$(ALL)); do \
|
||||||
|
ln -sf $(abs_top_srcdir)/test/$$f $$f; \
|
||||||
|
done; \
|
||||||
fi
|
fi
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
.lib-dir-stamp:
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
$(MKDIR_P) lib
|
||||||
|
|
||||||
.lib-dir-stamp: $(top_srcdir)/scripts/fsadm.sh
|
|
||||||
mkdir -p lib
|
|
||||||
for i in $(CMDS); do ln -fs lvm-wrapper lib/$$i; done
|
for i in $(CMDS); do ln -fs lvm-wrapper lib/$$i; done
|
||||||
ln -fs "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup
|
ln -fs "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup
|
||||||
ln -fs "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd
|
ln -fs "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd
|
||||||
ln -fs "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd
|
ln -fs "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd
|
||||||
ln -fs "$(abs_top_builddir)/daemons/lvmetad/lvmetad" lib/lvmetad
|
ln -fs "$(abs_top_builddir)/daemons/lvmetad/lvmetad" lib/lvmetad
|
||||||
ln -fs "$(abs_top_srcdir)/scripts/vgimportclone.sh" lib/vgimportclone
|
ln -fs "$(abs_top_srcdir)/scripts/vgimportclone.sh" lib/vgimportclone
|
||||||
cp -f "$(top_srcdir)/scripts/fsadm.sh" lib/fsadm
|
ln -fs "$(abs_top_srcdir)/scripts/fsadm.sh" lib/fsadm
|
||||||
@chmod +x lib/fsadm
|
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C api clean
|
test "$(srcdir)" != . && $(RM) $(RUN_BASE) lvm2app.sh
|
||||||
test "$(srcdir)" != . && rm -f $(RUN_BASE) lvm2app.sh
|
|
||||||
|
|
||||||
.PHONY: unit
|
|
||||||
|
|
||||||
unit:
|
|
||||||
make -C unit $(@)
|
|
||||||
|
|
||||||
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,$(CMDS)) \
|
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,$(CMDS)) \
|
||||||
lib/clvmd lib/dmeventd lib/dmsetup lib/lvmetad lib/fsadm lib/vgimportclone
|
lib/clvmd lib/dmeventd lib/dmsetup lib/lvmetad lib/fsadm lib/vgimportclone
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||||
|
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
|
# Copyright (C) 2009-2011 Red Hat, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of LVM2.
|
# This file is part of LVM2.
|
||||||
#
|
#
|
||||||
@ -15,53 +15,26 @@ srcdir = @srcdir@
|
|||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
|
|
||||||
ifeq ("@DEBUG@", "yes")
|
TARGETS =
|
||||||
DEFS += -DDEBUG
|
|
||||||
endif
|
|
||||||
|
|
||||||
TARGETS =
|
|
||||||
ifeq ("@APPLIB@", "yes")
|
ifeq ("@APPLIB@", "yes")
|
||||||
TARGETS += test
|
TARGETS += test
|
||||||
test_SOURCES = test.c
|
SOURCES = test.c
|
||||||
wrapper_SOURCES = test.c
|
|
||||||
INCLUDES += -I../../include
|
|
||||||
|
|
||||||
TARGETS += vgtest.t percent.t pe_start.t
|
TARGETS += vgtest.t percent.t pe_start.t
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LVMLIBS = @LVM2APP_LIB@ -ldevmapper
|
|
||||||
DEPLIBS = $(top_builddir)/liblvm/liblvm2app.so $(top_builddir)/libdm/libdevmapper.so
|
|
||||||
|
|
||||||
DEFS += -D_REENTRANT
|
|
||||||
|
|
||||||
include $(top_builddir)/make.tmpl
|
include $(top_builddir)/make.tmpl
|
||||||
|
|
||||||
LDFLAGS = -L$(top_builddir)/libdm -L$(top_builddir)/liblvm
|
DEFS += -D_REENTRANT
|
||||||
|
DEPLIBS += $(top_builddir)/liblvm/liblvm2app.so $(top_builddir)/libdm/libdevmapper.so
|
||||||
ifeq ("@DMEVENTD@", "yes")
|
LDFLAGS += -L$(top_builddir)/liblvm
|
||||||
LVMLIBS += -ldevmapper-event
|
LVMLIBS = @LVM2APP_LIB@ -ldevmapper $(LIBS)
|
||||||
LDFLAGS += -L$(top_builddir)/daemons/dmeventd
|
|
||||||
endif
|
|
||||||
|
|
||||||
test_OBJECTS = $(test_SOURCES:.c=.o)
|
|
||||||
wrapper_OBJECTS = $(wrapper_SOURCES:.c=.o)
|
|
||||||
OBJECTS = $(test_OBJECTS)
|
|
||||||
|
|
||||||
all: tests
|
|
||||||
|
|
||||||
tests: $(TARGETS)
|
|
||||||
|
|
||||||
test: $(test_OBJECTS) $(DEPLIBS)
|
|
||||||
$(CC) -o test $(test_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS) $(READLINE_LIBS)
|
|
||||||
|
|
||||||
%.t: %.o $(DEPLIBS)
|
%.t: %.o $(DEPLIBS)
|
||||||
$(CC) -o $@ $(<) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
|
$(CC) -o $@ $(<) $(LDFLAGS) $(LVMLIBS)
|
||||||
|
|
||||||
wrapper: $(wrapper_OBJECTS) $(DEPLIBS)
|
test: $(OBJECTS) $(DEPLIBS)
|
||||||
$(CC) -o wrapper $(wrapper_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS) -lreadline
|
$(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LVMLIBS) $(READLINE_LIBS)
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status test/api/Makefile
|
cd $(top_builddir) && $(SHELL) ./config.status test/api/Makefile
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.t
|
|
||||||
|
@ -13,13 +13,18 @@
|
|||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
VPATH = @srcdir@
|
|
||||||
|
|
||||||
|
VPATH = $(srcdir)
|
||||||
SOURCES = bitset_t.c matcher_t.c run.c
|
SOURCES = bitset_t.c matcher_t.c run.c
|
||||||
TARGETS = run
|
TARGETS = run
|
||||||
|
|
||||||
include $(top_builddir)/make.tmpl
|
include $(top_builddir)/make.tmpl
|
||||||
LDFLAGS += -ldevmapper -lcunit
|
LDFLAGS += -ldevmapper -lcunit
|
||||||
|
|
||||||
unit: run
|
ifeq ("$(TESTING)", "yes")
|
||||||
LD_LIBRARY_PATH=$(top_builddir)/libdm ./run
|
all: unit
|
||||||
|
endif
|
||||||
|
|
||||||
|
unit: $(TARGETS)
|
||||||
|
@echo Running unit tests
|
||||||
|
LD_LIBRARY_PATH=$(top_builddir)/libdm ./$(TARGETS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user