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 <dmitry.baryshkov@linaro.org>
This commit is contained in:
Dmitry Baryshkov
2021-10-02 16:35:13 +03:00
committed by Bjorn Andersson
parent d2329902b7
commit dad8a13e9e
2 changed files with 17 additions and 13 deletions

View File

@@ -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

17
helpers/timeout Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $0 <seconds> <command> <args>...."
exit 1
fi
attempts="$1"; shift
cmd="$@"
for i in `seq ${attempts}`
do
$cmd && exit 0
sleep 1
done
exit 1