|
| 1 | +#!/bin/bash |
| 2 | +. /usr/share/beakerlib/beakerlib.sh || exit 1 |
| 3 | +. ../../images.sh || exit 1 |
| 4 | +. ./lib/common.sh || exit 1 |
| 5 | + |
| 6 | +rlJournalStart |
| 7 | + rlPhaseStartSetup "Prepare test environment" |
| 8 | + rlRun "testdir=$(mktemp -d)" 0 "Create test directory" |
| 9 | + |
| 10 | + build_rpms |
| 11 | + |
| 12 | + rlRun "cp -a install-cases $testdir/data" 0 "Copy test data" |
| 13 | + rlRun "cp -a rpms $testdir/data/" 0 "Copy rpms data" |
| 14 | + rlRun "pushd $testdir/data" 0 "Enter test directory" |
| 15 | + rlRun "run=$(mktemp -d)" 0 "Create run directory" |
| 16 | + |
| 17 | + setup_distro_environment |
| 18 | + rlPhaseEnd |
| 19 | + |
| 20 | +xfail_plans=( |
| 21 | + "/verified-artifacts/pre-installed" |
| 22 | +) |
| 23 | + |
| 24 | + while IFS= read -r image; do |
| 25 | + if ! is_fedora "$image" && ! is_centos "$image"; then |
| 26 | + # Can only test rpm artifacts right now |
| 27 | + continue |
| 28 | + fi |
| 29 | + |
| 30 | + extra_env="" |
| 31 | + if is_centos_7 "$image"; then |
| 32 | + extra_env="-e DNF_CMD=yum" |
| 33 | + # TODO: centos7 is hard |
| 34 | + continue |
| 35 | + fi |
| 36 | + |
| 37 | + if is_centos_stream_9 "$image" || is_centos_stream_10 "$image"; then |
| 38 | + # TODO(#4941): |
| 39 | + # dnf repoquery fails |
| 40 | + # - Error: 'Package' object has no attribute 'full_nevra' |
| 41 | + # - Or gives an output of |
| 42 | + # 'bar': |
| 43 | + # - nevra: '%{full_nevra}' |
| 44 | + # repo_id: 'tmt-artifact-shared' |
| 45 | + continue |
| 46 | + fi |
| 47 | + |
| 48 | + phase_prefix="$(test_phase_prefix $image)" |
| 49 | + |
| 50 | + for plan in $(tmt plans ls); do |
| 51 | + xfail="" |
| 52 | + expected_result=0 |
| 53 | + for check_pattern in ${xfail_plans[@]}; do |
| 54 | + if [[ "$plan" =~ $check_pattern ]]; then |
| 55 | + xfail="(XFAIL)" |
| 56 | + expected_result=2 |
| 57 | + break |
| 58 | + fi |
| 59 | + done |
| 60 | + rlPhaseStartTest "$phase_prefix $plan $xfail" |
| 61 | + rlRun "tmt run $extra_env -i $run --scratch -vvv --all \ |
| 62 | + plan --name $plan \ |
| 63 | + provision -h $PROVISION_HOW --image $image" \ |
| 64 | + $expected_result "Run test case $plan $xfail" |
| 65 | + rlPhaseEnd |
| 66 | + done |
| 67 | + done <<< "$IMAGES" |
| 68 | + |
| 69 | + |
| 70 | + rlPhaseStartCleanup |
| 71 | + rlRun "popd" |
| 72 | + rlRun "rm -rf $run $testdir" 0 "Remove temporary files directories" |
| 73 | + rlPhaseEnd |
| 74 | +rlJournalEnd |
0 commit comments