Skip to content

Commit

Permalink
tests: add skip option
Browse files Browse the repository at this point in the history
As for now the test either fails or succeeds. Add third option: skip.
This is to be used for tests that might not be possible to execute for
example due to missing (software) components or kernel not being
compiled with debugging options.

Signed-off-by: Mateusz Kusiak <[email protected]>
  • Loading branch information
dancesWithMachines authored and mtkaczyk committed Dec 13, 2024
1 parent 064ce60 commit 40f959d
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,19 @@ md125=/dev/md125
mdp0=/dev/md_d0
mdp1=/dev/md_d1

SKIP=3

die() {
echo -e "\n\tERROR: $* \n"
save_log fail
exit 2
}

skip() {
echo -e "\n\tSKIPPING, REASON: $* \n"
exit $SKIP
}

ctrl_c() {
exitonerror=1
ctrl_c_error=1
Expand Down Expand Up @@ -142,11 +149,18 @@ do_test() {
succeed "succeeded\n"
_fail=0
else
print_time_elapsed $start_sec
save_log fail
_fail=1
if [ "$_broken" == "1" ]; then
echo " (KNOWN BROKEN TEST: $_broken_msg)"
exit_code=$? # Capture the exit code from the script
if [ $exit_code -eq $SKIP ]; then
warn "skipping"
save_log
_fail=0
else
print_time_elapsed $start_sec
save_log fail
_fail=1
if [ "$_broken" == "1" ]; then
echo " (KNOWN BROKEN TEST: $_broken_msg)"
fi
fi
fi
restore_system_speed_limit
Expand Down

0 comments on commit 40f959d

Please sign in to comment.