Skip to content

Commit

Permalink
feat: enable valgrind test
Browse files Browse the repository at this point in the history
  • Loading branch information
krish-nr committed Feb 27, 2024
1 parent b3e2ba8 commit 79d3542
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG BUILDNUM=""
FROM golang:1.20-alpine as builder

RUN apk add --no-cache build-base libc-dev
RUN apk add --no-cache gcc musl-dev linux-headers git
RUN apk add --no-cache gcc musl-dev linux-headers git valgrind

# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
Expand All @@ -22,11 +22,16 @@ RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
# Pull Geth into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates
RUN apk add --no-cache ca-certificates valgrind
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"]
# Create a directory for the valgrind logs
RUN mkdir /var/log/geth
# Ensure the directory is writable by any user
RUN chmod 777 /var/log/geth
# Wrap the geth command with valgrind, assuming you want to do this by default
ENTRYPOINT ["sh", "-c", "valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes /usr/local/bin/geth 2>&1 | tee /var/log/geth/valgrind.log"]

# Add some metadata labels to help programatic image consumption
ARG COMMIT=""
Expand Down
4 changes: 4 additions & 0 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import (
"time"

"github.com/cespare/cp"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/signify"
"github.com/ethereum/go-ethereum/internal/build"
Expand Down Expand Up @@ -228,6 +229,9 @@ func doInstall(cmdline []string) {
// Show packages during build.
gobuild.Args = append(gobuild.Args, "-v")

// Show debug infos
gobuild.Args = append(gobuild.Args, "-gcflags=all=-N -l")

// Now we choose what we're even building.
// Default: collect all 'main' packages in cmd/ and build those.
packages := flag.Args()
Expand Down

0 comments on commit 79d3542

Please sign in to comment.