[lvm-devel] stable-2.02 - tests: check for installed time command

Zdenek Kabelac zkabelac at sourceware.org
Thu Jun 20 09:22:45 UTC 2019


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=02a5921cdb90c15c93486ef8b8bd42486f6829b6
Commit:        02a5921cdb90c15c93486ef8b8bd42486f6829b6
Parent:        b61c89b52b524b59a515123a9d659066cc4e183e
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Thu Jun 20 11:04:23 2019 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Thu Jun 20 11:21:08 2019 +0200

tests: check for installed time command

If the /usr/bin/time command is not installed, skip test
(do not want to use shells' built-in).
---
 test/shell/thin-many-dmeventd.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/shell/thin-many-dmeventd.sh b/test/shell/thin-many-dmeventd.sh
index f73b516..2a1fe74 100644
--- a/test/shell/thin-many-dmeventd.sh
+++ b/test/shell/thin-many-dmeventd.sh
@@ -22,6 +22,7 @@ export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
 #
 # Main
 #
+TIME=$(which time) || skip "Missing 'time' command"
 aux have_thin 1 0 0 || skip
 
 aux prepare_dmeventd
@@ -54,7 +55,7 @@ sleep 9
 # new thin-pool registration.
 for i in $(seq 11 15)
 do
-	/usr/bin/time -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+	"$TIME" -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
         read -r t < TM
         test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
         # Fill thin-pool to some capacity >50%




More information about the lvm-devel mailing list