Skip to content

Commit 91275cc

Browse files
committed
valgrind check build env
1 parent afd2997 commit 91275cc

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

valgrind.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
#!/bin/bash
22

3+
if [ ! -f lib/lib.sh ]
4+
then
5+
echo "Error: lib/lib.sh not found!"
6+
echo "make sure you are in the root of the server repo"
7+
exit 1
8+
fi
9+
10+
source lib/lib.sh
11+
12+
is_asan_runtime() {
13+
if printf '%s' "$CFG_ENV_RUNTIME" | grep -qE '(env_san.sh|fsanitize)'
14+
then
15+
return 0
16+
fi
17+
return 1
18+
}
19+
20+
is_asan_build() {
21+
if printf '%s' "$CFG_ENV_BUILD" | grep -qE '(env_san.sh|fsanitize)'
22+
then
23+
return 0
24+
fi
25+
return 1
26+
}
27+
28+
if is_asan_runtime || is_asan_build
29+
then
30+
err "Error: in your server.cnf you enabled a sanitizer already"
31+
err " valgrind does not work well when combined with asan and ubsan"
32+
err " go to your server.cnf and check where you set env_build and env_runtime"
33+
err " their current values are:"
34+
err ""
35+
err " env_build=$CFG_ENV_BUILD"
36+
err " env_runtime=$CFG_ENV_RUNTIME"
37+
err ""
38+
exit 1
39+
fi
40+
41+
342
# WARNING: this script is not really ready to be used yet
443
# valgrind cant run with asan so the entrie setup is a bit messy
544
# not sure if i ever put enough love into this so its actually usable

0 commit comments

Comments
 (0)