test: use `command` instead of `env` to bypass Bash’s built-ins
authorJean Privat <jean@pryen.org>
Wed, 14 Jun 2017 12:44:40 +0000 (08:44 -0400)
committerJean Privat <jean@pryen.org>
Wed, 14 Jun 2017 12:44:40 +0000 (08:44 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

misc/jenkins/unitrun.sh
tests/tests.sh

index c6cd72a..c1430da 100755 (executable)
@@ -25,12 +25,12 @@ name=$1
 shift
 
 # Detect a working time command
-if env time --quiet -f%e true 2>/dev/null; then
-       TIME="env time --quiet -f%e -o ${name}.t.out"
-elif env time -f%e true 2>/dev/null; then
-       TIME="env time -f%e -o ${name}.t.out"
-elif env gtime -f%e true 2>/dev/null; then
-       TIME="env gtime -f%e -o ${name}.t.out"
+if command time --quiet -f%e true 2>/dev/null; then
+       TIME="command time --quiet -f%e -o ${name}.t.out"
+elif command time -f%e true 2>/dev/null; then
+       TIME="command time -f%e -o ${name}.t.out"
+elif command gtime -f%e true 2>/dev/null; then
+       TIME="command gtime -f%e -o ${name}.t.out"
 else
        TIME=
 fi
index 8faa4f6..a402eb2 100755 (executable)
@@ -130,12 +130,12 @@ else
 fi
 
 # Detect a working time command
-if env time --quiet -f%e true 2>/dev/null; then
-       TIME="env time --quiet -f%e"
-elif env time -f%e true 2>/dev/null; then
-       TIME="env time -f%e"
-elif env gtime -f%e true 2>/dev/null; then
-       TIME="env gtime -f%e"
+if command time --quiet -f%e true 2>/dev/null; then
+       TIME="command time --quiet -f%e"
+elif command time -f%e true 2>/dev/null; then
+       TIME="command time -f%e"
+elif command gtime -f%e true 2>/dev/null; then
+       TIME="command gtime -f%e"
 else
        TIME=
 fi