From f025327f04f881332f2f441618f1df788865d381 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 31 Aug 2016 19:52:24 +0200 Subject: [PATCH] test: remove time-out script, use go-timeout instead License: MIT Signed-off-by: Jakub Sztandera --- test/bin/.gitignore | 1 - test/bin/time-out | 83 ------------------- .../t0500-issues-and-regressions-offline.sh | 10 +-- 3 files changed, 5 insertions(+), 89 deletions(-) delete mode 100755 test/bin/time-out diff --git a/test/bin/.gitignore b/test/bin/.gitignore index 8eec62514efb..c032badeef4c 100644 --- a/test/bin/.gitignore +++ b/test/bin/.gitignore @@ -8,4 +8,3 @@ !checkflags !continueyn !verify-go-fmt.sh -!time-out diff --git a/test/bin/time-out b/test/bin/time-out deleted file mode 100755 index 47d863bd0f53..000000000000 --- a/test/bin/time-out +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# The Bash shell script executes a command with a time-out. -# Upon time-out expiration SIGTERM (15) is sent to the process. If the signal -# is blocked, then the subsequent SIGKILL (9) terminates it. -# -# Based on the Bash documentation example. - -scriptName="${0##*/}" - -declare -i DEFAULT_TIMEOUT=9 -declare -i DEFAULT_INTERVAL=1 -declare -i DEFAULT_DELAY=1 - -# Timeout. -declare -i timeout=DEFAULT_TIMEOUT -# Interval between checks if the process is still alive. -declare -i interval=DEFAULT_INTERVAL -# Delay between posting the SIGTERM signal and destroying the process by SIGKILL. -declare -i delay=DEFAULT_DELAY - -function printUsage() { - cat < 0)); do - sleep $interval - kill -0 $$ || exit 0 - ((t -= interval)) - done - - # Be nice, post SIGTERM first. - # The 'exit 0' below will be executed if any preceeding command fails. - kill -s SIGTERM $$ && kill -0 $$ || exit 0 - sleep $delay - kill -s SIGKILL $$ -) 2> /dev/null & - -exec "$@" diff --git a/test/sharness/t0500-issues-and-regressions-offline.sh b/test/sharness/t0500-issues-and-regressions-offline.sh index 802adea6a8a2..bfab467e53e0 100755 --- a/test/sharness/t0500-issues-and-regressions-offline.sh +++ b/test/sharness/t0500-issues-and-regressions-offline.sh @@ -8,17 +8,17 @@ test_description="Tests for various fixed issues and regressions." test_expect_success "ipfs init with occupied input works - #2748" ' export IPFS_PATH="ipfs_path" - echo "" | time-out ipfs init && + echo "" | go-timeout 10 ipfs init && rm -rf ipfs_path ' test_init_ipfs -test_expect_success "ipfs cat --help succeeds with no input" ' - time-out ipfs cat --help +test_expect_success "ipfs cat --help succeeds when input remains open" ' + yes | go-timeout 1 ipfs cat --help ' -test_expect_success "ipfs pin ls --help succeeds with no input" ' - time-out ipfs pin ls --help +test_expect_success "ipfs pin ls --help succeeds when input remains open" ' + yes | go-timeout 1 ipfs pin ls --help ' test_expect_success "ipfs add on 1MB from stdin woks" '