From dad8a13e9e37ab49c7beab2866648c5d0f74b2d0 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Sat, 2 Oct 2021 16:35:13 +0300 Subject: [PATCH] helpers/bootrr: move timeout to separate helper There is no need to have timeout as a function in the bootrr file. Move it to a separate helper file as we have for the rest of helpers. Signed-off-by: Dmitry Baryshkov --- helpers/bootrr | 13 ------------- helpers/timeout | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 13 deletions(-) create mode 100755 helpers/timeout diff --git a/helpers/bootrr b/helpers/bootrr index eea482e..f576854 100644 --- a/helpers/bootrr +++ b/helpers/bootrr @@ -1,18 +1,5 @@ #!/bin/sh -timeout() { - attempts="$1"; shift - cmd="$@" - - for i in `seq ${attempts}` - do - $cmd && return 0 - sleep 1 - done - - return 1 -} - test_report_exit() { TEST_RESULT=$1 command -v lava-test-case diff --git a/helpers/timeout b/helpers/timeout new file mode 100755 index 0000000..e713cd6 --- /dev/null +++ b/helpers/timeout @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "Usage: $0 ...." + exit 1 +fi + +attempts="$1"; shift +cmd="$@" + +for i in `seq ${attempts}` +do + $cmd && exit 0 + sleep 1 +done + +exit 1