[PATCH] testsuite: handle busybox's timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The busybox version of timeout(1) requires that the duration
is given via a '-t' option.

However, the GNU coreutils' version has no such option and simply
take the duration as its first argument.

Fix the test-suite script to detect which version is used and pass
the duration accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/test-suite | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/validation/test-suite b/validation/test-suite
index e1ab1e657..e5939cdde 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -9,6 +9,7 @@ default_cmd="sparse \$file"
 default_args="$SPARSE_TEST_ARGS"
 tests_list=""
 prog_name=`basename $0`
+timeout_args=""
 
 if [ ! -x "$default_path/sparse-llvm" ]; then
 	disabled_cmds="sparsec sparsei sparse-llvm sparse-llvm-dis"
@@ -341,7 +342,14 @@ do_test()
 	# do we want a timeout?
 	pre_cmd=""
 	if [ $check_timeout -ne 0 ]; then
-		pre_cmd="timeout -k 1s $check_timeout"
+		if [ -z "$timeout_args" ]; then
+			if timeout --version 2>&1 | grep -q BusyBox; then
+				timeout_args="-t"
+			else
+				timeout_args="-k 1s"
+			fi
+		fi
+		pre_cmd="timeout $timeout_args $check_timeout"
 	fi
 
 	shift
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux