diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2024-12-02 12:35:01 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mtkaczyk@kernel.org> | 2024-12-13 10:08:10 +0100 |
commit | 40f959d2d4497a7ecc3c8ea39a08beb167aca580 (patch) | |
tree | e93af3f21cddfe7ab67b3aad22391e4c719d7ba5 | |
parent | tests: fix tests 25raid246 (diff) | |
download | mdadm-40f959d2d4497a7ecc3c8ea39a08beb167aca580.tar.xz mdadm-40f959d2d4497a7ecc3c8ea39a08beb167aca580.zip |
tests: add skip option
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 <mateusz.kusiak@intel.com>
-rwxr-xr-x | test | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -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 @@ -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 |