Statistics
| Branch: | Revision:

peerstreamer-src / Test / run_tests.sh @ 3628a59e

History | View | Annotate | Download (614 Bytes)

1
#!/bin/bash
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

    
15
TDIR="$(dirname $0)"
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))
34
done