@@ -17,42 +17,6 @@ rlJournalStart
1717 setup_distro_environment
1818 rlPhaseEnd
1919
20- xfail_plans=(
21- # Intentionally should fail at install or verify stage
22- # TODO: Check the failure more narrowly
23- " ^/broken/verified-artifacts"
24- # Same failure like the dnf4, but the explicit --best flag does not need to be included (#5090)
25- # Interestingly `/verified-artifacts/obsoletes/basic/downgrade` does not fail, it seems it does not
26- # read the other repo metadata there, but things may change in the future
27- " ^/verified-artifacts/obsoletes/pre-installed/downgrade"
28- )
29- xfail_plans_nobest=(
30- # On dnf4 these plans fail because of the intrinsic --best flag passed (#5090)
31- # Missing ^ here is intetional, to cover both /broken/available-artifacts and /available-artifacts
32- " /available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
33- " ^/broken/available-artifacts/basic"
34- " ^/broken/available-artifacts/obsoletes/basic"
35- " ^/broken/available-artifacts/.*pre-installed/.*/with-devel$"
36- " ^/broken/no-artifacts/.*/pre-installed/with-devel$"
37- " ^/broken/no-artifacts/obsoletes/basic$"
38- " ^/broken/no-artifacts/upgrade/with-devel$"
39- )
40- xfail_centos7=(
41- # yum cannot downgrade a pre-installed package
42- " /pre-installed/downgrade/with-devel$"
43- " ^/verified-artifacts/pre-installed/downgrade/only-foo$"
44- )
45- complicated_centos7=(
46- # Obsoletes wins over priority. Some of these tests pass when they should xfail
47- # some fail in different ways, it is hard to handle them all consistently, so just skip them.
48- " ^/verified-artifacts/obsoletes/basic/downgrade$"
49- " ^/available-artifacts/obsoletes/basic/downgrade$"
50- " ^/available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
51- " ^/broken/available-artifacts/obsoletes/basic/downgrade$"
52- " ^/broken/available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
53- " ^/verified-artifacts/obsoletes/basic/downgrade$"
54- )
55-
5620 while IFS= read -r image; do
5721 if ! is_fedora " $image " && ! is_centos " $image " ; then
5822 # Can only test rpm artifacts right now
@@ -67,49 +31,81 @@ complicated_centos7=(
6731 phase_prefix=" $( test_phase_prefix $image ) "
6832
6933 for plan in $( tmt plans ls) ; do
70- xfail=" "
71- expected_result=0
72- for check_pattern in ${xfail_plans[@]} ; do
73- if [[ " $plan " =~ $check_pattern ]]; then
74- xfail=" (XFAIL)"
75- expected_result=2
76- break
77- fi
78- done
79- if is_centos_7 " $image " || is_centos_stream_9 " $image " || is_centos_stream_10 " $image " || is_fedora_eln " $image " ; then
34+ xfail=
35+ if [[ " $plan " =~ " ^/broken/verified-artifacts" ]]; then
36+ # Expected failure because we are explicitly installing a broken package
37+ xfail=(
38+ ' stderr:\s+ - nothing provides some-non-existent-package needed by .* from tmt-artifact-shared'
39+ ' fail: Command .* install -y .* returned 1.'
40+ )
41+ elif [[ " $plan " =~ " ^/verified-artifacts/obsoletes/pre-installed/downgrade" ]]; then
42+ # Pre-installed package does not let the install downgrade, so this is expected to fail
43+ xfail=(
44+ ' stderr:\s+- installed package foo-ng-1.0-1.noarch obsoletes foo < 3.0-1 provided by foo-1.1-1.noarch from tmt-artifact-shared'
45+ ' stderr:\s+- conflicting requests'
46+ ' fail: Command .* install -y .* returned 1.'
47+ )
48+ elif is_centos_7 " $image " || is_centos_stream_9 " $image " || is_centos_stream_10 " $image " || is_fedora_eln " $image " ; then
49+ # On CentOS-like images --best flag is set by default so fallback mechanism is not applied and some cases fail
50+ xfail_plans_nobest=(
51+ # Missing ^ here is intetional, to cover both /broken/available-artifacts and /available-artifacts
52+ " /available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
53+ " ^/broken/available-artifacts/basic"
54+ " ^/broken/available-artifacts/obsoletes/basic"
55+ " ^/broken/available-artifacts/.*pre-installed/.*/with-devel$"
56+ " ^/broken/no-artifacts/.*/pre-installed/with-devel$"
57+ " ^/broken/no-artifacts/obsoletes/basic$"
58+ " ^/broken/no-artifacts/upgrade/with-devel$"
59+ )
8060 for check_pattern in ${xfail_plans_nobest[@]} ; do
8161 if [[ " $plan " =~ $check_pattern ]]; then
82- xfail=" (XFAIL)"
83- expected_result=2
62+ xfail=(
63+ ' stderr:\s+- cannot install the best candidate for the job'
64+ ' fail: Command .* install -y .* returned 1.'
65+ )
8466 break
8567 fi
8668 done
8769 fi
8870 if is_centos_7 " $image " ; then
89- for check_pattern in ${xfail_centos7[@]} ; do
90- if [[ " $plan " =~ $check_pattern ]]; then
91- xfail=" (XFAIL)"
92- expected_result=2
93- break
94- fi
95- done
96- # Skip too complicated situations altogether
97- unset complicated
98- for check_pattern in ${complicated_centos7[@]} ; do
99- if [[ " $plan " =~ $check_pattern ]]; then
100- complicated=1
101- break
71+ if [[ " $plan " =~ " /pre-installed/downgrade/with-devel$" || " $plan " =~ " ^/verified-artifacts/pre-installed/downgrade/only-foo$" ]]; then
72+ # yum cannot downgrade a pre-installed package
73+ xfail=(
74+
75+ )
76+ else
77+ # Obsoletes wins over priority. Some of these tests pass when they should xfail
78+ # some fail in different ways, it is hard to handle them all consistently, so just skip them.
79+ complicated_centos7=(
80+ " ^/verified-artifacts/obsoletes/basic/downgrade$"
81+ " ^/available-artifacts/obsoletes/basic/downgrade$"
82+ " ^/available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
83+ " ^/broken/available-artifacts/obsoletes/basic/downgrade$"
84+ " ^/broken/available-artifacts/obsoletes/pre-installed/downgrade/with-devel$"
85+ " ^/verified-artifacts/obsoletes/basic/downgrade$"
86+ )
87+ # Skip too complicated situations altogether
88+ unset complicated
89+ for check_pattern in ${complicated_centos7[@]} ; do
90+ if [[ " $plan " =~ $check_pattern ]]; then
91+ complicated=1
92+ break
93+ fi
94+ done
95+ if [[ -n " $complicated " ]]; then
96+ continue
10297 fi
103- done
104- if [[ -n " $complicated " ]]; then
105- continue
10698 fi
10799 fi
108- rlPhaseStartTest " $phase_prefix $plan $xfail "
109- rlRun " tmt run $extra_env -i $run --scratch -vvv --all \
100+ expected_result=$(( 0 ${xfail: +2} ))
101+ rlPhaseStartTest " $phase_prefix $plan ${xfail: +(XFAIL)} "
102+ rlRun -s " tmt run $extra_env -i $run --scratch -vvv --all \
110103 plan --name '^$plan $' \
111104 provision -h $PROVISION_HOW --image $image " \
112105 $expected_result " Run test case $plan $xfail "
106+ for xfail_message in " ${xfail[@]} " ; do
107+ rlAssertGrep " $xfail_message " $rlRun_LOG -E
108+ done
113109 rlPhaseEnd
114110 done
115111 done <<< " $IMAGES"
0 commit comments