Portability

- Improved run_all script to run on Solaris.

Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
Owen Clarke 2012-02-25 23:10:11 -05:00 committed by Paul Beckingham
parent a9de8a6596
commit 049f34d339

View file

@ -1,6 +1,7 @@
#! /bin/bash #! /bin/bash
date > all.log date > all.log
STARTEPOCH=`perl -e 'print time'`
VRAMSTEG=/usr/local/bin/vramsteg VRAMSTEG=/usr/local/bin/vramsteg
BAR=0 BAR=0
@ -28,25 +29,11 @@ if [ $BAR == 1 ]; then
fi fi
date >> all.log date >> all.log
ENDEPOCH=`perl -e 'print time'`
START=`head -1 all.log`
END=`tail -1 all.log`
OS=`uname`
case $OS in
Darwin | FreeBSD)
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)) RUNTIME=$(($ENDEPOCH - $STARTEPOCH))
printf "Pass: %5d\n" $(grep ^ok all.log | wc -l) printf "Pass: %5d\n" $(grep ^ok all.log | wc -l)
printf "Fail: %5d\n" $(grep ^not all.log | wc -l) printf "Fail: %5d\n" $(grep ^not all.log | wc -l)
printf "Skipped: %5d\n" $(grep ^skip all.log | wc -l) printf "Skipped: %5d\n" $(grep ^skip all.log | wc -l)
printf "Runtime: %5d\n" $RUNTIME printf "Runtime: %5d seconds\n" $RUNTIME