lvm2/tests/gating/main.sh
Marian Csontos 923a5397d8 gating: Use upstream branch for testing
Related: RHEL-163449
2026-05-15 15:23:58 +02:00

79 lines
1.9 KiB
Bash
Executable File

#!/bin/bash -ex
BRANCH="test-rhel-10.3"
TESTSUITE_OUT_FILE="lvm2-testsuite.out"
free
df
lsblk
for service in \
lvm2-lvmpolld.service \
lvm2-lvmpolld.socket \
lvm2-monitor.service \
dm-event.socket \
dm-event.service \
"lvm2-pvscan@.service" \
; \
do
systemctl stop "$service" || :
systemctl mask "$service" || :
done
sed -i 's/monitoring *= *.*/monitoring = 0/' /etc/lvm/lvm.conf || :
# TODO: change the branch depending on the OS major.minor version
# Install lvm2 tests from upstream branch:
git clone --depth=1 --branch "$BRANCH" -- "https://gitlab.com/lvmteam/lvm2.git" lvm2-test
# Make the test suite:
cd lvm2-test
./configure
make -C test
# NOTE: testsuite works either when installed OR with make check
make -C test install
# NOTE: clean up to remove binaries, just in case!
make clean
RUNNER="/usr/bin/lvm2-testsuite"
TEST_PATH="/usr/share/lvm2-testsuite"
[[ -x "$RUNNER" ]]
[[ -d "$TEST_PATH" ]]
chmod 755 ci/tests.sh
chmod 755 ci/ignore.sh
lvm2_tests="$(ci/tests.sh)"
if [[ -z $lvm2_tests ]]; then
echo "ERROR: Found no tests to run" >&2
exit 1
fi
echo "$lvm2_tests"
flavours="$(cd "$TEST_PATH/lib" && ls -1 flavour-udev-* | grep -v "lvmlockd-dlm\|lvmlockd-sanlock" | grep "vanilla" | sed 's/^flavour-\(.*\)/\1/')"
if [[ -z $flavours ]]; then
echo "ERROR: Found no flavours to run" >&2
exit 1
fi
echo "$flavours"
# 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
for flavour in $flavours; do
# TODO: Repeat failure if ???
"$RUNNER" --batch --flavours "$flavour" --only "$test_script" 2>&1 | tee -a "$TESTSUITE_OUT_FILE"
RESULT="${PIPESTATUS[0]}"
if [[ $RESULT -ne 0 ]]; then
tmt-file-submit -l "${flavour}:${test_script//\//_}.txt"
fi
done
done
tmt-file-submit -l "$TESTSUITE_OUT_FILE"
! ci/ignore.sh < "$TESTSUITE_OUT_FILE" | grep -v "^[[:space:]]*$"
exit $?