Add support for valgrind

This commit is contained in:
Manuel de Brito Fontes 2018-08-30 21:32:06 -03:00
parent 05025d66a6
commit b0e242fe73
2 changed files with 17 additions and 1 deletions

View file

@ -74,14 +74,29 @@ const (
cfgPath = "/etc/nginx/nginx.conf"
)
var valgrind = []string{
"valgrind",
"--tool=memcheck",
"--leak-check=full",
"--show-leak-kinds=all",
"--leak-check=yes",
}
func nginxExecCommand(args ...string) *exec.Cmd {
ngx := os.Getenv("NGINX_BINARY")
if ngx == "" {
ngx = defBinary
}
cmdArgs := []string{"--deep", ngx, "-c", cfgPath}
cmdArgs := []string{"--deep"}
if os.Getenv("RUN_WITH_VALGRIND") == "true" {
cmdArgs = append(cmdArgs, valgrind...)
}
cmdArgs = append(cmdArgs, ngx, "-c", cfgPath)
cmdArgs = append(cmdArgs, args...)
return exec.Command("authbind", cmdArgs...)
}

View file

@ -20,6 +20,7 @@ WORKDIR /etc/nginx
RUN clean-install \
diffutils \
valgrind \
dumb-init
COPY . /