main - tests: vdo emulation without vdo binary
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=15ad2b8e5585b89bc3f...
Commit: 15ad2b8e5585b89bc3f09a53567f17eb70f45714
Parent: acbeaa7a8d86acc0f0e3c04723d066d995f29fe5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 6 16:44:24 2022 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 7 14:58:01 2022 +0200
tests: vdo emulation without vdo binary
Avoid inserting 'vdo' binary into path - and use
alias and VDO_BINARY shell vars for emulation.
---
test/lib/lvm_vdo_wrapper.sh | 2 +-
test/shell/vdo-convert.sh | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
index d622d6456..90d0b2ce8 100755
--- a/test/lib/lvm_vdo_wrapper.sh
+++ b/test/lib/lvm_vdo_wrapper.sh
@@ -344,7 +344,7 @@ vdo_dry_ vdo_remove_ -f "$vdo_confFile" -n "$vdo_name" || true
#
# MAIN
#
-case "$1" in
+case "${1-}" in
"create") shift; vdo_create_ "$@" ;;
"remove") shift; vdo_remove_ "$@" ;;
"stop") shift; vdo_stop_ "$@" ;;
diff --git a/test/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
index f1d04d596..5bf53d081 100644
--- a/test/shell/vdo-convert.sh
+++ b/test/shell/vdo-convert.sh
@@ -29,7 +29,16 @@ aux prepare_dmeventd
#
# Main
#
-which vdo || skip
+if not which vdo ; then
+ which lvm_vdo_wrapper || skip "Missing 'lvm_vdo_wrapper'."
+ which oldvdoformat || skip "Emulation of vdo manager 'oldvdoformat' missing."
+ which oldvdoprepareforlvm || skip "Emulation of vdo manager 'oldvdoprepareforlvm' missing."
+ # enable expansion of aliasis within script itself
+ shopt -s expand_aliases
+ alias vdo='lvm_vdo_wrapper'
+ export VDO_BINARY=lvm_vdo_wrapper
+ echo "Using 'lvm_vdo_wrapper' emulation of 'vdo' manager."
+fi
which mkfs.ext4 || skip
export MKE2FS_CONFIG="$TESTDIR/lib/mke2fs.conf"
1 year, 7 months
main - tests: rework makefile
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=acbeaa7a8d86acc0f0e...
Commit: acbeaa7a8d86acc0f0e3c04723d066d995f29fe5
Parent: 2c7b9130499d17a657684fb3c762d608b50d139e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 1 10:06:14 2022 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 7 14:58:01 2022 +0200
tests: rework makefile
Improve dependency tracking
Use 'foreach()' with better tracing support
Link whole 'shell' dir instead of linking individual *.sh files
---
test/Makefile.in | 213 +++++++++++++++++++++++++------------------------------
1 file changed, 95 insertions(+), 118 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index f69dc97b6..1cad634b8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -28,28 +28,27 @@ datarootdir = @datarootdir@
LVM_TEST_RESULTS ?= results
# FIXME: resolve testing of: unit
-SOURCES = lib/not.c lib/harness.c lib/dmsecuretest.c
-CXXSOURCES = lib/runner.cpp
+SOURCES := lib/not.c lib/harness.c lib/dmsecuretest.c
+CXXSOURCES := lib/runner.cpp
CXXFLAGS += $(EXTRA_EXEC_CFLAGS)
CLEAN_DIRS += dbus/__pycache__ $(LVM_TEST_RESULTS)
ifneq (.,$(firstword $(srcdir)))
CLEAN_TARGETS += $(RUN_BASE) $(addprefix lib/,$(LIB_LVMLOCKD_CONF) $(LIB_MKE2FS_CONF))
endif
+CLEAN_TARGETS += $(shell find -H lib -type l) \
+ $(CXXSOURCES:%.cpp=%.o) $(CXXSOURCES:%.cpp=%.d) $(CXXSOURCES:%.cpp=%.gcno) $(CXXSOURCES:%.cpp=%.gcda)
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,\
- $(CMDS) clvmd dmeventd dmsetup dmstats lvmpolld \
- harness lvmdbusd.profile thin-performance.profile fsadm \
- dm-version-expected version-expected \
+ clvmd harness dmeventd dmsetup dmstats lvmpolld \
+ $(LVM_PROFILES) $(LVM_SCRIPTS) \
paths-installed paths-installed-t paths-common paths-common-t)
-
include $(top_builddir)/make.tmpl
T ?= .
S ?= @ # never match anything by default
VERBOSE ?= 0
-ALL := $(shell find -L $(srcdir) \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) | $(SORT))
comma = ,
RUN := $(shell find -L $(srcdir) -regextype posix-egrep \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
RUN_BASE = $(subst $(srcdir)/,,$(RUN))
@@ -161,38 +160,32 @@ check_lvmlockd_sanlock: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
--flavours udev-lvmlockd-sanlock --only shell/aa-lvmlockd-sanlock-prepare.sh,$(T),shell/zz-lvmlockd-sanlock-remove.sh --skip $(S)
-endif
-ifeq ("@BUILD_LVMLOCKD@", "yes")
check_lvmlockd_dlm: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
--flavours udev-lvmlockd-dlm --only shell/aa-lvmlockd-dlm-prepare.sh,$(T),shell/zz-lvmlockd-dlm-remove.sh --skip $(S)
-endif
-ifeq ("@BUILD_LVMLOCKD@", "yes")
check_lvmlockd_idm: .tests-stamp lib/idm_inject_failure
$(INSTALL_PROGRAM) lib/idm_inject_failure $(EXECDIR)
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
--flavours udev-lvmlockd-idm --only shell/aa-lvmlockd-idm-prepare.sh,$(T),shell/zz-lvmlockd-idm-remove.sh --skip $(S)
-endif
-ifeq ("@BUILD_LVMLOCKD@", "yes")
check_lvmlockd_test: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
--flavours udev-lvmlockd-test --only $(T) --skip $(S)
endif
-run-unit-test unit-test:
- @echo " [MAKE] $<"
- $(Q) $(MAKE) -C $(top_builddir) $(@)
+run-unit-test unit-test unit/unit-test:
+ @echo " [MAKE] $(@F)"
+ $(Q) $(MAKE) -C $(top_builddir) $(@F)
-DATADIR = $(datadir)/lvm2-testsuite
-EXECDIR = $(libexecdir)/lvm2-testsuite
+DATADIR := $(datadir)/lvm2-testsuite
+EXECDIR := $(libexecdir)/lvm2-testsuite
-LIB_FLAVOURS = \
+LIB_FLAVOURS :=\
flavour-ndev-lvmpolld\
flavour-ndev-vanilla\
flavour-ndev-devicesfile\
@@ -203,98 +196,96 @@ LIB_FLAVOURS = \
flavour-udev-lvmlockd-test\
flavour-udev-vanilla
-LIB_LVMLOCKD_CONF = \
+LIB_LVMLOCKD_CONF :=\
test-corosync-conf \
test-dlm-conf \
test-sanlock-conf
-LIB_MKE2FS_CONF = \
- mke2fs.conf
+LIB_MKE2FS_CONF := mke2fs.conf
+
+LVM_TOOLS :=\
+ daemons/dmeventd/dmeventd\
+ daemons/lvmpolld/lvmpolld\
+ libdm/dm-tools/dmsetup
+
+LVM_PROFILES := $(addsuffix .profile,\
+ cache-mq\
+ cache-smq\
+ lvmdbusd\
+ thin-performance)
-LIB_SECURETEST = securetest
-LIB_DMSECURETEST = dmsecuretest
-LIB_LOCAL = paths runner
-LIB_NOT = not
-LIB_LINK_NOT = invalid fail should
-LIB_SHARED = check aux inittest utils get lvm-wrapper
+LIB_LINK_NOT := invalid fail should
+LIB_LOCAL := paths runner
+LIB_NOT := not
+LIB_SHARED := check aux inittest utils get lvm-wrapper lvm_vdo_wrapper
+LIB_CONF := $(LIB_LVMLOCKD_CONF) $(LIB_MKE2FS_CONF)
+LIB_DATA := $(LIB_FLAVOURS) dm-version-expected version-expected
+LIB_EXEC := $(LIB_NOT) dmsecuretest securetest
+LVM_SCRIPTS := fsadm lvm_import_vdo
install: .tests-stamp lib/paths-installed
- @echo $(srcdir)
+ $(SHOW) " [INSTALL] tests"
$(Q) $(INSTALL_DIR) $(DATADIR)/{shell,api,unit,lib,dbus} $(EXECDIR)
$(Q) $(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
- $(INSTALL_DATA) api/*.sh $(DATADIR)/api
+ $(Q) $(INSTALL_DATA) api/*.sh $(DATADIR)/api
$(Q) $(INSTALL_DATA) unit/*.sh $(DATADIR)/unit
- -$(Q) $(INSTALL_PROGRAM) unit/unit-test $(DATADIR)/unit
- -$(Q) $(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
- $(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
- cd lib && $(INSTALL_DATA) \
- $(LIB_FLAVOURS) \
- $(LIB_LVMLOCKD_CONF) \
- $(LIB_MKE2FS_CONF) \
- dm-version-expected \
- version-expected \
- $(DATADIR)/lib
- @for i in cache-mq cache-smq thin-performance lvmdbusd ; do \
- echo "$(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib"; \
- $(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib; done
- cd lib && $(INSTALL_SCRIPT) $(LIB_SHARED) $(DATADIR)/lib
- @cd $(DATADIR)/lib && for i in $(CMDS); do \
- echo "$(LN_S) -f lvm-wrapper $$i"; \
- $(LN_S) -f lvm-wrapper $$i; done
- $(INSTALL_PROGRAM) lib/$(LIB_NOT) lib/$(LIB_SECURETEST) lib/$(LIB_DMSECURETEST) $(EXECDIR)
- @cd $(EXECDIR) && for i in $(LIB_LINK_NOT); do \
- echo "$(LN_S) -f not $$i"; \
- $(LN_S) -f not $$i; done
+ $(Q)- $(INSTALL_PROGRAM) unit/unit-test $(DATADIR)/unit
+ $(Q)- $(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
+ $(Q) $(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
+ $(Q) cd lib &&\
+ $(INSTALL_DATA) $(LIB_DATA) $(DATADIR)/lib
+ $(Q) cd lib &&\
+ $(INSTALL_SCRIPT) $(LIB_SHARED) $(DATADIR)/lib
+ $(Q) cd lib &&\
+ $(INSTALL_PROGRAM) -D $(LIB_EXEC) $(EXECDIR)
+ $(Q) cd $(abs_top_srcdir)/conf &&\
+ $(INSTALL_DATA) $(LVM_PROFILES) $(DATADIR)/lib
+ $(Q) cd $(DATADIR)/lib &&\
+ $(foreach FILE, $(CMDS), $(LN_S) -f lvm-wrapper $(FILE) $(newline))
+ $(Q) cd $(EXECDIR) &&\
+ $(foreach FILE, $(LIB_LINK_NOT), $(LN_S) -f $(LIB_NOT) $(FILE) $(newline))
$(Q) $(INSTALL_PROGRAM) -D lib/runner $(bindir)/lvm2-testsuite
-lib/should: lib/not
- @echo " [LN] $@"
- $(Q) $(LN_S) -f not lib/should
-
-lib/invalid: lib/not
- @echo " [LN] $@"
- $(Q) $(LN_S) -f not lib/invalid
-
-lib/fail: lib/not
- @echo " [LN] $@"
- $(Q) $(LN_S) -f not lib/fail
+lib/should lib/invalid lib/fail: lib/not
+ $(SHOW) " [LN] $@"
+ $(Q) $(LN_S) -f $(<F) $@
lib/runner: lib/runner.o .lib-dir-stamp
- @echo " [CXX] $@"
- $(Q) $(CXX) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $<
-
-lib/dmsecuretest: lib/dmsecuretest.o .lib-dir-stamp $(INTERNAL_LIBS)
- @echo " [CC] $@"
- $(Q) $(CC) -g $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< $(INTERNAL_LIBS) $(LIBS)
+ $(SHOW) " [LD] $@"
+ $(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $<
lib/securetest: lib/dmsecuretest.o .lib-dir-stamp
- @echo " [CC] $@"
- $(Q) $(CC) -g $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< -L$(interfacebuilddir) -ldevmapper $(LIBS)
-
-lib/idm_inject_failure: lib/idm_inject_failure.o .lib-dir-stamp
- @echo " [CC] $@"
- $(Q) $(CC) -g $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< $(INTERNAL_LIBS) $(LIBS) -lseagate_ilm
+ $(SHOW) " [LD] $@"
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< -L$(interfacebuilddir) -ldevmapper $(LIBS)
+lib/not: lib/not.o
lib/runner.o: $(wildcard $(srcdir)/lib/*.h)
-CFLAGS_runner.o += $(EXTRA_EXEC_CFLAGS)
-CFLAGS_dmsecuretest.o += $(EXTRA_EXEC_CFLAGS)
+CFLAGS_lib/runner.o += $(EXTRA_EXEC_CFLAGS)
+CFLAGS_lib/dmsecuretest.o += $(EXTRA_EXEC_CFLAGS)
+LDFLAGS_lib/dmsecuretest += $(EXTRA_EXEC_LDFLAGS) $(INTERNAL_LIBS) $(LIBS)
+LDFLAGS_lib/idm_inject_failure += $(INTERNAL_LIBS) $(LIBS) -lseagate_ilm
lib/%: lib/%.o .lib-dir-stamp
- @echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -o $@ $<
+ $(SHOW) " [LD] $@"
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -o $@ $< $(LDFLAGS_$@)
lib/%: $(srcdir)/lib/%.sh .lib-dir-stamp
- @echo " [CP] $@"
+ $(SHOW) " [CP] $@"
+ $(Q) cp $< $@
+ $(Q) $(CHMOD) +x $@
+
+lib/%: $(top_srcdir)/scripts/%.sh .lib-dir-stamp
+ $(SHOW) " [CP] $@"
$(Q) cp $< $@
$(Q) $(CHMOD) +x $@
lib/flavour-%: $(srcdir)/lib/flavour-%.sh .lib-dir-stamp
- @echo " [FLAVOUR] $<"
+ $(SHOW) " [FLAVOUR] $<"
$(Q) cp $< $@
-lib/paths-common: $(srcdir)/Makefile.in .lib-dir-stamp Makefile
- @echo " [PATHS] $@"
+lib/paths-common: $(srcdir)/Makefile.in Makefile .lib-dir-stamp
+ $(SHOW) " [PATHS] $@"
$(Q) echo 'DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
$(Q) echo 'LVMPOLLD_PIDFILE="@LVMPOLLD_PIDFILE@"' >> $@-t
$(Q) echo 'DMEVENTD_PIDFILE="@DMEVENTD_PIDFILE@"' >> $@-t
@@ -312,7 +303,7 @@ lib/paths-common: $(srcdir)/Makefile.in .lib-dir-stamp Makefile
$(Q) mv $@-t $@
lib/paths-installed: lib/paths-common
- @echo " [PATHS] $@"
+ $(SHOW) " [PATHS] $@"
$(Q) $(RM) $@-t
$(Q) cat lib/paths-common > $@-t
$(Q) echo 'installed_testsuite=1' >> $@-t
@@ -320,7 +311,7 @@ lib/paths-installed: lib/paths-common
$(Q) mv $@-t $@
lib/paths: lib/paths-common
- @echo " [PATHS] $@"
+ $(SHOW) " [PATHS] $@"
$(Q) $(RM) $@-t
$(Q) cat lib/paths-common > $@-t
$(Q) echo 'top_srcdir="$(top_srcdir)"' >> $@-t
@@ -336,44 +327,30 @@ lib/version-expected: $(top_srcdir)/VERSION .lib-dir-stamp
lib/dm-version-expected: $(top_srcdir)/VERSION_DM .lib-dir-stamp
$(Q) cut -f 1 -d ' ' <$< >$@
-CMDS = lvm $(shell cat $(top_builddir)/tools/.commands 2>/dev/null)
-LIB = $(addprefix lib/, $(LIB_SECURETEST) $(LIB_DMSECURETEST) $(LIB_SHARED) $(LIB_LOCAL) $(LIB_NOT) $(LIB_LINK_NOT) $(LIB_FLAVOURS))
-
-.tests-stamp: .lib-dir-stamp $(ALL) $(LIB) $(SUBDIRS) lib/version-expected lib/dm-version-expected unit-test
- @echo " [TEST-STAMP]"
- @if test "$(srcdir)" != . ; then \
- echo "Linking tests to builddir."; \
- $(MKDIR_P) shell; \
- for f in $(subst $(srcdir)/,,$(ALL)); do \
- test -n "$(Q)" || echo "$(LN_S) -f $(abs_top_srcdir)/test/$$f $$f"; \
- $(LN_S) -f $(abs_top_srcdir)/test/$$f $$f; \
- done; \
- fi
+CMDS := lvm $(shell cat $(abs_top_builddir)/tools/.commands 2>/dev/null)
+LIB := $(addprefix lib/, $(LVM_SCRIPTS) $(LIB_SHARED) $(LIB_LOCAL) $(LIB_EXEC) $(LIB_LINK_NOT) $(LIB_DATA))
+
+.tests-stamp: .lib-dir-stamp $(LIB) $(SUBDIRS)
+ $(SHOW) " [TESTS-STAMP]"
+ifneq (.,$(firstword $(srcdir)))
+ $(SHOW) " Linking tests to builddir."
+ $(Q) $(LN_S) -f $(srcdir)/shell
+endif
$(Q) $(MKDIR_P) -m a=rwx $(LVM_TEST_RESULTS)
$(Q) touch $@
-.lib-dir-stamp:
- @echo " [LIB-STAMP]"
- $(Q) $(MKDIR_P) lib unit
+.lib-dir-stamp: unit/unit-test
+ $(SHOW) " [LIB-DIR-STAMP]"
+ $(Q) $(MKDIR_P) api lib unit
$(Q) $(RM) lib/clvmd
- @for i in $(CMDS); do \
- test -n "$(Q)" || echo "$(LN_S) -f lvm-wrapper lib/$$i"; \
- $(LN_S) -f lvm-wrapper lib/$$i; done
- @for i in daemons/dmeventd/dmeventd \
- libdm/dm-tools/dmsetup \
- daemons/lvmpolld/lvmpolld ; do \
- test -n "$(Q)" || echo "$(LN_S) -f $(abs_top_builddir)/$$i lib/"; \
- $(LN_S) -f $(abs_top_builddir)/$$i lib/; done
- $(Q) $(LN_S) -f $(abs_top_builddir)/libdm/dm-tools/dmsetup lib/dmstats
- $(Q) $(LN_S) -f $(abs_top_srcdir)/conf/lvmdbusd.profile lib/
- $(Q) $(LN_S) -f $(abs_top_srcdir)/conf/thin-performance.profile lib/
- $(Q) $(LN_S) -f $(abs_top_srcdir)/scripts/fsadm.sh lib/fsadm
- $(Q) $(LN_S) -f $(abs_top_srcdir)/scripts/lvm_import_vdo.sh lib/lvm_import_vdo
- $(Q) which vdo || $(LN_S) -f $(abs_top_srcdir)/test/lib/lvm_vdo_wrapper.sh lib/vdo
- @test "$(srcdir)" = . || \
- for i in $(LIB_LVMLOCKD_CONF) $(LIB_MKE2FS_CONF); do \
- test -n "$(Q)" || echo "$(LN_S) -f $(abs_top_srcdir)/test/lib/$$i lib/"; \
- $(LN_S) -f $(abs_top_srcdir)/test/lib/$$i lib/; done
+ $(Q) $(LN_S) -f dmsetup lib/dmstats
+ $(Q) $(foreach FILE, $(CMDS), $(LN_S) -f lvm-wrapper lib/$(FILE) $(newline))
+ $(Q) $(foreach FILE, $(LVM_TOOLS), $(LN_S) -f $(abs_top_builddir)/$(FILE) lib/ $(newline))
+ $(Q) $(LN_S) -f $(addprefix $(abs_top_srcdir)/conf/, $(LVM_PROFILES)) lib/
+ifneq (.,$(firstword $(srcdir)))
+ $(Q) $(LN_S) -f $(addprefix $(abs_top_srcdir)/test/lib/,\
+ $(LIB_LVMLOCKD_CONF) $(LIB_MKE2FS_CONF)) lib/
+endif
$(Q) touch $@
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
1 year, 7 months
main - make: update make.tmpl
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2c7b9130499d17a6576...
Commit: 2c7b9130499d17a657684fb3c762d608b50d139e
Parent: 85b436642baa4b957f70cf7e94355ee328fc8c02
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 5 15:56:58 2022 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 7 14:58:01 2022 +0200
make: update make.tmpl
Add new define 'newline' for use in 'foreach()'
Add new $(SHOW) for makefile printing output
Add 'make print-VAR' for easier debugging of Makefiles' variables.
---
libdm/make.tmpl.in | 24 +++++++++++++++++++-----
make.tmpl.in | 39 +++++++++++++++++++++++++++++++--------
2 files changed, 50 insertions(+), 13 deletions(-)
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index a306101d5..f1c88fac0 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -13,11 +13,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-ifeq ($(V),1)
- Q=
-else
- Q=@
-endif
+V ?= $(if ("@SILENT_RULES@","yes"),,1)
+Q := $(if $(V),,@)
+SHOW := $(if $(V),@true,@echo)
SHELL = @SHELL@
@@ -129,6 +127,17 @@ DEFAULT_RUN_DIR = @DEFAULT_RUN_DIR@
DEFAULT_PID_DIR = @DEFAULT_PID_DIR@
DEFAULT_MANGLING = @MANGLING@
+#----------------------------------------------------------------------
+# From http://blog.melski.net/tag/debugging-makefiles/
+#
+# Usage: make print-CC print-CXX print-LD
+#----------------------------------------------------------------------
+print-%:
+ @echo '$*=$($*)'
+ @echo ' origin = $(origin $*)'
+ @echo ' flavor = $(flavor $*)'
+ @echo ' value = $(value $*)'
+
# Setup vpath search paths for some suffixes
vpath %.c $(srcdir)
vpath %.cpp $(srcdir)
@@ -145,6 +154,10 @@ ifndef MAKEFLAGS
MAKEFLAGS = @JOBS@
endif
+ifneq (1, $(firstword $(V)))
+MAKEFLAGS += --no-print-directory
+endif
+
# Handle installation of files
ifeq ("@WRITE_INSTALL@", "yes")
# leaving defaults
@@ -524,6 +537,7 @@ endif
ifeq ("@USE_TRACKING@","yes")
ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov \
help check check_local check_cluster check_lvmpolld))
+.SECONDARY:
# Note: no tabs before -include
-include $(SOURCES:.c=.d) $(SOURCES2:.c=.d) $(CXXSOURCES:.cpp=.d)
endif
diff --git a/make.tmpl.in b/make.tmpl.in
index 427fee596..a390553a4 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -13,15 +13,10 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-ifneq ("@SILENT_RULES@","yes")
- V ?= 1
-endif
-ifeq ($(V),1)
- Q=
-else
- Q=@
-endif
+V ?= $(if ("@SILENT_RULES@","yes"),,1)
+Q := $(if $(V),,@)
+SHOW := $(if $(V),@true,@echo)
SHELL = @SHELL@
@@ -134,6 +129,18 @@ PYTHON_PREFIX = $(prefix)
python2dir = @PYTHON2DIR@
python3dir = @PYTHON3DIR@
+# Define macro NewLine for use in $(foreach) with 2 blank lines
+ifeq (1, $(firstword $(V)))
+define newline
+
+
+endef
+else
+define newline
+;
+endef
+endif
+
USRLIB_RELPATH = $(shell echo $(abspath $(usrlibdir) $(libdir)) | \
$(AWK) -f $(top_srcdir)/scripts/relpath.awk)
@@ -148,6 +155,17 @@ DEFAULT_RUN_DIR = @DEFAULT_RUN_DIR@
DEFAULT_PID_DIR = @DEFAULT_PID_DIR@
DEFAULT_MANGLING = @MANGLING@
+#----------------------------------------------------------------------
+# From http://blog.melski.net/tag/debugging-makefiles/
+#
+# Usage: make print-CC print-CXX print-LD
+#----------------------------------------------------------------------
+print-%:
+ @echo '$*=$($*)'
+ @echo ' origin = $(origin $*)'
+ @echo ' flavor = $(flavor $*)'
+ @echo ' value = $(value $*)'
+
# Setup vpath search paths for some suffixes
vpath %.c $(srcdir)
vpath %.cpp $(srcdir)
@@ -164,6 +182,10 @@ ifndef MAKEFLAGS
MAKEFLAGS = @JOBS@
endif
+ifneq (1, $(firstword $(V)))
+MAKEFLAGS += --no-print-directory
+endif
+
# Handle installation of files
ifeq ("@WRITE_INSTALL@", "yes")
# leaving defaults
@@ -582,6 +604,7 @@ endif
ifeq ("$(USE_TRACKING)","yes")
ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
help check check_local check_cluster check_lvmpolld run-unit-test tags))
+.SECONDARY:
# Note: no tabs before -include
-include $(SOURCES:.c=.d) $(SOURCES2:.c=.d) $(CXXSOURCES:.cpp=.d)
endif
1 year, 7 months
main - python: variable without destdir
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=85b436642baa4b957f7...
Commit: 85b436642baa4b957f70cf7e94355ee328fc8c02
Parent: e757965222607a21a240139d1696780c389b798d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 6 16:09:39 2022 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 7 14:58:01 2022 +0200
python: variable without destdir
PYTHON_PREFIX without $(DESTDIR)
---
make.tmpl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make.tmpl.in b/make.tmpl.in
index cccda10d6..427fee596 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -128,7 +128,7 @@ systemd_generator_dir = $(DESTDIR)$(SYSTEMD_GENERATOR_DIR)
systemd_dir = $(DESTDIR)@systemdutildir@
tmpfiles_dir = $(DESTDIR)@tmpfilesdir@
ocf_scriptdir = $(DESTDIR)@OCFDIR@
-PYTHON_PREFIX = $(DESTDIR)$(prefix)
+PYTHON_PREFIX = $(prefix)
# N.B. No $(DESTDIR) prefix here.
python2dir = @PYTHON2DIR@
1 year, 7 months
main - gcc: eliminate warnings
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e757965222607a21a24...
Commit: e757965222607a21a240139d1696780c389b798d
Parent: 973d0bd5b7110ad16fe26362c2586c961591ba4a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 5 16:22:32 2022 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 7 14:58:01 2022 +0200
gcc: eliminate warnings
Gcc starts to show new warning - although unlikely to be able to hit
initialize variables to 0.
---
lib/config/config.c | 2 +-
tools/lvcreate.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 230ec3225..5986e64b1 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1830,7 +1830,7 @@ static int _out_line_fn(const struct dm_config_node *cn, const char *line, void
char summary[MAX_COMMENT_LINE+1];
char version[9];
int pos = 0;
- int space_prefix_len;
+ int space_prefix_len = 0;
const char *p;
size_t len;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 9bf5f4821..670c52913 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -252,7 +252,7 @@ static int _update_extents_params(struct volume_group *vg,
uint32_t size_rest;
uint32_t stripesize_extents;
uint32_t extents;
- uint32_t base_calc_extents;
+ uint32_t base_calc_extents = 0;
uint32_t vdo_pool_max_extents;
if (lcp->size &&
1 year, 7 months
main - report: fix lv_active column type from STR to BIN
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=973d0bd5b7110ad16fe...
Commit: 973d0bd5b7110ad16fe26362c2586c961591ba4a
Parent: 0eebd9d7802c724ee71b6ebb80940ea6007f9c7a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Sep 6 14:40:06 2022 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Sep 6 15:49:27 2022 +0200
report: fix lv_active column type from STR to BIN
Fix lv_active to be of BIN type instead of STR. This allows lv_active to
follow the report/binary_values_as_numeric setting as well as --binary
cmd line switch. Also, it makes it possible to use -S|--select with
either textual or numeric representation of the value, like 'lvs -S
active=active' but also 'lvs -S active=1'.
---
WHATS_NEW | 1 +
lib/report/columns.h | 2 +-
lib/report/report.c | 13 +++++++------
lib/report/values.h | 1 +
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 293c034af..e29ec7066 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.17 -
===============================
+ Fix lv_active field type to binary so --select and --binary applies properly.
Switch to use mallinfo2 and use it only with glibc.
Error out in lvm shell if using a cmd argument not supported in the shell.
Fix lvm shell's lastlog command to report previous pre-command failures.
diff --git a/lib/report/columns.h b/lib/report/columns.h
index d702635d2..8719a7e7d 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -63,7 +63,7 @@ FIELD(LVS, lv, BIN, "FixMin", lvid, 10, lvfixedminor, lv_fixed_minor, "Set if LV
FIELD(LVS, lv, BIN, "SkipAct", lvid, 15, lvskipactivation, lv_skip_activation, "Set if LV is skipped on activation.", 0)
FIELD(LVS, lv, BIN, "AutoAct", lvid, 0, lvautoactivation, lv_autoactivation, "Set if LV autoactivation is enabled.", 0)
FIELD(LVS, lv, STR, "WhenFull", lvid, 15, lvwhenfull, lv_when_full, "For thin pools, behavior when full.", 0)
-FIELD(LVS, lv, STR, "Active", lvid, 0, lvactive, lv_active, "Active state of the LV.", 0)
+FIELD(LVS, lv, BIN, "Active", lvid, 0, lvactive, lv_active, "Active state of the LV.", 0)
FIELD(LVS, lv, BIN, "ActLocal", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0)
FIELD(LVS, lv, BIN, "ActRemote", lvid, 10, lvactiveremotely, lv_active_remotely, "Set if the LV is active remotely.", 0)
FIELD(LVS, lv, BIN, "ActExcl", lvid, 10, lvactiveexclusively, lv_active_exclusively, "Set if the LV is active exclusively.", 0)
diff --git a/lib/report/report.c b/lib/report/report.c
index f666ca842..9172c1f0e 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3808,14 +3808,15 @@ static int _lvactive_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- char *repstr;
+ const struct logical_volume *lv = (const struct logical_volume *) data;
+ int active;
- if (!(repstr = lv_active_dup(mem, (const struct logical_volume *) data))) {
- log_error("Failed to allocate buffer for active.");
- return 0;
- }
+ if (!activation())
+ return _binary_undef_disp(rh, mem, field, private);
- return _field_set_value(field, repstr, NULL);
+ active = lv_is_active(lv);
+
+ return _binary_disp(rh, mem, field, active, GET_FIRST_RESERVED_NAME(lv_active_y), private);
}
static int _lvactivelocally_disp(struct dm_report *rh, struct dm_pool *mem,
diff --git a/lib/report/values.h b/lib/report/values.h
index 71175fa6e..3efe2b83f 100644
--- a/lib/report/values.h
+++ b/lib/report/values.h
@@ -99,6 +99,7 @@ FIELD_RESERVED_BINARY_VALUE(lv_merging, lv_merging, "", "merging")
FIELD_RESERVED_BINARY_VALUE(lv_converting, lv_converting, "", "converting")
FIELD_RESERVED_BINARY_VALUE(lv_allocation_locked, lv_allocation_locked, "", "allocation locked", "locked")
FIELD_RESERVED_BINARY_VALUE(lv_fixed_minor, lv_fixed_minor, "", "fixed minor", "fixed")
+FIELD_RESERVED_BINARY_VALUE(lv_active, lv_active, "", "active")
FIELD_RESERVED_BINARY_VALUE(lv_active_locally, lv_active_locally, "", "active locally", "active", "locally")
FIELD_RESERVED_BINARY_VALUE(lv_active_remotely, lv_active_remotely, "", "active remotely", "active", "remotely")
FIELD_RESERVED_BINARY_VALUE(lv_active_exclusively, lv_active_exclusively, "", "active exclusively", "active", "exclusively")
1 year, 7 months