Skip to content

Commit 951b88a

Browse files
committed
tests: Minor improvements
Use bash built-in typeof instead of separately packaged 'which' command to determine path to time binary. Also re-use TOPDIR-specification if available. Signed-off-by: Peter Oberparleiter <[email protected]>
1 parent e91ec6e commit 951b88a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/bin/test_run

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
trap 'echo ; exit 1' SIGINT
1212

13-
TOPDIR=$(realpath $(dirname $0)/..) && source "$TOPDIR/bin/common"
13+
[[ -z "$TOPDIR" ]] && TOPDIR=$(realpath $(dirname $0)/..)
14+
15+
source "$TOPDIR/bin/common"
16+
1417
EXCERPTLEN=10
1518
TESTNAME="$1"
1619
shift
1720

18-
TIME=$(which time 2>/dev/null)
21+
TIME=$(type -P time 2>/dev/null)
1922
if [ ! -z "$TIME" ] ; then
2023
TIME="$TIME -v -o $TIMEFILE"
2124
if ! $TIME true 2>/dev/null ; then

0 commit comments

Comments
 (0)