-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failing 'check' should affect test result by default. respect_checks option needs to be implemented.
- Loading branch information
1 parent
744bbcc
commit 6ace91c
Showing
5 changed files
with
165 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
rlJournalStart | ||
rlPhaseStartSetup | ||
rlRun "run=\$(mktemp -d)" 0 "Create run directory" | ||
rlRun "pushd check_results" | ||
rlRun "set -o pipefail" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Check results are respected" | ||
rlRun -s "tmt run --id \${run} --scratch provision --how local test --name /test/check-pass execute -vv report -vv 2>&1 >/dev/null" 0 | ||
rlAssertGrep "pass /test/check-pass" $rlRun_LOG | ||
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG | ||
rlAssertGrep "pass dmesg (after-test check)" $rlRun_LOG | ||
|
||
rlRun -s "tmt run --id \${run} --scratch provision --how local test --name /test/check-fail execute -vv report -vv 2>&1 >/dev/null" 1 | ||
rlAssertGrep "fail /test/check-fail" $rlRun_LOG | ||
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG | ||
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-ignore execute -vv report -vv 2>&1 >/dev/null" 0 | ||
rlAssertGrep "pass /test/check-ignore" $rlRun_LOG | ||
rlAssertGrep "pass dmesg (before-test check)" $rlRun_LOG | ||
rlAssertGrep "fail dmesg (after-test check)" $rlRun_LOG | ||
rlAssertNotGrep "check failed" $rlRun_LOG | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Verify results.yaml content" | ||
results_file="${run}/default/plan/execute/results.yaml" | ||
rlAssertExists "$results_file" | ||
|
||
rlRun -s "yq e '.[0]' $results_file" | ||
rlAssertGrep "name: /test/check-pass" $rlRun_LOG | ||
rlAssertGrep "result: pass" $rlRun_LOG | ||
rlAssertGrep "check:" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: pass" $rlRun_LOG | ||
rlAssertGrep " event: before-test" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: pass" $rlRun_LOG | ||
rlAssertGrep " event: after-test" $rlRun_LOG | ||
|
||
rlRun -s "yq e '.[1]' $results_file" | ||
rlAssertGrep "name: /test/check-fail" $rlRun_LOG | ||
rlAssertGrep "result: fail" $rlRun_LOG | ||
rlAssertGrep "note: check failed" $rlRun_LOG | ||
rlAssertGrep "check:" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: pass" $rlRun_LOG | ||
rlAssertGrep " event: before-test" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: fail" $rlRun_LOG | ||
rlAssertGrep " event: after-test" $rlRun_LOG | ||
|
||
rlRun -s "yq e '.[2]' $results_file" | ||
rlAssertGrep "name: /test/check-ignore" $rlRun_LOG | ||
rlAssertGrep "result: pass" $rlRun_LOG | ||
rlAssertNotGrep "note: check failed" $rlRun_LOG | ||
rlAssertGrep "check:" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: pass" $rlRun_LOG | ||
rlAssertGrep " event: before-test" $rlRun_LOG | ||
rlAssertGrep "- name: dmesg" $rlRun_LOG | ||
rlAssertGrep " result: fail" $rlRun_LOG | ||
rlAssertGrep " event: after-test" $rlRun_LOG | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "popd" | ||
rlRun "rm -r ${run}" 0 "Remove run directory" | ||
rlPhaseEnd | ||
rlJournalEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
summary: Tests for check results behavior | ||
description: Verify that check results, including after-test checks, are correctly handled | ||
|
||
/test/check-pass: | ||
summary: Test with passing checks | ||
test: echo "Test passed" | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
|
||
/test/check-fail: | ||
summary: Test with failing dmesg check | ||
test: | | ||
echo "Test passed" | ||
echo "Call Trace:" >> /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
|
||
/test/check-ignore: | ||
summary: Test with failing dmesg check but ignored | ||
test: | | ||
echo "Test passed" | ||
echo "Call Trace:" >> /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
result: pass | ||
check: | ||
- how: dmesg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters