1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz> 4 5PATH="$(dirname $0):$(dirname $0)/../../../testcases/lib/:$PATH" 6 7DATA=" 8timeout01.sh||0 9timeout02.sh||0 10timeout02.sh|foo|2 11timeout02.sh|2|0 12timeout01.sh|2|0 13timeout02.sh|1.1|0 14timeout02.sh|-10|2 15timeout02.sh|-0.1|0 16timeout02.sh|-1.1|2 17timeout02.sh|-10.1|2 18" 19 20echo "Testing timeout in shell API" 21echo 22 23failed=0 24for i in $DATA; do 25 file=$(echo $i | cut -d'|' -f1) 26 timeout=$(echo $i | cut -d'|' -f2) 27 exp_exit=$(echo $i | cut -d'|' -f3) 28 29 echo "=== $file (LTP_TIMEOUT_MUL='$timeout') ===" 30 LTP_TIMEOUT_MUL=$timeout $file 31 ret=$? 32 if [ $ret -ne $exp_exit ]; then 33 echo "FAILED (exit code: $ret, expected $exp_exit)" 34 failed=$((failed+1)) 35 else 36 echo "PASSED" 37 fi 38 echo 39done 40 41echo "Failed tests: $failed" 42exit $failed 43