git » orga2-tp1.git » commit 875eb97

Hacer que los tests fallen si se encuentran leaks

author Rodrigo Campos
2011-04-15 22:45:02 UTC
committer Rodrigo Campos
2011-04-16 02:11:03 UTC
parent e9c5531ec993229a4d54ee80bcd9a11399a3365d

Hacer que los tests fallen si se encuentran leaks

Brillantemente lo corrian con valgrind de forma tal que no falle si hay
leaks... :D

test.sh +6 -2

diff --git a/test.sh b/test.sh
index 0135a01..bc7e826 100755
--- a/test.sh
+++ b/test.sh
@@ -4,9 +4,13 @@ TESTDIR=tests
 BINFILE=./tpcopado
 
 OK=1
+OKVALGRIND=1
 for i in $( ls $TESTDIR/*.in); do
 	#echo $i
-	$VALGRIND -q $BINFILE -f $i
+	$VALGRIND --leak-check=yes --error-exitcode=1 -q $BINFILE -f $i
+	if [ $? != "0" ]; then
+		OKVALGRIND=0
+	fi
 	CATEDRA=${i/in/catedra.out}
 	ALUMNO=${i/in/out}
 	diff -q $CATEDRA $ALUMNO
@@ -14,6 +18,6 @@ for i in $( ls $TESTDIR/*.in); do
 		OK=0
 	fi
 done
-if [ $OK != "0" ]; then
+if [ $OK != "0" ] && [ $OKVALGRIND != "0" ]; then
 	echo "Tests finalizados correctamente"
 fi