lvm2/tests/gating/main.sh
Filip Suba e3b236e67f Migrate lvm2 gating tests from STI to TMT
(cherry picked from commit 17da88b5b1)
2025-03-31 16:55:01 +02:00

83 lines
2.3 KiB
Bash
Executable File

#!/bin/bash -x
TESTSUITE_OUT_FILE="lvm2-testsuite.out"
IGNORE_FAILURES=(
"lvconvert-thin.sh"
"lvcreate-cache.sh"
"lvcreate-thin-big.sh"
"lvconvert-cache-abort.sh"
"lvconvert-mirror.sh"
"dmeventd-restart.sh"
"nomda-restoremissing.sh"
"api/dbus"
"open-file-limit.sh"
"shell/integrity"
"writecache-blocksize"
"system_id.sh"
"shell/lvconvert-repair-policy.sh"
"shell/lvconvert-repair-thin.sh"
"shell/thin-foreign-dmeventd.sh"
"shell/lvresize-fs-crypt.sh"
)
SKIP_TESTS=(
"api/dbustest.sh"
"read-ahead.sh"
"shell/inconsistent-metadata.sh"
"lvconvert-cache-abort.sh"
"shell/000-basic.sh"
"shell/fsadm-crypt.sh"
"lvconvert-raid-reshape.sh"
"shell/lvconvert-raid-takeover.sh"
"shell/lvm-on-md.sh"
"shell/thin-flags.sh"
"shell/inconsistent-metadata.sh"
"shell/vgchange-many.sh"
)
skip_tests_regex="$(printf "%s|" "${SKIP_TESTS[@]}")"
skip_tests_regex="${skip_tests_regex%|}" # Remove trailing pipe
ignore_failures_pattern="$(printf "%s|" "${IGNORE_FAILURES[@]}")"
ignore_failures_pattern="${ignore_failures_pattern%|}" # Remove trailing pipe
free
df
lsblk
systemctl stop lvm2-lvmpolld.service
systemctl stop lvm2-lvmpolld.socket
systemctl stop lvm2-monitor.service
systemctl stop dm-event.socket
systemctl stop dm-event.service
systemctl stop lvm2-pvscan@.service
systemctl mask lvm2-pvscan@.service
sed -i 's/monitoring *= *.*/monitoring = 0/' /etc/lvm/lvm.conf
cd /usr/share/lvm2-testsuite || exit 1
lvm2_tests="$(find . -name "*.sh" | sed 's/^\.\///' | grep -vE "($skip_tests_regex)" | sort)"
echo "$lvm2_tests"
cd - || exit 1
cd /usr/share/lvm2-testsuite/lib || exit 1
flavours="$(ls -1 flavour-udev-* | grep -v "lvmlockd-dlm\|lvmlockd-sanlock" | grep "vanilla" | sed 's/^flavour-//')"
echo "$flavours"
cd - || exit 1
# Run testsuite in RAM disk:
mkdir -p /dev/shm/lvm2-slave
export LVM_TEST_DIR=/dev/shm/lvm2-slave
mount -o remount,dev /dev/shm
for test_script in $lvm2_tests; do
lvm2-testsuite --batch --flavours "$flavours" --only "$test_script" 2>&1 | tee -a "$TESTSUITE_OUT_FILE"
RESULT="${PIPESTATUS[0]}"
if [[ $RESULT -ne 0 ]]; then
tmt-file-submit -l "${flavours}:${test_script//\//_}.txt"
fi
done
tmt-file-submit -l "$TESTSUITE_OUT_FILE"
! grep -v "\(passed\|skipped\|warnings\|running 1 tests\)" "$TESTSUITE_OUT_FILE" | grep -Ev "(${ignore_failures_pattern})" | grep -v "^[[:space:]]*$"
exit $?