Revision 3628a59e Test/run_tests.sh

View differences:

Test/run_tests.sh
1 1
#!/bin/bash
2 2

  
3
info() {
4
	echo -e "\E[33m$@\033[0m"
5
}
6

  
7
error() {
8
	echo -e "\E[31m$@\033[0m"
9
}
10

  
11
success() {
12
	echo -e "\E[32m$@\033[0m"
13
}
14

  
3 15
TDIR="$(dirname $0)"
4
for t in $(ls $TDIR/*.test); do
5
	./$t
16
FILES=(`ls $TDIR/*.test`)
17
i=0
18
while [ $i -lt ${#FILES[@]} ]; do
19
	info "Running ${FILES[$i]}"
20
	res=$(${FILES[$i]} 2>&1)
21
	if [ $? -ne 0 ]; then
22
		error "$res"
23
		exit 1
24
	fi
25
	info "Valgrind on ${FILES[$i]}"
26
	res=$(valgrind --leak-check=full ${FILES[$i]} 2>&1 | awk '/ERROR SUMMARY/ {print $4}')
27
	if [ $res -gt 0 ]; then
28
		error "Memory error on ${FILES[$i]}"
29
		error $(valgrind --leak-check=full ${FILES[$i]})
30
		exit 1
31
	fi
32
	success "Test Passed"
33
	i=$((i+1))
6 34
done

Also available in: Unified diff