From 25ffd2e0fba8fbfbacafc43b25053c8593b9c93a Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 22 Nov 2012 02:29:41 +0100 Subject: [PATCH] Prepare polybench_test.sh for multiple options * Introduce run_tests method * Place generated files into a temporary directory * Name generated files descriptively * Use flag --std=gnu99 * Keep files until the end of the test run Enforcing gnu99 is required to compile the ppcg generated code with gcc. Keeping the files until the end of the test run allows the inspection of the generated files, in case incorrect code is generated and the test is aborted. The overall size of generated files is less than 10 Mb, so this should not cause any problems. Signed-off-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- polybench_test.sh.in | 60 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 20 deletions(-) rewrite polybench_test.sh.in (86%) diff --git a/polybench_test.sh.in b/polybench_test.sh.in dissimilarity index 86% index 8951c1e..38e4eaf 100644 --- a/polybench_test.sh.in +++ b/polybench_test.sh.in @@ -1,20 +1,40 @@ -#!/bin/sh - -EXEEXT=@EXEEXT@ -DIR=@POLYBENCH_DIR@ -SIZE=-DMINI_DATASET -CC="@CC@" - -for i in `cat $DIR/utilities/benchmark_list`; do - echo $i - name=`basename $i` - name=${name%.c} - dir=`dirname $i` - ./ppcg$EXEEXT --target=c -I $DIR/utilities $DIR/$i - $CC $SIZE -DPOLYBENCH_DUMP_ARRAYS -I $DIR/utilities $DIR/$i $DIR/utilities/polybench.c -lm - ./a.out 2> $name.out - $CC $SIZE -DPOLYBENCH_DUMP_ARRAYS -I $DIR/utilities -I $DIR/$dir $name.ppcg.c $DIR/utilities/polybench.c -lm - ./a.out 2> $name.ppcg.out - cmp $name.out $name.ppcg.out || exit - rm $name.out $name.ppcg.out -done +#!/bin/sh + +EXEEXT=@EXEEXT@ +DIR=@POLYBENCH_DIR@ +SIZE=-DMINI_DATASET +CC="@CC@" +TMPDIR=`mktemp -d --suffix=.ppcg` +CPPFLAGS="-DPOLYBENCH_DUMP_ARRAYS $SIZE -I $DIR/utilities" +CFLAGS="-lm --std=gnu99" + +echo "Running tests in folder ${TMPDIR}" + +run_tests () { + ext=$1 + for i in `cat $DIR/utilities/benchmark_list`; do + echo $i + name=`basename $i` + name=${name%.c} + source_opt="${TMPDIR}/$name.$ext.c" + prog_orig=${TMPDIR}/$name.orig${EXEEXT} + prog_opt=${TMPDIR}/$name.$ext${EXEEXT} + output_orig=${TMPDIR}/$name.orig.out + output_opt=${TMPDIR}/$name.$ext.out + dir=`dirname $i` + ./ppcg$EXEEXT --target=c -I $DIR/$dir $DIR/$i $CPPFLAGS \ + -o $source_opt || exit + $CC -I $DIR/$dir $CPPFLAGS $DIR/$i -o $prog_orig \ + $DIR/utilities/polybench.c $CFLAGS + $prog_orig 2> $output_orig + $CC -I $DIR/$dir $CPPFLAGS $source_opt -o $prog_opt \ + $DIR/utilities/polybench.c $CFLAGS || exit + + $prog_opt 2> $output_opt + cmp $output_orig $output_opt || exit + done +} + +run_tests ppcg + +rm -r "${TMPDIR}" -- 2.11.4.GIT