From b31cc639a47e63a9f5098cf5e06fa3fd88061a1b Mon Sep 17 00:00:00 2001 From: Federico Hernandez Date: Tue, 23 Jun 2009 10:49:55 +0200 Subject: [PATCH] Fixed bug due to incompatible 'date' commands on OS X and Linux to display runtime of all unit tests --- src/tests/run_all | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/tests/run_all b/src/tests/run_all index f190ef08f..6383568cf 100755 --- a/src/tests/run_all +++ b/src/tests/run_all @@ -10,14 +10,24 @@ done date >> all.log START=`head -1 all.log` -STARTEPOCH=`date "+%s" -d "${START}"` END=`tail -1 all.log` -ENDEPOCH=`date "+%s" -d "${END}"` -RUNTIME=$(($ENDEPOCH-$STARTEPOCH)) +OS=`uname` + +case $OS in + Darwin) + STARTEPOCH=`date -j -f "%a %b %d %T %Z %Y" "${START}" "+%s"` + ENDEPOCH=`date -j -f "%a %b %d %T %Z %Y" "${END}" "+%s"` + ;; + Linux) + STARTEPOCH=`date "+%s" -d "${START}"` + ENDEPOCH=`date "+%s" -d "${END}"` + ;; +esac + +RUNTIME=$(($ENDEPOCH - $STARTEPOCH)) echo -n 'Pass: ' grep ^ok all.log | wc -l - echo -n 'Fail: ' grep ^not all.log | wc -l echo -n 'Runtime: '