[lttng-dev] [PATCH urcu] runtests: check for existence of /usr/bin/time

Simon Marchi simon.marchi at polymtl.ca
Wed Nov 14 16:50:53 EST 2012


Otherwise, if /usr/bin/time does not exist, the tests won't run at all.

Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
---
 tests/runtests-batch.sh |    8 +++++++-
 tests/runtests.sh       |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tests/runtests-batch.sh b/tests/runtests-batch.sh
index 6c2340d..d11609e 100755
--- a/tests/runtests-batch.sh
+++ b/tests/runtests-batch.sh
@@ -1,8 +1,14 @@
 #!/bin/sh
 
+if [ -x /usr/bin/time ]; then
+	TIME_COMMAND="/usr/bin/time -a -o runnall.detail.log"
+else
+	TIME_COMMAND=""
+fi
+
 #for a in test_urcu_gc test_urcu_gc_mb test_urcu_qsbr_gc; do
 for a in test_urcu_gc; do
 	echo "./${a} $*" | tee -a runall.detail.log
-	/usr/bin/time -a -o runall.detail.log ./${a} $*
+	$TIME_COMMAND ./${a} $*
 done
 
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 79e54df..563ebd3 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -1,10 +1,16 @@
 #!/bin/sh
 
+if [ -x /usr/bin/time ]; then
+	TIME_COMMAND="/usr/bin/time -a -o runnall.detail.log"
+else
+	TIME_COMMAND=""
+fi
+
 for a in test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc \
 	test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc \
 	test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr \
 	test_rwlock test_perthreadlock test_mutex; do
 	echo "./${a} $*" | tee -a runall.detail.log
-	/usr/bin/time -a -o runall.detail.log ./${a} $*
+	$TIME_COMMAND ./${a} $*
 done
 
-- 
1.7.1




More information about the lttng-dev mailing list