Skip to content

Commit

Permalink
Using 'info'
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhoyer committed Oct 9, 2024
1 parent 053b8ab commit 8a0c169
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 41 deletions.
32 changes: 7 additions & 25 deletions tests/execute/result/check_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ rlJournalStart
rlAssertGrep "fail dmesg (after-test check)" $rlRun_LOG
rlAssertGrep "check failed" $rlRun_LOG

rlRun -s "tmt run --id \${run} --scratch provision --how local test --name /test/check-fail-ignore execute -vv report -vv 2>&1 >/dev/null" 0
rlAssertGrep "pass /test/check-fail-ignore" $rlRun_LOG
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG
rlAssertGrep "fail dmesg (after-test check)" $rlRun_LOG
rlAssertNotGrep "check failed" $rlRun_LOG

rlRun -s "tmt run --id \${run} --scratch provision --how local test --name /test/check-xfail-pass execute -vv report -vv 2>&1 >/dev/null" 1
rlAssertGrep "fail /test/check-xfail-pass" $rlRun_LOG
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG
Expand All @@ -43,7 +37,7 @@ rlJournalStart
rlAssertGrep "fail /test/check-multiple" $rlRun_LOG
rlAssertGrep "fail dmesg (after-test check)" $rlRun_LOG
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG
rlAssertGrep "fail dmesg (before-test check)" $rlRun_LOG
rlAssertGrep "info dmesg (before-test check)" $rlRun_LOG
rlAssertGrep "check failed" $rlRun_LOG
rlAssertGrep "unexpected pass" $rlRun_LOG

Expand Down Expand Up @@ -90,18 +84,6 @@ rlJournalStart
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[2]' $results_file"
rlAssertGrep "name: /test/check-fail-ignore" $rlRun_LOG
rlAssertGrep "result: pass" $rlRun_LOG
rlAssertNotGrep "note: check failed" $rlRun_LOG
rlAssertGrep "check:" $rlRun_LOG
rlAssertGrep "- how: dmesg" $rlRun_LOG
rlAssertGrep " result: pass" $rlRun_LOG
rlAssertGrep " event: before-test" $rlRun_LOG
rlAssertGrep "- how: dmesg" $rlRun_LOG
rlAssertGrep " result: fail" $rlRun_LOG
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[3]' $results_file"
rlAssertGrep "name: /test/check-xfail-pass" $rlRun_LOG
rlAssertGrep "result: fail" $rlRun_LOG
rlAssertGrep "note: unexpected pass" $rlRun_LOG
Expand All @@ -113,7 +95,7 @@ rlJournalStart
rlAssertGrep " result: pass" $rlRun_LOG
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[4]' $results_file"
rlRun -s "yq e '.[3]' $results_file"
rlAssertGrep "name: /test/check-xfail-fail" $rlRun_LOG
rlAssertGrep "result: pass" $rlRun_LOG
rlAssertGrep "note: expected failure" $rlRun_LOG
Expand All @@ -125,7 +107,7 @@ rlJournalStart
rlAssertGrep " result: fail" $rlRun_LOG
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[5]' $results_file"
rlRun -s "yq e '.[4]' $results_file"
rlAssertGrep "name: /test/check-multiple" $rlRun_LOG
rlAssertGrep "result: fail" $rlRun_LOG
rlAssertGrep "note: check failed, unexpected pass" $rlRun_LOG
Expand All @@ -135,9 +117,9 @@ rlJournalStart
rlAssertGrep "- how: dmesg" $rlRun_LOG
rlAssertGrep " result: pass" $rlRun_LOG
rlAssertGrep "- how: dmesg" $rlRun_LOG
rlAssertGrep " result: fail" $rlRun_LOG
rlAssertGrep " result: info" $rlRun_LOG

rlRun -s "yq e '.[6]' $results_file"
rlRun -s "yq e '.[5]' $results_file"
rlAssertGrep "name: /test/check-override" $rlRun_LOG
rlAssertGrep "result: pass" $rlRun_LOG
rlAssertNotGrep "note: check failed" $rlRun_LOG
Expand All @@ -149,15 +131,15 @@ rlJournalStart
rlAssertGrep " result: fail" $rlRun_LOG
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[7]' $results_file"
rlRun -s "yq e '.[6]' $results_file"
rlAssertGrep "name: /test/check-warn" $rlRun_LOG
rlAssertGrep "result: warn" $rlRun_LOG
rlAssertGrep "check:" $rlRun_LOG
rlAssertGrep "- how: dmesg" $rlRun_LOG
rlAssertGrep " result: warn" $rlRun_LOG
rlAssertGrep " event: after-test" $rlRun_LOG

rlRun -s "yq e '.[8]' $results_file"
rlRun -s "yq e '.[7]' $results_file"
rlAssertGrep "name: /test/check-info" $rlRun_LOG
rlAssertGrep "result: info" $rlRun_LOG
rlAssertGrep "check:" $rlRun_LOG
Expand Down
15 changes: 2 additions & 13 deletions tests/execute/result/check_results/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ description: Verify that check results, including after-test checks, are correct
result: respect
# Expected outcome: FAIL (test passes, but check fails and is respected)

/test/check-fail-ignore:
summary: Test with failing dmesg check (ignore)
test: echo "Test passed"
framework: shell
duration: 1m
check:
- how: dmesg
failure-pattern: '.*'
result: ignore
# Expected outcome: PASS (test passes, check fails but is ignored)

/test/check-xfail-pass:
summary: Test with passing dmesg check (xfail)
test: echo "Test passed"
Expand Down Expand Up @@ -67,8 +56,8 @@ description: Verify that check results, including after-test checks, are correct
result: xfail
- how: dmesg
failure-pattern: '.*'
result: ignore
# Expected outcome: FAIL (first dmesg check fails and is respected, second dmesg check passes but xfail expects it to fail, third failing dmesg check is ignored)
result: info
# Expected outcome: FAIL (first dmesg check fails and is respected, second dmesg check passes but xfail expects it to fail, third failing dmesg check is treated as info)

/test/check-override:
summary: Test with failing dmesg check but overridden by test result
Expand Down
3 changes: 0 additions & 3 deletions tmt/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class CheckResultInterpret(enum.Enum):
SKIP = 'skip'
RESPECT = 'respect'
XFAIL = 'xfail'
IGNORE = 'ignore'

@classmethod
def from_spec(cls, spec: str) -> 'CheckResultInterpret':
Expand Down Expand Up @@ -410,8 +409,6 @@ def interpret_results_base(
elif check_result == ResultOutcome.FAIL:
final_check_results[check_name] = ResultOutcome.PASS
note = 'expected failure in check'
elif check_interpret == CheckResultInterpret.IGNORE:
continue
elif check_interpret in (CheckResultInterpret.PASS, CheckResultInterpret.FAIL,
CheckResultInterpret.INFO, CheckResultInterpret.WARN,
CheckResultInterpret.ERROR, CheckResultInterpret.SKIP):
Expand Down

0 comments on commit 8a0c169

Please sign in to comment.