minix/benchmarks/run
2010-02-04 18:15:10 +00:00

51 lines
842 B
Bash

#!/bin/sh
set -e
make
BENCHDIR=/usr/local/benchmarks
basebenchmarks=`echo *bench*`
if [ -d $BENCHDIR ]
then packagebenchmarks=`(cd $BENCHDIR && echo *bench*)`
fi
runbench() {
bench=$1
out="Results/$bench.`date +%Y%m%d.%H%M%S`"
if [ -d $bench ]
then dir=$bench
fi
if [ -d $BENCHDIR/$bench ]
then dir=$BENCHDIR/$bench
fi
clear
echo "Running $dir."
echo "Saving output to $out."
echo ""
( cd $dir && sh run.sh 2>&1 ) | tee $out
}
clear
n=1
for b in $basebenchmarks $packagebenchmarks
do echo "$n. $b"
eval "n$n=$b"
n=`expr $n + 1`
done
echo
echo -n "Run which benchmark or 'all'? "
read bench
eval var=\$n$bench
if [ "$bench" = all ]
then for b in $basebenchmarks $packagebenchmarks
do runbench $b
done
else if [ -d "$var" -o -d "$BENCHDIR/$var" ]
then runbench $var
else echo "Unknown benchmark $var."
exit 1
fi
fi