#!/bin/bash

make tests

RED="\x1B[0;31m"
GREEN="\x1B[0;32m"
BLUE="\x1B[1;34m"
NOCOLOR="\x1B[0m"
exit_code=0

for file in $(find tests/bin -maxdepth 1 -type f); do
	echo -e $BLUE "Testing " $file $NOCOLOR
	if ! valgrind --error-exitcode=1 $file $TEST_ARGS; then
		echo -e $RED "Error:" $file "leaking memory" $NOCOLOR 1>&2
		exit_code=1
	else
		echo -e $BLUE $file "passed" $NOCOLOR
	fi
done

for file in $(find build/bin -maxdepth 1 -type f); do
	echo -e $BLUE "Testing " $file $NOCOLOR
	if ! valgrind --error-exitcode=1 $file $ARGS; then
		echo -e "Error: leaking memory"
		exit_code=1
	else
		echo -e $BLUE $file "passed" $NOCOLOR
	fi
done
exit $exit_code

#!/bin/bash

make tests

exit_code=0

for file in $(find tests/bin -type f -maxdepth 1); do
	echo "Testing " $file
	if valgrind --error-exitcode=1 $file $TEST_ARGS; then
		echo "Error:" $file "leaking memory" 1>&2
		exit_code=1
	fi
	tests/bin/$file
done

for file in $(find build/bin -type f -maxdepth 1); do
	echo "Testing " $file
	if valgrind --error-exitcode=1 $file $ARGS; then
		echo "Error: leaking memory"
		exit_code=1
	fi
done
exit $exit_code

--- 
+++ 
@@ -2,29 +2,22 @@
 
 make tests
 
-RED="\x1B[0;31m"
-GREEN="\x1B[0;32m"
-BLUE="\x1B[1;34m"
-NOCOLOR="\x1B[0m"
 exit_code=0
 
-for file in $(find tests/bin -maxdepth 1 -type f); do
-	echo -e $BLUE "Testing " $file $NOCOLOR
-	if ! valgrind --error-exitcode=1 $file $TEST_ARGS; then
-		echo -e $RED "Error:" $file "leaking memory" $NOCOLOR 1>&2
+for file in $(find tests/bin -type f -maxdepth 1); do
+	echo "Testing " $file
+	if valgrind --error-exitcode=1 $file $TEST_ARGS; then
+		echo "Error:" $file "leaking memory" 1>&2
 		exit_code=1
-	else
-		echo -e $BLUE $file "passed" $NOCOLOR
 	fi
+	tests/bin/$file
 done
 
-for file in $(find build/bin -maxdepth 1 -type f); do
-	echo -e $BLUE "Testing " $file $NOCOLOR
-	if ! valgrind --error-exitcode=1 $file $ARGS; then
-		echo -e "Error: leaking memory"
+for file in $(find build/bin -type f -maxdepth 1); do
+	echo "Testing " $file
+	if valgrind --error-exitcode=1 $file $ARGS; then
+		echo "Error: leaking memory"
 		exit_code=1
-	else
-		echo -e $BLUE $file "passed" $NOCOLOR
 	fi
 done
 exit $exit_code
Test runner returns better exit codes

Also make it more colorful for human consumption.
