1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-06 00:58:48 +03:00

tests: better handling of system dir

Use more consistenly location of etc dir in tests.
Read value of etc dir via lvm cmd.
This commit is contained in:
Zdenek Kabelac 2023-10-02 14:10:03 +02:00
parent e3cee67d77
commit ffaff7afa6
3 changed files with 13 additions and 11 deletions

View File

@ -1088,9 +1088,9 @@ prepare_devs() {
done
if test -n "$LVM_TEST_DEVICES_FILE"; then
mkdir -p "$TESTDIR/etc/lvm/devices" || true
rm "$TESTDIR/etc/lvm/devices/system.devices" || true
touch "$TESTDIR/etc/lvm/devices/system.devices"
mkdir -p "$LVM_SYSTEM_DIR/devices" || true
rm -f "$LVM_SYSTEM_DIR/devices/system.devices"
touch "$LVM_SYSTEM_DIR/devices/system.devices"
for d in "${DEVICES[@]}"; do
lvmdevices --adddev "$d" || true
done

View File

@ -28,10 +28,11 @@ flatten() {
# or even better do not initialize
# locking for commands like 'dumpconfig'
#aux lvmconf "global/locking_type=0"
eval "$(lvmconfig global/etc)"
lvm dumpconfig -f lvmdumpconfig
flatten < lvmdumpconfig | sort > config.dump
flatten < etc/lvm.conf | sort > config.input
flatten < "$etc/lvm.conf" | sort > config.input
# check that dumpconfig output corresponds to the lvm.conf input
diff -wu config.input config.dump
@ -42,8 +43,9 @@ lvm dumpconfig -f lvmdumpconfig
flatten < lvmdumpconfig | grep 'log/indent=1'
aux lvmconf 'tags/@foo {}'
echo 'log { verbose = 1 }' > etc/lvm_foo.conf
echo 'log { verbose = 1 }' > "$etc/lvm_foo.conf"
lvm dumpconfig -f lvmdumpconfig
flatten < lvmdumpconfig | grep 'log/verbose=1'
lvm dumpconfig -f lvmdumpconfig
flatten < lvmdumpconfig | grep 'log/indent=1'
rm -f "$etc/lvm_foo.conf"

View File

@ -21,11 +21,11 @@ SKIP_WITH_LVMPOLLD=1
aux have_raid 1 9 0 || skip
aux prepare_devs ${PREPARE_DEVS-3}
SIDFILE="etc/lvm_test.conf"
LVMLOCAL="etc/lvmlocal.conf"
eval "$(lvmconfig global/etc)"
DFDIR="$LVM_SYSTEM_DIR/devices"
DF="$DFDIR/system.devices"
SIDFILE="$etc/lvm_test.conf"
LVMLOCAL="$etc/lvmlocal.conf"
DF="$etc/devices/system.devices"
print_lvmlocal() {
{ echo "local {"; printf "%s\n" "$@"; echo "}"; } >"$LVMLOCAL"
@ -35,9 +35,9 @@ print_lvmlocal() {
# which gets in the way of the test switching the
# local system id.
clear_df_systemid() {
if [[ -f $DF ]]; then
if [[ -f "$DF" ]]; then
sed -e "s|SYSTEMID=.||" "$DF" > tmpdf
cp tmpdf $DF
cp tmpdf "$DF"
fi
}