master - tests: missed char in list
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9e1ee07d696fb0a1771...
Commit: 9e1ee07d696fb0a1771f7dcd4490ed9ace0fa8d6
Parent: 015231b11ffedc8e44d74ef3a5204f1e99fc6813
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 17 10:41:25 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 17 10:41:25 2018 +0200
tests: missed char in list
'=' also doesn't belong to property name.
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index c75ca6d..a11eb3f 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1213,7 +1213,7 @@ EOF
echo "$s {"
local k
for k in $(grep ^"$s"/ "$config_values" | cut -f1 -d= | sed -e 's, *$,,' | sort | uniq); do
- grep "^$k[ \t]" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
+ grep "^$k[ \t=]" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
done
echo "}"
echo
5 years, 6 months
master - tests: better support for /var/run
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=015231b11ffedc8e44d...
Commit: 015231b11ffedc8e44d74ef3a5204f1e99fc6813
Parent: 32f1afbe36f6cc804a8f4e669af7c90639389811
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 23:46:50 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 23:49:35 2018 +0200
tests: better support for /var/run
---
test/shell/pvscan-autoactivate.sh | 52 ++++++++++++++++++++++---------------
test/shell/pvscan-nomda-bg.sh | 8 +++--
2 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/test/shell/pvscan-autoactivate.sh b/test/shell/pvscan-autoactivate.sh
index 85a08cf..5c5a3c6 100644
--- a/test/shell/pvscan-autoactivate.sh
+++ b/test/shell/pvscan-autoactivate.sh
@@ -19,11 +19,13 @@ aux prepare_pvs 2
vgcreate $vg1 "$dev1" "$dev2"
lvcreate -n $lv1 -l 4 -a n $vg1
-mkdir /run/lvm/pvs_online || true
+RUNDIR="/run"
+test -d "$RUNDIR" || RUNDIR="/var/run"
-# the first pvscan scans all devs
-
-rm /run/lvm/pvs_online/*
+# the first pvscan scans all devs
+# FIXME: kills logic for running system
+rm -rf "$RUNDIR/lvm/pvs_online"
+mkdir "$RUNDIR/lvm/pvs_online" || true
pvscan --cache -aay
check lv_field $vg1/$lv1 lv_active "active"
@@ -32,7 +34,8 @@ lvchange -an $vg1
# the first pvscan scans all devs even when
# only one device is specified
-rm /run/lvm/pvs_online/*
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active "active"
@@ -41,8 +44,9 @@ lvchange -an $vg1
# touch foo to disable first-pvscan case,
# then check pvscan with no args scans all
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache -aay
check lv_field $vg1/$lv1 lv_active "active"
@@ -52,8 +56,9 @@ lvchange -an $vg1
# then check that vg is activated only after
# both devs appear separately
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active ""
@@ -65,8 +70,9 @@ lvchange -an $vg1
# then check that vg is activated when both
# devs appear together
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache -aay "$dev1" "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
@@ -86,8 +92,9 @@ lvcreate -n $lv1 -l 4 -a n $vg1
# touch foo to disable first-pvscan case,
# test case where dev with metadata appears first
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active ""
@@ -99,8 +106,9 @@ lvchange -an $vg1
# test case where dev without metadata
# appears first which triggers scanning all
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active "active"
@@ -111,7 +119,8 @@ lvchange -an $vg1
# dev without metadata is scanned, but
# first-pvscan case scans all devs
-rm /run/lvm/pvs_online/*
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active "active"
@@ -121,8 +130,9 @@ lvchange -an $vg1
# is online without the -aay option to
# activate until after they are online
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache "$dev1"
check lv_field $vg1/$lv1 lv_active ""
@@ -134,12 +144,12 @@ lvchange -an $vg1
# like previous
-rm /run/lvm/pvs_online/*
-touch /run/lvm/pvs_online/foo
+# FIXME: kills logic for running system
+rm "$RUNDIR/lvm/pvs_online/*"
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache "$dev1"
check lv_field $vg1/$lv1 lv_active ""
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
-
diff --git a/test/shell/pvscan-nomda-bg.sh b/test/shell/pvscan-nomda-bg.sh
index d73f3da..1b6a176 100644
--- a/test/shell/pvscan-nomda-bg.sh
+++ b/test/shell/pvscan-nomda-bg.sh
@@ -24,10 +24,12 @@ lvcreate -n foo -l 1 -an --zero n $vg1
check inactive $vg1 foo
+RUNDIR="/run"
+test -d "$RUNDIR" || RUNDIR="/var/run"
# create a file in pvs_online to disable the pvscan init
# case which scans everything when the first dev appears.
-mkdir /run/lvm/pvs_online || true
-touch /run/lvm/pvs_online/foo
+mkdir "$RUNDIR/lvm/pvs_online" || true
+touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache --background "$dev2" -aay
@@ -37,5 +39,5 @@ pvscan --cache --background "$dev1" -aay
check active $vg1 foo
-rm /run/lvm/pvs_online/foo
+rm "$RUNDIR/lvm/pvs_online/foo"
vgremove -ff $vg1
5 years, 6 months
master - tests: add raid target presence check
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=32f1afbe36f6cc804a8...
Commit: 32f1afbe36f6cc804a8f4e669af7c90639389811
Parent: 69bebfd9587e2db292051501d1a1e83d4f4564a5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 23:44:15 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 23:49:35 2018 +0200
tests: add raid target presence check
---
test/shell/lvcreate-raid1-read-error.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvcreate-raid1-read-error.sh b/test/shell/lvcreate-raid1-read-error.sh
index 6907758..322c60e 100644
--- a/test/shell/lvcreate-raid1-read-error.sh
+++ b/test/shell/lvcreate-raid1-read-error.sh
@@ -14,6 +14,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+aux have_raid 1 3 0 || skip
+
# Test for MD raid1 kernel bug causing read
# errors on failing first leg sectors.
5 years, 6 months
master - tests: fix conf generation with older shells
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=69bebfd9587e2db2920...
Commit: 69bebfd9587e2db292051501d1a1e83d4f4564a5
Parent: f1ac72c84804aa1c00aa385caec9eb007fd39aee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 23:44:45 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 23:49:35 2018 +0200
tests: fix conf generation with older shells
For shells without array support, fix selecting bug,
and require keyword to end with some 'space' char,
so 'scan' is not matched with 'scan_var'.
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index c3aeb43..c75ca6d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1213,7 +1213,7 @@ EOF
echo "$s {"
local k
for k in $(grep ^"$s"/ "$config_values" | cut -f1 -d= | sed -e 's, *$,,' | sort | uniq); do
- grep "^$k" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
+ grep "^$k[ \t]" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
done
echo "}"
echo
5 years, 6 months
master - tests: fix tested targeted
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c15ac326cc29b5d91e7...
Commit: c15ac326cc29b5d91e726647d584c1b563c8c294
Parent: 05b57748274492aa76e530e4513e5f8e9a39a735
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 19:05:19 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 21:56:00 2018 +0200
tests: fix tested targeted
Fix cut&paste bug.
---
test/shell/profiles-vdo.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/profiles-vdo.sh b/test/shell/profiles-vdo.sh
index 4a0f07e..c870315 100644
--- a/test/shell/profiles-vdo.sh
+++ b/test/shell/profiles-vdo.sh
@@ -18,7 +18,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
-aux have_cache 1 8 0 || skip
+aux have_vdo 6 2 0 || skip
PDIR="$LVM_SYSTEM_DIR/profile"
PFILE="vdo-test"
5 years, 6 months
master - tests: properly enforce v1
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f1ac72c84804aa1c00a...
Commit: f1ac72c84804aa1c00aa385caec9eb007fd39aee
Parent: 4db228b9079386b9e24e0389a080f86ac3008e69
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 21:32:28 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 21:56:00 2018 +0200
tests: properly enforce v1
Since with smq policy we can still pick format v2 - enforce
format v1 explicitely.
---
test/shell/lvcreate-cache-no-tools.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvcreate-cache-no-tools.sh b/test/shell/lvcreate-cache-no-tools.sh
index 23528e4..253c8a5 100644
--- a/test/shell/lvcreate-cache-no-tools.sh
+++ b/test/shell/lvcreate-cache-no-tools.sh
@@ -94,9 +94,9 @@ lvremove -f $vg
fi
+# Enforce older cache target format V1
+aux lvmconf 'allocation/cache_metadata_format = 1'
-# On older cache target that supports only V1 format
-aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]'
rm -f fake-tool.sh
lvcreate -aey -l1 -n $lv1 $vg
5 years, 6 months
master - tests: timing without /usr/bin/time
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4db228b9079386b9e24...
Commit: 4db228b9079386b9e24e0389a080f86ac3008e69
Parent: c15ac326cc29b5d91e726647d584c1b563c8c294
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 20:03:21 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 21:56:00 2018 +0200
tests: timing without /usr/bin/time
Use just 'date' so the 'time' package doesn't need to be installed
just for this purpose.
---
test/shell/thin-many-dmeventd.sh | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/test/shell/thin-many-dmeventd.sh b/test/shell/thin-many-dmeventd.sh
index f73b516..a40c75a 100644
--- a/test/shell/thin-many-dmeventd.sh
+++ b/test/shell/thin-many-dmeventd.sh
@@ -54,10 +54,15 @@ sleep 9
# new thin-pool registration.
for i in $(seq 11 15)
do
- /usr/bin/time -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
- read -r t < TM
- test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
- # Fill thin-pool to some capacity >50%
+ #/usr/bin/time -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ #read -r t < TM
+ #test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
+ START=$(date +%s)
+ lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ END=$(date +%s)
+ DIFF=$(( END - START ))
+ test "$DIFF" -lt 8 || die "Creation of thin pool took more then 8 second! ($DIFF seconds)"
+ # Fill thin-pool to some capacity >50%
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
done
5 years, 6 months
master - cov: shutdown warning
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05b57748274492aa76e...
Commit: 05b57748274492aa76e530e4513e5f8e9a39a735
Parent: 6179cab877442aac884a0bfcd5c5541396980cdf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 21:46:44 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 21:55:19 2018 +0200
cov: shutdown warning
Since previous patch reverted coverity patch as this case is intentional,
provide override this coverity warning.
---
libdm/libdm-stats.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index e9bfa9d..0143957 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1009,6 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
+ /* coverity[alloc_strlen] intentional */
if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r")))
return_0;
@@ -1240,6 +1241,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
+ /* coverity[alloc_strlen] intentional */
stats_rows = fmemopen((char *)resp, strlen(resp), "r");
if (!stats_rows)
goto_bad;
5 years, 6 months
master - revert "cov: dm stats missed terminating null"
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6179cab877442aac884...
Commit: 6179cab877442aac884a0bfcd5c5541396980cdf
Parent: 2217d6396aa6f6b8bc6421487ed6686d94668c2e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 19:13:34 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 16 21:34:23 2018 +0200
revert "cov: dm stats missed terminating null"
This reverts commit 20971f7034cbd329f873e08869bfb7acf3f1ac0e
as the parsing of 'dmstatus' started to fail on present \0 char.
---
libdm/libdm-stats.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index ea8fdf2..e9bfa9d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1009,7 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- if (!(list_rows = fmemopen((char *)resp, strlen(resp) + 1, "r")))
+ if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r")))
return_0;
/* begin region table */
@@ -1240,7 +1240,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- stats_rows = fmemopen((char *)resp, strlen(resp) + 1, "r");
+ stats_rows = fmemopen((char *)resp, strlen(resp), "r");
if (!stats_rows)
goto_bad;
5 years, 6 months
master - fix: cov: missed return value test
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2217d6396aa6f6b8bc6...
Commit: 2217d6396aa6f6b8bc6421487ed6686d94668c2e
Parent: 06a4a356dbd320e23bd95e1feb045e91c63f3d51
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 15 11:35:33 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 15 11:53:28 2018 -0500
fix: cov: missed return value test
use the existing error paths
---
lib/format_text/format-text.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 5d8355e..b41f2b2 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -465,12 +465,12 @@ static struct raw_locn *_read_metadata_location_vg(struct device_area *dev_area,
memset(vgnamebuf, 0, sizeof(vgnamebuf));
if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, vgnamebuf))
- return_NULL;
+ goto fail;
if (!strncmp(vgnamebuf, vgname, len = strlen(vgname)) &&
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
return rlocn;
-
+ fail:
log_error("Metadata on %s at %llu has wrong VG name \"%s\" expected %s.",
dev_name(dev_area->dev),
(unsigned long long)(dev_area->start + rlocn->offset),
@@ -1439,7 +1439,7 @@ int read_metadata_location_summary(const struct format_type *fmt,
struct raw_locn *rlocn;
uint32_t wrap = 0;
unsigned int len = 0;
- char buf[NAME_LEN + 1] __attribute__((aligned(8)));
+ char namebuf[NAME_LEN + 1] __attribute__((aligned(8)));
uint64_t max_size;
if (!mdah) {
@@ -1468,20 +1468,22 @@ int read_metadata_location_summary(const struct format_type *fmt,
return 0;
}
- if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, buf))
- return_0;
+ memset(namebuf, 0, sizeof(namebuf));
+
+ if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf))
+ stack;
- while (buf[len] && !isspace(buf[len]) && buf[len] != '{' &&
+ while (namebuf[len] && !isspace(namebuf[len]) && namebuf[len] != '{' &&
len < (NAME_LEN - 1))
len++;
- buf[len] = '\0';
+ namebuf[len] = '\0';
/*
* Check that the text metadata in the circular buffer begins with a
* valid vg name.
*/
- if (!validate_name(buf)) {
+ if (!validate_name(namebuf)) {
log_error("Metadata location on %s at %llu begins with invalid VG name.",
dev_name(dev_area->dev),
(unsigned long long)(dev_area->start + rlocn->offset));
5 years, 6 months