gpu: build AST expression for local array sizes during AST generation
[ppcg.git] / opencl_test.sh.in
blob7e027d775535743026aa775f3795ea3be5b4ab27
1 #!/bin/sh
3 keep=no
5 for option; do
6 case "$option" in
7 --keep)
8 keep=yes
9 ;;
10 esac
11 done
13 EXEEXT=@EXEEXT@
14 VERSION=@GIT_HEAD_VERSION@
15 CC="@CC@"
16 CFLAGS="--std=gnu99"
17 srcdir="@srcdir@"
19 if [ $keep = "yes" ]; then
20 OUTDIR="opencl_test.$VERSION"
21 mkdir "$OUTDIR" || exit 1
22 else
23 if test "x$TMPDIR" = "x"; then
24 TMPDIR=/tmp
26 OUTDIR=`mktemp -d $TMPDIR/ppcg.XXXXXXXXXX` || exit 1
29 run_tests () {
30 subdir=$1
31 ppcg_options=$2
33 echo Test with PPCG options \'$ppcg_options\'
34 mkdir ${OUTDIR}/${subdir} || exit 1
35 for i in $srcdir/tests/*.c; do
36 echo $i
37 name=`basename $i`
38 name="${name%.c}"
39 out_c="${OUTDIR}/${subdir}/$name.ppcg.c"
40 out="${OUTDIR}/${subdir}/$name.ppcg$EXEEXT"
41 options="--target=opencl --opencl-no-use-gpu $ppcg_options"
42 functions="$srcdir/tests/${name}_opencl_functions.cl"
43 if test -f $functions; then
44 options="$options --opencl-include-file=$functions"
45 options="$options --opencl-compiler-options=-I."
47 ./ppcg$EXEEXT $options $i -o "$out_c" || exit
48 $CC $CFLAGS -I "$srcdir" "$srcdir/ocl_utilities.c" -lOpenCL \
49 -I. "$out_c" -o "$out" || exit
50 $out || exit
51 done
54 run_tests default
55 run_tests embed --opencl-embed-kernel-code
57 if [ $keep = "no" ]; then
58 rm -r "${OUTDIR}"