[lvm-devel] master - tests: timing without /usr/bin/time

Zdenek Kabelac zkabelac at sourceware.org
Tue Oct 16 19:57:12 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4db228b9079386b9e24e0389a080f86ac3008e69
Commit:        4db228b9079386b9e24e0389a080f86ac3008e69
Parent:        c15ac326cc29b5d91e726647d584c1b563c8c294
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Tue Oct 16 20:03:21 2018 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Tue Oct 16 21:56:00 2018 +0200

tests: timing without /usr/bin/time

Use just 'date' so the 'time' package doesn't need to be installed
just for this purpose.
---
 test/shell/thin-many-dmeventd.sh |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/shell/thin-many-dmeventd.sh b/test/shell/thin-many-dmeventd.sh
index f73b516..a40c75a 100644
--- a/test/shell/thin-many-dmeventd.sh
+++ b/test/shell/thin-many-dmeventd.sh
@@ -54,10 +54,15 @@ 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}
-        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%
+	#/usr/bin/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)"
+	START=$(date +%s)
+	lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+	END=$(date +%s)
+	DIFF=$(( END - START ))
+	test "$DIFF" -lt 8 || die "Creation of thin pool took more then 8 second! ($DIFF seconds)"
+	# Fill thin-pool to some capacity >50%
 	dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
 done
 




More information about the lvm-devel mailing list