master - tests: aux detecs supported segments
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b8b13c62b5407a9959...
Commit: 7b8b13c62b5407a9959bad2168c0c7dadfc80981
Parent: 35ffc3f8eb7a326c29c1aa6349ac383d81f2cdc0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 22:50:36 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 22:50:36 2018 +0200
tests: aux detecs supported segments
Replace previous compilation detection of present supported segtypes
with runtime check.
---
test/lib/aux.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index adfad3b..0f0967b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1516,6 +1516,10 @@ driver_at_least() {
}
have_thin() {
+ lvm segtypes 2>/dev/null | grep -q thin$ || {
+ echo "Thin is not built-in." >&2
+ return 1
+ }
target_at_least dm-thin-pool "$@"
declare -a CONF=()
@@ -1556,6 +1560,10 @@ have_raid4 () {
}
have_cache() {
+ lvm segtypes 2>/dev/null | grep -q cache$ || {
+ echo "Cache is not built-in." >&2
+ return 1
+ }
target_at_least dm-cache "$@"
declare -a CONF=()
6 years, 1 month
master - build: lcov reporting for unit tests
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=35ffc3f8eb7a326c29c...
Commit: 35ffc3f8eb7a326c29c1aa6349ac383d81f2cdc0
Parent: 67c02877a1f2991e1f5de0205e20841b94df5413
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 00:47:53 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
build: lcov reporting for unit tests
List also lcov for processed unit tests.
---
Makefile.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index c2d5122..e2f5a84 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -171,6 +171,7 @@ install_tmpfiles_configuration:
LCOV_TRACES = libdm.info lib.info liblvm.info tools.info \
libdaemon/client.info libdaemon/server.info \
+ test/unit.info \
daemons/clvmd.info \
daemons/dmeventd.info \
daemons/lvmetad.info \
6 years, 1 month
master - build: install unit-test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=67c02877a1f2991e1f5...
Commit: 67c02877a1f2991e1f5de0205e20841b94df5413
Parent: 4c7565b65d0a02f6deedd37e1274b8646997fa71
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 00:05:01 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
build: install unit-test
---
test/Makefile.in | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 67f2753..407babd 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -226,11 +226,13 @@ LIB_SHARED = check aux inittest utils get lvm-wrapper
install: .tests-stamp lib/paths-installed
@echo $(srcdir)
- $(INSTALL_DIR) $(DATADIR)/{shell,api,lib,dbus} $(EXECDIR)
+ $(INSTALL_DIR) $(DATADIR)/{shell,api,unit,lib,dbus} $(EXECDIR)
$(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
$(INSTALL_DATA) api/*.sh $(DATADIR)/api
+ $(INSTALL_DATA) unit/*.sh $(DATADIR)/unit
$(INSTALL_DATA) lib/mke2fs.conf $(DATADIR)/lib
$(INSTALL_PROGRAM) api/*.{t,py} $(DATADIR)/api
+ $(INSTALL_PROGRAM) unit/unit-test $(DATADIR)/unit
$(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
$(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
cd lib && $(INSTALL_DATA) \
6 years, 1 month
master - tests: add unit-test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4c7565b65d0a02f6dee...
Commit: 4c7565b65d0a02f6deedd37e1274b8646997fa71
Parent: fa8d0b57660b9788d75b554eaeadb9725f522011
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 17:28:50 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
tests: add unit-test
Allow unit-test to be run as part of standard 'make check'.
---
test/unit/unit-test.sh | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/test/unit/unit-test.sh b/test/unit/unit-test.sh
new file mode 100644
index 0000000..e8332d6
--- /dev/null
+++ b/test/unit/unit-test.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_LVMETAD=1
+SKIP_WITH_CLVMD=1
+
+SKIP_ROOT_DM_CHECK=1
+
+. lib/inittest
+
+aux unittest run
6 years, 1 month
master - tests: detect running bcache test on tmpfs
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fa8d0b57660b9788d75...
Commit: fa8d0b57660b9788d75b554eaeadb9725f522011
Parent: 79b296139947c43aaf9cc70ae8caf66c1f89f4a6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 11 23:02:10 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
tests: detect running bcache test on tmpfs
When test happens to run in tmpfs, it cannot use O_DIRECT (unsupported
with tmpfs).
CHECKME: unsure if detection of tmpfs is 'valid' but kind of works and
is very simple.
---
test/unit/bcache_utils_t.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/test/unit/bcache_utils_t.c b/test/unit/bcache_utils_t.c
index 4f15591..e5e66d5 100644
--- a/test/unit/bcache_utils_t.c
+++ b/test/unit/bcache_utils_t.c
@@ -14,6 +14,10 @@
#define _GNU_SOURCE
+#include "bcache.h"
+#include "framework.h"
+#include "units.h"
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -21,10 +25,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-
-#include "bcache.h"
-#include "framework.h"
-#include "units.h"
+#include <sys/statvfs.h>
//----------------------------------------------------------------
@@ -53,6 +54,16 @@ static void *_fix_init(struct io_engine *engine)
uint8_t buffer[T_BLOCK_SIZE];
struct fixture *f = malloc(sizeof(*f));
unsigned b, i;
+ struct statvfs fsdata;
+ static int _runs_is_tmpfs = -1;
+
+ if (_runs_is_tmpfs == -1) {
+ // With testing in tmpfs directory O_DIRECT cannot be used
+ // tmpfs has f_fsid == 0 (unsure if this is best guess)
+ _runs_is_tmpfs = (statvfs(".", &fsdata) == 0 && !fsdata.f_fsid) ? 1 : 0;
+ if (_runs_is_tmpfs)
+ printf(" Running test in tmpfs, *NOT* using O_DIRECT\n");
+ }
T_ASSERT(f);
@@ -65,11 +76,13 @@ static void *_fix_init(struct io_engine *engine)
buffer[i] = _pattern_at(INIT_PATTERN, byte(b, i));
T_ASSERT(write(f->fd, buffer, T_BLOCK_SIZE) > 0);
}
- close(f->fd);
- // reopen with O_DIRECT
- f->fd = open(f->fname, O_RDWR | O_DIRECT);
- T_ASSERT(f->fd >= 0);
+ if (!_runs_is_tmpfs) {
+ close(f->fd);
+ // reopen with O_DIRECT
+ f->fd = open(f->fname, O_RDWR | O_DIRECT);
+ T_ASSERT(f->fd >= 0);
+ }
f->cache = bcache_create(T_BLOCK_SIZE / 512, NR_BLOCKS, engine);
T_ASSERT(f->cache);
6 years, 1 month
master - build: rename device-mapper to device_mapper
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=79b296139947c43aaf9...
Commit: 79b296139947c43aaf9cc70ae8caf66c1f89f4a6
Parent: e2c766d37e20231db48e55edb5e23973df590569
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 11 18:55:55 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
build: rename device-mapper to device_mapper
As Makefiles already do use target with name 'device-mapper'
rename this new device-mapper dir to non-conflicting name.
We also seem to already use '_' in other dir names.
Also rename device_mapper/Makefile to source for generating Makefile.in
so we can use it for build in other source dirs properly.
---
Makefile.in | 8 +-
configure | 3 +-
configure.ac | 1 +
device-mapper/Makefile | 20 ----
device-mapper/vdo/status.c | 248 --------------------------------------------
device-mapper/vdo/target.h | 68 ------------
device_mapper/Makefile.in | 23 ++++
device_mapper/vdo/status.c | 248 ++++++++++++++++++++++++++++++++++++++++++++
device_mapper/vdo/target.h | 68 ++++++++++++
test/unit/Makefile.in | 2 +-
test/unit/vdo_t.c | 2 +-
11 files changed, 348 insertions(+), 343 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index b0bceb0..c2d5122 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,7 +18,7 @@ top_builddir = @top_builddir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
-SUBDIRS = conf daemons include lib libdaemon libdm man scripts tools
+SUBDIRS = conf daemons include lib libdaemon libdm man scripts device_mapper tools
ifeq ("@UDEV_RULES@", "yes")
SUBDIRS += udev
@@ -43,7 +43,7 @@ endif
ifeq ($(MAKECMDGOALS),distclean)
SUBDIRS = conf include man test scripts \
libdaemon lib tools daemons libdm \
- udev po liblvm python
+ udev po liblvm python device_mapper
tools.distclean: test.distclean
endif
DISTCLEAN_DIRS += lcov_reports*
@@ -61,7 +61,7 @@ po: tools daemons
man: tools
all_man: tools
scripts: liblvm libdm
-test: lib
+test: tools daemons
unit-test: lib
run-unit-test: unit-test
@@ -99,7 +99,7 @@ endif
DISTCLEAN_TARGETS += cscope.out
CLEAN_DIRS += autom4te.cache
-check check_system check_cluster check_local check_lvmetad check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock unit-test run-unit-test: all
+check check_system check_cluster check_local check_lvmetad check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock unit-test run-unit-test: test
$(MAKE) -C test $(@)
conf.generate man.generate: tools
diff --git a/configure b/configure
index e874932..ed00809 100755
--- a/configure
+++ b/configure
@@ -15559,7 +15559,7 @@ _ACEOF
################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/locking/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/
Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lv
m2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile device_mapper/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/locking/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/
libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_
init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -16276,6 +16276,7 @@ do
"daemons/lvmetad/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmetad/Makefile" ;;
"daemons/lvmpolld/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmpolld/Makefile" ;;
"daemons/lvmlockd/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmlockd/Makefile" ;;
+ "device_mapper/Makefile") CONFIG_FILES="$CONFIG_FILES device_mapper/Makefile" ;;
"conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
"conf/example.conf") CONFIG_FILES="$CONFIG_FILES conf/example.conf" ;;
"conf/lvmlocal.conf") CONFIG_FILES="$CONFIG_FILES conf/lvmlocal.conf" ;;
diff --git a/configure.ac b/configure.ac
index 5738b05..41e612f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2108,6 +2108,7 @@ daemons/lvmdbusd/path.py
daemons/lvmetad/Makefile
daemons/lvmpolld/Makefile
daemons/lvmlockd/Makefile
+device_mapper/Makefile
conf/Makefile
conf/example.conf
conf/lvmlocal.conf
diff --git a/device-mapper/Makefile b/device-mapper/Makefile
deleted file mode 100644
index 76e19f0..0000000
--- a/device-mapper/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
-#
-# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-DM_SOURCE=\
- device-mapper/vdo/status.c
-
-DM_DEPENDS=$(subst .c,.d,$(DM_SOURCE))
-DM_OBJECTS=$(DM_SOURCE:%.c=%.o)
-CLEAN_TARGETS+=$(DM_DEPENDS) $(DM_OBJECTS)
-
--include $(DM_DEPENDS)
diff --git a/device-mapper/vdo/status.c b/device-mapper/vdo/status.c
deleted file mode 100644
index 157111f..0000000
--- a/device-mapper/vdo/status.c
+++ /dev/null
@@ -1,248 +0,0 @@
-#include "target.h"
-
-// For DM_ARRAY_SIZE!
-#include "libdevmapper.h"
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-//----------------------------------------------------------------
-
-static char *_tok_cpy(const char *b, const char *e)
-{
- char *new = malloc((e - b) + 1);
- char *ptr = new;
-
- if (new) {
- while (b != e)
- *ptr++ = *b++;
- *ptr = '\0';
- }
-
- return new;
-}
-
-static bool _tok_eq(const char *b, const char *e, const char *str)
-{
- while (b != e) {
- if (!*str || *b != *str)
- return false;
-
- b++;
- str++;
- }
-
- return !*str;
-}
-
-static bool _parse_operating_mode(const char *b, const char *e, void *context)
-{
- static struct {
- const char *str;
- enum vdo_operating_mode mode;
- } _table[] = {
- {"recovering", VDO_MODE_RECOVERING},
- {"read-only", VDO_MODE_READ_ONLY},
- {"normal", VDO_MODE_NORMAL}
- };
-
- enum vdo_operating_mode *r = context;
- unsigned i;
- for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
- if (_tok_eq(b, e, _table[i].str)) {
- *r = _table[i].mode;
- return true;
- }
- }
-
- return false;
-}
-
-static bool _parse_compression_state(const char *b, const char *e, void *context)
-{
- static struct {
- const char *str;
- enum vdo_compression_state state;
- } _table[] = {
- {"online", VDO_COMPRESSION_ONLINE},
- {"offline", VDO_COMPRESSION_OFFLINE}
- };
-
- enum vdo_compression_state *r = context;
- unsigned i;
- for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
- if (_tok_eq(b, e, _table[i].str)) {
- *r = _table[i].state;
- return true;
- }
- }
-
- return false;
-}
-
-static bool _parse_recovering(const char *b, const char *e, void *context)
-{
- bool *r = context;
-
- if (_tok_eq(b, e, "recovering"))
- *r = true;
-
- else if (_tok_eq(b, e, "-"))
- *r = false;
-
- else
- return false;
-
- return true;
-}
-
-static bool _parse_index_state(const char *b, const char *e, void *context)
-{
- static struct {
- const char *str;
- enum vdo_index_state state;
- } _table[] = {
- {"error", VDO_INDEX_ERROR},
- {"closed", VDO_INDEX_CLOSED},
- {"opening", VDO_INDEX_OPENING},
- {"closing", VDO_INDEX_CLOSING},
- {"offline", VDO_INDEX_OFFLINE},
- {"online", VDO_INDEX_ONLINE},
- {"unknown", VDO_INDEX_UNKNOWN}
- };
-
- enum vdo_index_state *r = context;
- unsigned i;
- for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
- if (_tok_eq(b, e, _table[i].str)) {
- *r = _table[i].state;
- return true;
- }
- }
-
- return false;
-}
-
-static bool _parse_uint64(const char *b, const char *e, void *context)
-{
- uint64_t *r = context, n;
-
- n = 0;
- while (b != e) {
- if (!isdigit(*b))
- return false;
-
- n = (n * 10) + (*b - '0');
- b++;
- }
-
- *r = n;
- return true;
-}
-
-static const char *_eat_space(const char *b, const char *e)
-{
- while (b != e && isspace(*b))
- b++;
-
- return b;
-}
-
-static const char *_next_tok(const char *b, const char *e)
-{
- const char *te = b;
- while (te != e && !isspace(*te))
- te++;
-
- return te == b ? NULL : te;
-}
-
-static void _set_error(struct vdo_status_parse_result *result, const char *fmt, ...)
- __attribute__ ((format(printf, 2, 3)));
-
-static void _set_error(struct vdo_status_parse_result *result, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(result->error, sizeof(result->error), fmt, ap);
- va_end(ap);
-}
-
-static bool _parse_field(const char **b, const char *e,
- bool (*p_fn)(const char *, const char *, void *),
- void *field, const char *field_name,
- struct vdo_status_parse_result *result)
-{
- const char *te;
-
- te = _next_tok(*b, e);
- if (!te) {
- _set_error(result, "couldn't get token for '%s'", field_name);
- return false;
- }
-
- if (!p_fn(*b, te, field)) {
- _set_error(result, "couldn't parse '%s'", field_name);
- return false;
- }
-
- *b = _eat_space(te, e);
- return true;
-
-}
-
-bool vdo_status_parse(const char *input, struct vdo_status_parse_result *result)
-{
- const char *b = b = input;
- const char *e = input + strlen(input);
- const char *te;
- struct vdo_status *s = malloc(sizeof(*s));
-
- if (!s) {
- _set_error(result, "out of memory");
- return false;
- }
-
- b = _eat_space(b, e);
- te = _next_tok(b, e);
- if (!te) {
- _set_error(result, "couldn't get token for device");
- free(s);
- return false;
- }
-
- s->device = _tok_cpy(b, te);
- if (!s->device) {
- _set_error(result, "out of memory");
- free(s);
- return false;
- }
-
- b = _eat_space(te, e);
-
-#define XX(p, f, fn) if (!_parse_field(&b, e, p, f, fn, result)) goto bad;
- XX(_parse_operating_mode, &s->operating_mode, "operating mode");
- XX(_parse_recovering, &s->recovering, "recovering");
- XX(_parse_index_state, &s->index_state, "index state");
- XX(_parse_compression_state, &s->compression_state, "compression state");
- XX(_parse_uint64, &s->used_blocks, "used blocks");
- XX(_parse_uint64, &s->total_blocks, "total blocks");
-#undef XX
-
- if (b != e) {
- _set_error(result, "too many tokens");
- goto bad;
- }
-
- result->status = s;
- return true;
-
-bad:
- free(s->device);
- free(s);
- return false;
-}
-
-//----------------------------------------------------------------
diff --git a/device-mapper/vdo/target.h b/device-mapper/vdo/target.h
deleted file mode 100644
index 3137e2c..0000000
--- a/device-mapper/vdo/target.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
- *
- * This file is part of the device-mapper userspace tools.
- *
- * 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 Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef DEVICE_MAPPER_VDO_TARGET_H
-#define DEVICE_MAPPER_VDO_TARGET_H
-
-#include <stdbool.h>
-#include <stdint.h>
-
-//----------------------------------------------------------------
-
-enum vdo_operating_mode {
- VDO_MODE_RECOVERING,
- VDO_MODE_READ_ONLY,
- VDO_MODE_NORMAL
-};
-
-enum vdo_compression_state {
- VDO_COMPRESSION_ONLINE,
- VDO_COMPRESSION_OFFLINE
-};
-
-enum vdo_index_state {
- VDO_INDEX_ERROR,
- VDO_INDEX_CLOSED,
- VDO_INDEX_OPENING,
- VDO_INDEX_CLOSING,
- VDO_INDEX_OFFLINE,
- VDO_INDEX_ONLINE,
- VDO_INDEX_UNKNOWN
-};
-
-struct vdo_status {
- char *device;
- enum vdo_operating_mode operating_mode;
- bool recovering;
- enum vdo_index_state index_state;
- enum vdo_compression_state compression_state;
- uint64_t used_blocks;
- uint64_t total_blocks;
-};
-
-void vdo_status_destroy(struct vdo_status *s);
-
-#define VDO_MAX_ERROR 256
-
-struct vdo_status_parse_result {
- char error[VDO_MAX_ERROR];
- struct vdo_status *status;
-};
-
-// Parses the status line from the kernel target.
-bool vdo_status_parse(const char *input, struct vdo_status_parse_result *result);
-
-//----------------------------------------------------------------
-
-#endif
diff --git a/device_mapper/Makefile.in b/device_mapper/Makefile.in
new file mode 100644
index 0000000..8d914ff
--- /dev/null
+++ b/device_mapper/Makefile.in
@@ -0,0 +1,23 @@
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+SOURCES=\
+ vdo/status.c
+
+include $(top_builddir)/make.tmpl
+
+LIB_NAME = libdevicemapper
+LIB_STATIC = $(LIB_NAME).a
diff --git a/device_mapper/vdo/status.c b/device_mapper/vdo/status.c
new file mode 100644
index 0000000..157111f
--- /dev/null
+++ b/device_mapper/vdo/status.c
@@ -0,0 +1,248 @@
+#include "target.h"
+
+// For DM_ARRAY_SIZE!
+#include "libdevmapper.h"
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+//----------------------------------------------------------------
+
+static char *_tok_cpy(const char *b, const char *e)
+{
+ char *new = malloc((e - b) + 1);
+ char *ptr = new;
+
+ if (new) {
+ while (b != e)
+ *ptr++ = *b++;
+ *ptr = '\0';
+ }
+
+ return new;
+}
+
+static bool _tok_eq(const char *b, const char *e, const char *str)
+{
+ while (b != e) {
+ if (!*str || *b != *str)
+ return false;
+
+ b++;
+ str++;
+ }
+
+ return !*str;
+}
+
+static bool _parse_operating_mode(const char *b, const char *e, void *context)
+{
+ static struct {
+ const char *str;
+ enum vdo_operating_mode mode;
+ } _table[] = {
+ {"recovering", VDO_MODE_RECOVERING},
+ {"read-only", VDO_MODE_READ_ONLY},
+ {"normal", VDO_MODE_NORMAL}
+ };
+
+ enum vdo_operating_mode *r = context;
+ unsigned i;
+ for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
+ if (_tok_eq(b, e, _table[i].str)) {
+ *r = _table[i].mode;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool _parse_compression_state(const char *b, const char *e, void *context)
+{
+ static struct {
+ const char *str;
+ enum vdo_compression_state state;
+ } _table[] = {
+ {"online", VDO_COMPRESSION_ONLINE},
+ {"offline", VDO_COMPRESSION_OFFLINE}
+ };
+
+ enum vdo_compression_state *r = context;
+ unsigned i;
+ for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
+ if (_tok_eq(b, e, _table[i].str)) {
+ *r = _table[i].state;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool _parse_recovering(const char *b, const char *e, void *context)
+{
+ bool *r = context;
+
+ if (_tok_eq(b, e, "recovering"))
+ *r = true;
+
+ else if (_tok_eq(b, e, "-"))
+ *r = false;
+
+ else
+ return false;
+
+ return true;
+}
+
+static bool _parse_index_state(const char *b, const char *e, void *context)
+{
+ static struct {
+ const char *str;
+ enum vdo_index_state state;
+ } _table[] = {
+ {"error", VDO_INDEX_ERROR},
+ {"closed", VDO_INDEX_CLOSED},
+ {"opening", VDO_INDEX_OPENING},
+ {"closing", VDO_INDEX_CLOSING},
+ {"offline", VDO_INDEX_OFFLINE},
+ {"online", VDO_INDEX_ONLINE},
+ {"unknown", VDO_INDEX_UNKNOWN}
+ };
+
+ enum vdo_index_state *r = context;
+ unsigned i;
+ for (i = 0; i < DM_ARRAY_SIZE(_table); i++) {
+ if (_tok_eq(b, e, _table[i].str)) {
+ *r = _table[i].state;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool _parse_uint64(const char *b, const char *e, void *context)
+{
+ uint64_t *r = context, n;
+
+ n = 0;
+ while (b != e) {
+ if (!isdigit(*b))
+ return false;
+
+ n = (n * 10) + (*b - '0');
+ b++;
+ }
+
+ *r = n;
+ return true;
+}
+
+static const char *_eat_space(const char *b, const char *e)
+{
+ while (b != e && isspace(*b))
+ b++;
+
+ return b;
+}
+
+static const char *_next_tok(const char *b, const char *e)
+{
+ const char *te = b;
+ while (te != e && !isspace(*te))
+ te++;
+
+ return te == b ? NULL : te;
+}
+
+static void _set_error(struct vdo_status_parse_result *result, const char *fmt, ...)
+ __attribute__ ((format(printf, 2, 3)));
+
+static void _set_error(struct vdo_status_parse_result *result, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsnprintf(result->error, sizeof(result->error), fmt, ap);
+ va_end(ap);
+}
+
+static bool _parse_field(const char **b, const char *e,
+ bool (*p_fn)(const char *, const char *, void *),
+ void *field, const char *field_name,
+ struct vdo_status_parse_result *result)
+{
+ const char *te;
+
+ te = _next_tok(*b, e);
+ if (!te) {
+ _set_error(result, "couldn't get token for '%s'", field_name);
+ return false;
+ }
+
+ if (!p_fn(*b, te, field)) {
+ _set_error(result, "couldn't parse '%s'", field_name);
+ return false;
+ }
+
+ *b = _eat_space(te, e);
+ return true;
+
+}
+
+bool vdo_status_parse(const char *input, struct vdo_status_parse_result *result)
+{
+ const char *b = b = input;
+ const char *e = input + strlen(input);
+ const char *te;
+ struct vdo_status *s = malloc(sizeof(*s));
+
+ if (!s) {
+ _set_error(result, "out of memory");
+ return false;
+ }
+
+ b = _eat_space(b, e);
+ te = _next_tok(b, e);
+ if (!te) {
+ _set_error(result, "couldn't get token for device");
+ free(s);
+ return false;
+ }
+
+ s->device = _tok_cpy(b, te);
+ if (!s->device) {
+ _set_error(result, "out of memory");
+ free(s);
+ return false;
+ }
+
+ b = _eat_space(te, e);
+
+#define XX(p, f, fn) if (!_parse_field(&b, e, p, f, fn, result)) goto bad;
+ XX(_parse_operating_mode, &s->operating_mode, "operating mode");
+ XX(_parse_recovering, &s->recovering, "recovering");
+ XX(_parse_index_state, &s->index_state, "index state");
+ XX(_parse_compression_state, &s->compression_state, "compression state");
+ XX(_parse_uint64, &s->used_blocks, "used blocks");
+ XX(_parse_uint64, &s->total_blocks, "total blocks");
+#undef XX
+
+ if (b != e) {
+ _set_error(result, "too many tokens");
+ goto bad;
+ }
+
+ result->status = s;
+ return true;
+
+bad:
+ free(s->device);
+ free(s);
+ return false;
+}
+
+//----------------------------------------------------------------
diff --git a/device_mapper/vdo/target.h b/device_mapper/vdo/target.h
new file mode 100644
index 0000000..3137e2c
--- /dev/null
+++ b/device_mapper/vdo/target.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of the device-mapper userspace tools.
+ *
+ * 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 Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef DEVICE_MAPPER_VDO_TARGET_H
+#define DEVICE_MAPPER_VDO_TARGET_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+//----------------------------------------------------------------
+
+enum vdo_operating_mode {
+ VDO_MODE_RECOVERING,
+ VDO_MODE_READ_ONLY,
+ VDO_MODE_NORMAL
+};
+
+enum vdo_compression_state {
+ VDO_COMPRESSION_ONLINE,
+ VDO_COMPRESSION_OFFLINE
+};
+
+enum vdo_index_state {
+ VDO_INDEX_ERROR,
+ VDO_INDEX_CLOSED,
+ VDO_INDEX_OPENING,
+ VDO_INDEX_CLOSING,
+ VDO_INDEX_OFFLINE,
+ VDO_INDEX_ONLINE,
+ VDO_INDEX_UNKNOWN
+};
+
+struct vdo_status {
+ char *device;
+ enum vdo_operating_mode operating_mode;
+ bool recovering;
+ enum vdo_index_state index_state;
+ enum vdo_compression_state compression_state;
+ uint64_t used_blocks;
+ uint64_t total_blocks;
+};
+
+void vdo_status_destroy(struct vdo_status *s);
+
+#define VDO_MAX_ERROR 256
+
+struct vdo_status_parse_result {
+ char error[VDO_MAX_ERROR];
+ struct vdo_status *status;
+};
+
+// Parses the status line from the kernel target.
+bool vdo_status_parse(const char *input, struct vdo_status_parse_result *result);
+
+//----------------------------------------------------------------
+
+#endif
diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in
index 017afaa..cb92fb1 100644
--- a/test/unit/Makefile.in
+++ b/test/unit/Makefile.in
@@ -40,7 +40,7 @@ TARGETS += unit-test
# via usage of vpath
vpath %.c \
$(top_srcdir)/base/data-struct \
- $(top_srcdir)/device-mapper/vdo
+ $(top_srcdir)/device_mapper/vdo
include $(top_builddir)/make.tmpl
diff --git a/test/unit/vdo_t.c b/test/unit/vdo_t.c
index 21ecd1a..9c41887 100644
--- a/test/unit/vdo_t.c
+++ b/test/unit/vdo_t.c
@@ -12,7 +12,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "device-mapper/vdo/target.h"
+#include "device_mapper/vdo/target.h"
#include "framework.h"
#include "units.h"
6 years, 1 month
master - build: fix build rules for srcdir
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e2c766d37e20231db48...
Commit: e2c766d37e20231db48e55edb5e23973df590569
Parent: ac768a9d2baca83bd9043d4d36f8e436894d29f7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 18:14:53 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
build: fix build rules for srcdir
It's very hard to use some 'non-recurive' Makefiles with
rest of system running 'recursively'.
So ATM drop inclusion of subdir makefile and add support
for 2 new top-level targets:
unit-test (builds test/unit dir)
run-unit-test (build & run test/unit/unit-test run)
---
Makefile.in | 13 ++++-----
test/Makefile.in | 10 +++++--
test/unit/Makefile.in | 67 ++++++++++++++++++++++++++++--------------------
3 files changed, 52 insertions(+), 38 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 3274f17..b0bceb0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -61,6 +61,9 @@ po: tools daemons
man: tools
all_man: tools
scripts: liblvm libdm
+test: lib
+unit-test: lib
+run-unit-test: unit-test
lib.device-mapper: include.device-mapper
libdm.device-mapper: include.device-mapper
@@ -96,7 +99,7 @@ endif
DISTCLEAN_TARGETS += cscope.out
CLEAN_DIRS += autom4te.cache
-check check_system check_cluster check_local check_lvmetad check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock: all
+check check_system check_cluster check_local check_lvmetad check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock unit-test run-unit-test: all
$(MAKE) -C test $(@)
conf.generate man.generate: tools
@@ -145,7 +148,7 @@ install_system_dirs:
$(INSTALL_ROOT_DIR) $(DESTDIR)$(DEFAULT_RUN_DIR)
$(INSTALL_ROOT_DATA) /dev/null $(DESTDIR)$(DEFAULT_CACHE_DIR)/.cache
-install_initscripts:
+install_initscripts:
$(MAKE) -C scripts install_initscripts
install_systemd_generators:
@@ -210,10 +213,6 @@ endif
endif
-include test/unit/Makefile
-
-include device-mapper/Makefile
-
ifneq ($(shell which ctags),)
.PHONY: tags
tags:
diff --git a/test/Makefile.in b/test/Makefile.in
index de8e3a1..67f2753 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -27,7 +27,7 @@ datarootdir = @datarootdir@
LVM_TEST_RESULTS ?= results
-SUBDIRS = api
+SUBDIRS = api unit
SOURCES = lib/not.c lib/harness.c
CXXSOURCES = lib/runner.cpp
CXXFLAGS += $(EXTRA_EXEC_CFLAGS)
@@ -37,9 +37,9 @@ 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 \) | $(SORT))
+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 \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
+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))
ifeq ("@BUILD_LVMETAD@", "yes")
@@ -83,6 +83,7 @@ help:
@echo " check_lvmlockd_sanlock Run tests with lvmlockd and sanlock."
@echo " check_lvmlockd_dlm Run tests with lvmlockd and dlm."
@echo " check_lvmlockd_test Run tests with lvmlockd --test."
+ @echo " run-unit-test Run only unit tests (root not needed)."
@echo " clean Clean dir."
@echo " help Display callable targets."
@echo -e "\nSupported variables:"
@@ -190,6 +191,9 @@ check_lvmlockd_test: .tests-stamp
--flavours udev-lvmlockd-test --only $(T) --skip $(S)
endif
+run-unit-test unit-test:
+ $(MAKE) -C unit $(@)
+
DATADIR = $(datadir)/lvm2-testsuite
EXECDIR = $(libexecdir)/lvm2-testsuite
diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in
index 9d18608..017afaa 100644
--- a/test/unit/Makefile.in
+++ b/test/unit/Makefile.in
@@ -10,38 +10,49 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-UNIT_SOURCE=\
- base/data-struct/radix-tree.c \
- device-mapper/vdo/status.c \
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+SOURCES=\
+ radix-tree.c \
+ status.c \
\
- test/unit/bcache_t.c \
- test/unit/bcache_utils_t.c \
- test/unit/bitset_t.c \
- test/unit/config_t.c \
- test/unit/dmlist_t.c \
- test/unit/dmstatus_t.c \
- test/unit/io_engine_t.c \
- test/unit/radix_tree_t.c \
- test/unit/matcher_t.c \
- test/unit/framework.c \
- test/unit/percent_t.c \
- test/unit/run.c \
- test/unit/string_t.c \
- test/unit/vdo_t.c
-
-UNIT_DEPENDS=$(subst .c,.d,$(UNIT_SOURCE))
-UNIT_OBJECTS=$(UNIT_SOURCE:%.c=%.o)
-CLEAN_TARGETS+=$(UNIT_DEPENDS) $(UNIT_OBJECTS)
+ bcache_t.c \
+ bcache_utils_t.c \
+ bitset_t.c \
+ config_t.c \
+ dmlist_t.c \
+ dmstatus_t.c \
+ framework.c \
+ io_engine_t.c \
+ matcher_t.c \
+ percent_t.c \
+ radix_tree_t.c \
+ run.c \
+ string_t.c \
+ vdo_t.c
+
+TARGETS += unit-test
+
+# Using vpath for other src dirs
+# FIXME: hopefully later we will just link libs without need to extract sources
+# via usage of vpath
+vpath %.c \
+ $(top_srcdir)/base/data-struct \
+ $(top_srcdir)/device-mapper/vdo
+
+include $(top_builddir)/make.tmpl
+
UNIT_LDLIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio
+INCLUDES += -I$(top_srcdir)
-test/unit/unit-test: $(UNIT_OBJECTS) libdm/libdevmapper.$(LIB_SUFFIX) lib/liblvm-internal.a
+unit-test: $(OBJECTS) $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX) $(top_builddir)/lib/liblvm-internal.a
@echo " [LD] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
- -o $@ $(UNIT_OBJECTS) $(UNIT_LDLIBS)
+ -o $@ $(OBJECTS) $(UNIT_LDLIBS)
-.PHONEY: run-unit-test
-run-unit-test: test/unit/unit-test
+.PHONY: run-unit-test
+run-unit-test: unit-test
@echo Running unit tests
- LD_LIBRARY_PATH=libdm test/unit/unit-test run
-
--include $(UNIT_DEPENDS)
+ LD_LIBRARY_PATH=$(top_builddir)/libdm ./unit-test run
6 years, 1 month
master - bcache: do not use libdm header files
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ac768a9d2baca83bd90...
Commit: ac768a9d2baca83bd9043d4d36f8e436894d29f7
Parent: 83e362cd32e4648fd386401bbdcd72374731dd67
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 11 18:41:44 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
bcache: do not use libdm header files
Logging for libdm differs from lvm logging - keep using consisten
logging function calls.
---
lib/device/bcache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 9085d87..f8ed7af 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -15,7 +15,7 @@
#define _GNU_SOURCE
#include "bcache.h"
-#include "dm-logging.h"
+#include "lvm-logging.h"
#include "log.h"
#include <errno.h>
6 years, 1 month
master - build: make generate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=83e362cd32e4648fd38...
Commit: 83e362cd32e4648fd386401bbdcd72374731dd67
Parent: 0b465d1543a46ba3994a0a53a08592f7a2838d35
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 12 17:02:34 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
build: make generate
---
conf/example.conf.in | 27 ++++-----------------------
man/lvconvert.8_pregen | 8 +++++---
man/pvcreate.8_pregen | 7 +++----
man/vgcfgrestore.8_pregen | 9 ++++-----
man/vgconvert.8_pregen | 14 +++++---------
man/vgcreate.8_pregen | 7 +++----
man/vgextend.8_pregen | 7 +++----
man/vgsplit.8_pregen | 7 +++----
8 files changed, 30 insertions(+), 56 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index aab274d..92af8d3 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -702,29 +702,17 @@ global {
activation = 1
# Configuration option global/fallback_to_lvm1.
- # Try running LVM1 tools if LVM cannot communicate with DM.
- # This option only applies to 2.4 kernels and is provided to help
- # switch between device-mapper kernels and LVM1 kernels. The LVM1
- # tools need to be installed with .lvm1 suffices, e.g. vgscan.lvm1.
- # They will stop working once the lvm2 on-disk metadata format is used.
+ # This setting setting no longer used.
# This configuration option has an automatic default value.
- # fallback_to_lvm1 = @DEFAULT_FALLBACK_TO_LVM1@
+ # fallback_to_lvm1 = 0
# Configuration option global/format.
- # The default metadata format that commands should use.
- # The -M 1|2 option overrides this setting.
- #
- # Accepted values:
- # lvm1
- # lvm2
- #
+ # This setting is no longer used.
# This configuration option has an automatic default value.
# format = "lvm2"
# Configuration option global/format_libraries.
- # Shared libraries that process different metadata formats.
- # If support for LVM1 metadata was compiled as a shared library use
- # format_libraries = "liblvm2format1.so"
+ # This setting is no longer used.
# This configuration option does not have a default value defined.
# Configuration option global/segment_libraries.
@@ -821,13 +809,6 @@ global {
# encountered the internal error. Please only enable for debugging.
abort_on_internal_errors = 0
- # Configuration option global/detect_internal_vg_cache_corruption.
- # Internal verification of VG structures.
- # Check if CRC matches when a parsed VG is used multiple times. This
- # is useful to catch unexpected changes to cached VG structures.
- # Please only enable for debugging.
- detect_internal_vg_cache_corruption = 0
-
# Configuration option global/metadata_read_only.
# No operations that change on-disk metadata are permitted.
# Additionally, read-only commands that encounter metadata in need of
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index e0e38b9..91691a3 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -503,7 +503,7 @@ Merge LV images that were split from a raid1 LV.
Convert LV to a thin LV, using the original LV as an external origin.
.br
.P
-\fBlvconvert\fP \fB--type\fP \fBthin\fP \fB--thinpool\fP \fILV\fP \fILV\fP\fI_linear_striped_cache_raid\fP
+\fBlvconvert\fP \fB--type\fP \fBthin\fP \fB--thinpool\fP \fILV\fP \fILV\fP\fI_linear_striped_thin_cache_raid\fP
.br
.RS 4
.ad l
@@ -1530,7 +1530,7 @@ Convert LV to a thin LV, using the original LV as an external origin
(infers --type thin).
.br
.P
-\fBlvconvert\fP \fB-T\fP|\fB--thin\fP \fB--thinpool\fP \fILV\fP \fILV\fP\fI_linear_striped_cache_raid\fP
+\fBlvconvert\fP \fB-T\fP|\fB--thin\fP \fB--thinpool\fP \fILV\fP \fILV\fP\fI_linear_striped_thin_cache_raid\fP
.br
.RS 4
.ad l
@@ -1714,7 +1714,9 @@ origin LV (first arg) to reverse a splitsnapshot command.
.br
-
-Poll LV to continue conversion (also see --startpoll).
+Poll LV to continue conversion (also see --startpoll)
+.br
+or waits till conversion/mirror syncing is finished
.br
.P
\fBlvconvert\fP \fILV\fP\fI_mirror_raid\fP
diff --git a/man/pvcreate.8_pregen b/man/pvcreate.8_pregen
index abceb82..c4b03da 100644
--- a/man/pvcreate.8_pregen
+++ b/man/pvcreate.8_pregen
@@ -38,7 +38,7 @@ normally prevent it, e.g. if the PV is already in a VG.
.ad b
.br
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -266,12 +266,11 @@ The size may be rounded.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
diff --git a/man/vgcfgrestore.8_pregen b/man/vgcfgrestore.8_pregen
index e028103..cffd44b 100644
--- a/man/vgcfgrestore.8_pregen
+++ b/man/vgcfgrestore.8_pregen
@@ -51,7 +51,7 @@ vgcfgrestore - Restore volume group configuration
.ad b
.br
.ad l
- \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.ad b
.br
.ad l
@@ -141,7 +141,7 @@ Common options for command:
.
.RS 4
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -280,12 +280,11 @@ Display long help text.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
diff --git a/man/vgconvert.8_pregen b/man/vgconvert.8_pregen
index 6228087..5e7f8a9 100644
--- a/man/vgconvert.8_pregen
+++ b/man/vgconvert.8_pregen
@@ -8,12 +8,9 @@ vgconvert - Change volume group metadata format
[ \fIoption_args\fP ]
.br
.SH DESCRIPTION
-vgconvert converts VG metadata from one format to another. The new
-metadata format must be able to fit into the space provided by the old
+vgconvert converts VG metadata from one format to another. This command
+is no longer used because this version of lvm no longer supports the LVM1
format.
-
-Because the LVM1 format should no longer be used, this command is no
-longer needed in general.
.SH USAGE
\fBvgconvert\fP \fIVG\fP ...
.br
@@ -23,7 +20,7 @@ longer needed in general.
.ad b
.br
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -194,12 +191,11 @@ The size may be rounded.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
diff --git a/man/vgcreate.8_pregen b/man/vgcreate.8_pregen
index ddad391..09bf126 100644
--- a/man/vgcreate.8_pregen
+++ b/man/vgcreate.8_pregen
@@ -33,7 +33,7 @@ devices are also available with vgcreate.
.ad b
.br
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -324,12 +324,11 @@ The size may be rounded.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
diff --git a/man/vgextend.8_pregen b/man/vgextend.8_pregen
index ee805a8..a6a30e9 100644
--- a/man/vgextend.8_pregen
+++ b/man/vgextend.8_pregen
@@ -36,7 +36,7 @@ will initialize them. In this case pvcreate options can be used, e.g.
.ad b
.br
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -237,12 +237,11 @@ The size may be rounded.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
diff --git a/man/vgsplit.8_pregen b/man/vgsplit.8_pregen
index 210c266..6c3e6ec 100644
--- a/man/vgsplit.8_pregen
+++ b/man/vgsplit.8_pregen
@@ -62,7 +62,7 @@ Common options for command:
.ad b
.br
.ad l
-[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP ]
+[ \fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP ]
.ad b
.br
.ad l
@@ -230,12 +230,11 @@ and --vgmetadatacopies for improving performance.
.ad b
.HP
.ad l
-\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP|\fBlvm1\fP
+\fB-M\fP|\fB--metadatatype\fP \fBlvm2\fP
.br
Specifies the type of on-disk metadata to use.
\fBlvm2\fP (or just \fB2\fP) is the current, standard format.
-\fBlvm1\fP (or just \fB1\fP) is a historical format that
-can be used for accessing old data.
+\fBlvm1\fP (or just \fB1\fP) is no longer used.
.ad b
.HP
.ad l
6 years, 1 month
master - tests: drop cache checking
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0b465d1543a46ba3994...
Commit: 0b465d1543a46ba3994a0a53a08592f7a2838d35
Parent: d38a2d64f0cddc951774b63d56b2fb5d9afb336e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon May 7 11:53:41 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat May 12 18:18:23 2018 +0200
tests: drop cache checking
Just like 52656c89fd6e7655b0599e20f90cc9d70561f1fb
when now cache is compiled in 'unditionally'.
This patch is actually enforce by changes in
commit: 2bc896f2a3a0023a4f45f10da3d0a22295a633ee
where CACHE value is not set anymore.
---
test/lib/aux.sh | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 977e917..adfad3b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1556,10 +1556,6 @@ have_raid4 () {
}
have_cache() {
- test "$CACHE" = shared -o "$CACHE" = internal || {
- echo "Cache is not built-in." >&2
- return 1;
- }
target_at_least dm-cache "$@"
declare -a CONF=()
6 years, 1 month