-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.sh
executable file
·78 lines (67 loc) · 1.85 KB
/
test.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/zsh
VALGRIND_OPT=( "--tool=memcheck" "--track-origins=yes" "--read-var-info=yes" )
VG_MEMCHECK_OPT=( "--keep-stacktraces=alloc-and-free")
VG_LEAKCHECK_OPT=("--leak-check=no")
#expensive definedness checks (newish option)
#VG_MEMCHECK_OPT+=( "--expensive-definedness-checks=yes")
#long stack traces
VG_MEMCHECK_OPT+=("--num-callers=40")
#generate suppresions
#VG_MEMCHECK_OPT+=("--gen-suppressions=all")
#track files
#VG_MEMCHECK_OPT+=("--track-fds=yes")
for opt in $*; do
case $opt in
valgrind|memcheck)
valgrind=1
VALGRIND_OPT+=($VG_MEMCHECK_OPT);;
leak|leakcheck)
valgrind=1
VALGRIND_OPT+=($VG_LEAKCHECK_OPT);;
luajit)
luajit=1;;
5.1)
lua51=1;;
5.2)
lua52=1;;
debug-memcheck)
valgrind=1
VALGRIND_OPT+=($VG_MEMCHECK_OPT)
VALGRIND_OPT+=( "--vgdb=yes" "--vgdb-error=1" )
#ATTACH_DDD=1
;;
massif)
VALGRIND_OPT=( "--tool=massif" "--heap=yes" "--stacks=yes" "--massif-out-file=massif-nginx-%p.out")
valgrind=1
;;
sanitize-undefined)
FSANITIZE_UNDEFINED=1
;;
callgrind|profile)
VALGRIND_OPT=( "--tool=callgrind" "--collect-jumps=yes" "--collect-systime=yes" "--branch-sim=yes" "--cache-sim=yes" "--simulate-hwpref=yes" "--simulate-wb=yes" "--callgrind-out-file=callgrind-prailude-%p.out")
valgrind=1;;
helgrind)
VALGRIND_OPT=( "--tool=helgrind" "--free-is-write=yes")
valgrind=1
;;
cachegrind)
VALGRIND_OPT=( "--tool=cachegrind" )
valgrind=1;;
debug)
debugger=1
;;
esac
done
if [[ $debugger == 1 ]]; then
kdbg ./lua -a ./test.lua
elif [[ $valgrind == 1 ]]; then
valgrind $VALGRIND_OPT ./lua ./test.lua
elif [[ $luajit == 1 ]]; then
luajit ./test.lua
elif [[ $lua51 == 1 ]]; then
lua5.1 ./test.lua
elif [[ $lua52 == 1 ]]; then
lua5.2 ./test.lua
else
./lua ./test.lua
fi