Skip to content

Commit

Permalink
add an example LLVM FileCheck based test
Browse files Browse the repository at this point in the history
Signed-off-by: Uday Bondhugula <udayb@iisc.ac.in>
  • Loading branch information
bondhugula committed May 10, 2019
1 parent 8fac862 commit 9280565
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ AC_CHECK_PROG(CAT,cat,cat)
AC_CHECK_PROG(AR,ar,ar)
AC_CHECK_PROG(STRIP,strip,strip)

AC_CHECK_PROG(FILECHECK,FileCheck,yes,no,path = '/usr/lib64/llvm/')

This comment has been minimized.

Copy link
@aravindacharya

aravindacharya May 11, 2019

Collaborator

Looks for FileCheck in /usr/lib64/llvm. Ideally this has to be searched in $PATH and $CLANG_PREFIX

This comment has been minimized.

Copy link
@bondhugula

bondhugula May 12, 2019

Author Owner

That's right - we need to fix this.

AS_IF([test x"$FILECHECK" != x"yes"], [AC_MSG_ERROR([Please install LLVM FileCheck before configuring.])])

glpk="false"
dnl glpk flag
AC_ARG_ENABLE(glpk,
Expand Down
23 changes: 23 additions & 0 deletions filecheck-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

TESTS=test/heat-2d.c

for file in $TESTS; do
echo -ne "$file "
./src/pluto $file $* --pet --notile --noparallel -o test_temp_out.pluto.c | FileCheck $file
if [ $? -ne 0 ]; then
echo -e "[\e[31mFailed\e[0m]" " $file"!
else
echo -e "[\e[32mPassed\e[0m]"
fi
done

cleanup()
{
rm -f test_temp_out.pluto.c
rm -f test_temp_out.pluto.pluto.cloog
}

echo

trap cleanup SIGINT exit
22 changes: 22 additions & 0 deletions test/heat-2d.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// CHECK: T(S1): (t, t+i, t+j)
#define N 4000L
#define T 1000L

/* Define our arrays */
double A[2][N+2][N+2];

int main(int argc, char * argv[]) {
#pragma scop
for (int t = 0; t < T; t++) {
for (int i = 1; i < N+1; i++) {
for (int j = 1; j < N+1; j++) {
A[(t+1)%2][i][j] = 0.125 * (A[t%2][i+1][j] - 2.0 * A[t%2][i][j] + A[t%2][i-1][j])
+ 0.125 * (A[t%2][i][j+1] - 2.0 * A[t%2][i][j] + A[t%2][i][j-1])
+ A[t%2][i][j];
}
}
}
#pragma endscop

return 0;
}

0 comments on commit 9280565

Please sign in to comment.