coverity appeasement
[minix.git] / benchmarks / run
blob54458c95b07dfc1471f47a443cd7949bb4f2208a
1 #!/bin/sh
3 set -e
5 make
7 BENCHDIR=/usr/local/benchmarks
9 basebenchmarks=`echo *bench*`
11 if [ -d $BENCHDIR ]
12 then packagebenchmarks=`(cd $BENCHDIR && echo *bench*)`
15 runbench() {
16 bench=$1
17 out="Results/$bench.`date +%Y%m%d.%H%M%S`"
18 if [ -d $bench ]
19 then dir=$bench
21 if [ -d $BENCHDIR/$bench ]
22 then dir=$BENCHDIR/$bench
24 clear
25 echo "Running $dir."
26 echo "Saving output to $out."
27 echo ""
28 ( cd $dir && sh run.sh 2>&1 ) | tee $out
31 clear
32 n=1
33 for b in $basebenchmarks $packagebenchmarks
34 do echo "$n. $b"
35 eval "n$n=$b"
36 n=`expr $n + 1`
37 done
38 echo
39 echo -n "Run which benchmark or 'all'? "
40 read bench
41 eval var=\$n$bench
42 if [ "$bench" = all ]
43 then for b in $basebenchmarks $packagebenchmarks
44 do runbench $b
45 done
46 else if [ -d "$var" -o -d "$BENCHDIR/$var" ]
47 then runbench $var
48 else echo "Unknown benchmark $var."
49 exit 1