File: run-test-with-valgrind.csh

package info (click to toggle)
mia 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,532 kB
  • ctags: 16,800
  • sloc: cpp: 137,909; python: 1,057; ansic: 998; sh: 146; xml: 127; csh: 24; makefile: 13
file content (29 lines) | stat: -rwxr-xr-x 843 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/tcsh 


set files=`find . -name "test-*" -a -type f`
mkdir -p ValgrindTests

set outdir=`pwd`/ValgrindTests

foreach f ( $files) 
    set path=$f:h 
    set command=$f:t
    pushd "$path" 
    if ( ! -f "${outdir}/z-valgrind-${command}.log" ) then 
	echo "run $command" 
	set logfile="${outdir}/valgrind-${command}.log" 
	/usr/bin/valgrind --leak-check=full "./$command" >& "$logfile"
	/bin/grep "definitely lost: 0 " "$logfile" >/dev/null
	set nomemleak=$? 
	/bin/grep "All heap blocks were freed -- no leaks are possible" "$logfile" >/dev/null
	set nomemleak2=$? 
	/bin/grep "Invalid" "$logfile" >/dev/null
	set nonmemaccess=$? 
	if ( ( $nomemleak2 == 0 || $nomemleak == 0 ) && $nonmemaccess == 1 )  then 
	    /bin/mv "$logfile" "${outdir}/z-valgrind-${command}.log"
	    echo $command seems to be clean 
	endif
	endif
    popd 
end