mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Add more dmstats integration tests
Add new tests for filemap, group/ungroup, histograms, precise timestamps and userdata.
This commit is contained in:
parent
9aa47f9768
commit
995c7b503b
79
test/shell/dmstats-filemap.sh
Normal file
79
test/shell/dmstats-filemap.sh
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1 2048
|
||||||
|
|
||||||
|
mount_dir="mnt"
|
||||||
|
hist_bounds="10ms,20ms,30ms"
|
||||||
|
file_size="100m"
|
||||||
|
|
||||||
|
test ! -d "$mount_dir" && mkdir "$mount_dir"
|
||||||
|
|
||||||
|
cleanup_mounted_and_teardown()
|
||||||
|
{
|
||||||
|
umount "$mount_dir" 2>/dev/null || true
|
||||||
|
aux teardown
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'cleanup_mounted_and_teardown' EXIT
|
||||||
|
|
||||||
|
mkfs.xfs "$dev1"
|
||||||
|
mount "$dev1" "$mount_dir"
|
||||||
|
|
||||||
|
test_filemap()
|
||||||
|
{
|
||||||
|
local map_file="$1"
|
||||||
|
local use_precise="$2"
|
||||||
|
local use_bounds="$3"
|
||||||
|
if [[ $use_precise == 1 ]]; then
|
||||||
|
precise="--precise"
|
||||||
|
else
|
||||||
|
precise=""
|
||||||
|
fi
|
||||||
|
if [[ $use_bounds == 1 ]]; then
|
||||||
|
bounds="--bounds $hist_bounds"
|
||||||
|
else
|
||||||
|
bounds=""
|
||||||
|
fi
|
||||||
|
fallocate -l "$file_size" "$mount_dir/$map_file"
|
||||||
|
dmstats create ${precise} ${bounds} --filemap "$mount_dir/$map_file"
|
||||||
|
dmstats list -ostats_name,precise |& tee out
|
||||||
|
grep "$map_file" out
|
||||||
|
if [[ $use_precise == 1 ]]; then
|
||||||
|
grep "1" out
|
||||||
|
fi
|
||||||
|
if [[ $use_bounds == 1 ]]; then
|
||||||
|
dmstats list -ostats_name,hist_bounds |& tee out
|
||||||
|
grep "$hist_bounds" out
|
||||||
|
fi
|
||||||
|
dmstats delete --allregions --alldevices
|
||||||
|
rm -f "$mount_dir/$map_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
for file in "filenospace" "File With Spaces" "$(echo -ne 'file\twith\ttabs')"; do
|
||||||
|
for precise in 0 1; do
|
||||||
|
for bounds in 0 1; do
|
||||||
|
test_filemap "$file" "$precise" "$bounds"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep .5
|
34
test/shell/dmstats-group.sh
Normal file
34
test/shell/dmstats-group.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1
|
||||||
|
|
||||||
|
GROUP_NAME="group0"
|
||||||
|
|
||||||
|
# Create a region and make it part of a group with an alias
|
||||||
|
dmstats create "$dev1"
|
||||||
|
dmstats group --alias "$GROUP_NAME" --regions 0 "$dev1"
|
||||||
|
dmstats list -ostats_name |& tee out
|
||||||
|
grep "$GROUP_NAME" out
|
||||||
|
|
||||||
|
# Remove the group and its regions
|
||||||
|
dmstats delete --groupid 0 "$dev1"
|
||||||
|
|
30
test/shell/dmstats-histogram.sh
Normal file
30
test/shell/dmstats-histogram.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1
|
||||||
|
|
||||||
|
HIST_BOUNDS="10ms,20ms,30ms"
|
||||||
|
|
||||||
|
# Create a region with a histogram and verify it in the list output
|
||||||
|
dmstats create --bounds "$HIST_BOUNDS" "$dev1"
|
||||||
|
dmstats list -ostats_name,hist_bounds |& tee out
|
||||||
|
grep "$HIST_BOUNDS" out
|
||||||
|
|
28
test/shell/dmstats-precise.sh
Normal file
28
test/shell/dmstats-precise.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1
|
||||||
|
|
||||||
|
# Create a region with precise_timestamps and verify it in the list output
|
||||||
|
dmstats create --precise "$dev1"
|
||||||
|
dmstats list -oprecise |& tee out
|
||||||
|
grep "1" out
|
||||||
|
|
35
test/shell/dmstats-ungroup.sh
Normal file
35
test/shell/dmstats-ungroup.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1
|
||||||
|
|
||||||
|
GROUP_NAME="group0"
|
||||||
|
|
||||||
|
# Create a region and make it part of a group with an alias
|
||||||
|
dmstats create "$dev1"
|
||||||
|
dmstats group --alias "$GROUP_NAME" --regions 0 "$dev1"
|
||||||
|
dmstats list -ostats_name |& tee out
|
||||||
|
grep "$GROUP_NAME" out
|
||||||
|
|
||||||
|
# Ungroup the regions then remove them
|
||||||
|
dmstats ungroup --groupid 0 "$dev1"
|
||||||
|
dmstats delete --allregions "$dev1"
|
||||||
|
|
31
test/shell/dmstats-userdata.sh
Normal file
31
test/shell/dmstats-userdata.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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_LVMPOLLD=1
|
||||||
|
SKIP_WITH_LVMLOCKD=1
|
||||||
|
|
||||||
|
. lib/inittest
|
||||||
|
|
||||||
|
# Don't attempt to test stats with driver < 4.33.00
|
||||||
|
aux driver_at_least 4 33 || skip
|
||||||
|
|
||||||
|
# ensure we can create devices (uses dmsetup, etc)
|
||||||
|
aux prepare_devs 1
|
||||||
|
|
||||||
|
USERDATA="aword"
|
||||||
|
|
||||||
|
# Create dmstats region with userdata and verify it is reported
|
||||||
|
# in list output
|
||||||
|
dmstats create --userdata "$USERDATA" "$dev1"
|
||||||
|
dmstats list -ouserdata |& tee out
|
||||||
|
grep "$USERDATA" out
|
||||||
|
|
Loading…
Reference in New Issue
Block a user