Prepare polybench_test.sh for multiple options
[ppcg.git] / polybench_test.sh.in
blob38e4eaf9d489b3c6c596ffa74e154b7526e31754
1 #!/bin/sh
3 EXEEXT=@EXEEXT@
4 DIR=@POLYBENCH_DIR@
5 SIZE=-DMINI_DATASET
6 CC="@CC@"
7 TMPDIR=`mktemp -d --suffix=.ppcg`
8 CPPFLAGS="-DPOLYBENCH_DUMP_ARRAYS $SIZE -I $DIR/utilities"
9 CFLAGS="-lm --std=gnu99"
11 echo "Running tests in folder ${TMPDIR}"
13 run_tests () {
14 ext=$1
15 for i in `cat $DIR/utilities/benchmark_list`; do
16 echo $i
17 name=`basename $i`
18 name=${name%.c}
19 source_opt="${TMPDIR}/$name.$ext.c"
20 prog_orig=${TMPDIR}/$name.orig${EXEEXT}
21 prog_opt=${TMPDIR}/$name.$ext${EXEEXT}
22 output_orig=${TMPDIR}/$name.orig.out
23 output_opt=${TMPDIR}/$name.$ext.out
24 dir=`dirname $i`
25 ./ppcg$EXEEXT --target=c -I $DIR/$dir $DIR/$i $CPPFLAGS \
26 -o $source_opt || exit
27 $CC -I $DIR/$dir $CPPFLAGS $DIR/$i -o $prog_orig \
28 $DIR/utilities/polybench.c $CFLAGS
29 $prog_orig 2> $output_orig
30 $CC -I $DIR/$dir $CPPFLAGS $source_opt -o $prog_opt \
31 $DIR/utilities/polybench.c $CFLAGS || exit
33 $prog_opt 2> $output_opt
34 cmp $output_orig $output_opt || exit
35 done
38 run_tests ppcg
40 rm -r "${TMPDIR}"