diff --git a/tests/.fmf/version b/.fmf/version similarity index 100% rename from tests/.fmf/version rename to .fmf/version diff --git a/gating.yaml b/gating.yaml index bd90bd9..dd6ee0f 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,7 +3,7 @@ product_versions: - rhel-9 decision_context: osci_compose_gate rules: - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: osci.brew-build./plans/gating.functional} # TODO: This is not automated yet and it's not easy to run, so we agreed # with QE we will not run these for 8.1 #- !PassingTestCaseRule {test_case_name: manual.sst_platform_storage.lvm2.manual-sts-tier1} diff --git a/plans/gating.fmf b/plans/gating.fmf new file mode 100644 index 0000000..e70836e --- /dev/null +++ b/plans/gating.fmf @@ -0,0 +1,32 @@ +summary: LVM2 gating tests +discover: + how: fmf +execute: + how: tmt +provision: + hardware: + memory: ">= 3 GB" + virtualization: + is-supported: true +prepare: + - name: install pacakges + how: install + package: + - python3-libselinux + - sed + - tar + - util-linux + - psmisc # killall is required by testsuite + - nmap-ncat # nc required by lvmpolld tests (or socat) + - binutils # strings is required by some tests + - strace + - vim-common # xxd required by some tests + - mdadm + - vdo + - kmod-kvdo + - lvm2 + - lvm2-testsuite + - lvm2-lockd + - lvm2-dbusd + - device-mapper-event + - cryptsetup diff --git a/tests/gating/main.fmf b/tests/gating/main.fmf new file mode 100644 index 0000000..58dcf74 --- /dev/null +++ b/tests/gating/main.fmf @@ -0,0 +1,7 @@ +summary: LVM2 gating test +description: LVM2 gating test +component: + - lvm2 +test: ./main.sh +duration: 4h +enabled: true diff --git a/tests/gating/main.sh b/tests/gating/main.sh new file mode 100755 index 0000000..eea8ee3 --- /dev/null +++ b/tests/gating/main.sh @@ -0,0 +1,82 @@ +#!/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 $?