From 480030f0f6ad3eabb719b750fc7df76fad08f2eb Mon Sep 17 00:00:00 2001 From: Cedric Bastoul Date: Mon, 13 Jan 2014 20:30:00 +0100 Subject: [PATCH] Nicer checking with valgrind --- Makefile.am | 2 +- test/Makefile.am | 13 ------------- test/checker.sh | 23 +++++++++++++++++++---- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index edf4fdb..4dff3b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,7 +166,7 @@ dist-hook: # *****************************************************************************/ valcheck: - $(MAKE) valgrind -C test + $(MAKE) test_valgrind -C test total: @echo " /*-----------------------------------------------*" diff --git a/test/Makefile.am b/test/Makefile.am index 375438a..c333554 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -285,19 +285,6 @@ generate_good: $(top_builddir)/cloog$(EXEEXT) -callable 1 $$options $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \ done; done -valgrind: - @echo " /*-----------------------------------------------*" - @echo " * Checking files by Valgrind *" - @echo " *-----------------------------------------------*/" - for x in $(CLOOGTEST_C) ; do \ - echo "Valgrinding $$x.c" ; \ - valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \ - done ; \ - for x in $(CLOOGTEST_FORTRAN) ; do \ - echo "Valgrinding $$x.f" ; \ - valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \ - done - valcheck: test_valgrind CHECKER := "$(srcdir)/checker.sh" diff --git a/test/checker.sh b/test/checker.sh index 8960d8e..72da5f1 100755 --- a/test/checker.sh +++ b/test/checker.sh @@ -110,10 +110,25 @@ for x in $TEST_FILES; do result=$?; rm -f $test_run; elif [ "$TEST_TYPE" = "valgrind" ]; then - echo "generating..."; - valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 \ - $top_builddir/.libs/cloog$EXEEXT $options -q $input > /dev/null; - result=$?; + echo "generating... \c"; +# valgrind --leak-check=full --error-exitcode=1 \ + valgrind --error-exitcode=1 \ + $top_builddir/.libs/cloog$EXEEXT $options -q $input \ + > /dev/null 2> cloog_temp; + errors=$?; + leaks=`grep "in use at exit" cloog_temp | cut -f 2 -d ':'` + if [ "$errors" = "1" ]; then + echo -e "\033[31mMemory error detected... \033[0m"; + cat cloog_temp; + result="1"; + elif [ "$leaks" != " 0 bytes in 0 blocks" ]; then + echo -e "\033[31mMemory leak detected... \033[0m"; + cat cloog_temp; + result="1"; + else + result="0"; + fi; + rm -f cloog_temp; else echo "generating... \c"; $cloog $options -q $input > cloog_temp; -- 2.11.4.GIT