Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analyze fails on building test file #53

Open
maxgio92 opened this issue Dec 6, 2024 · 3 comments · May be fixed by #54
Open

analyze fails on building test file #53

maxgio92 opened this issue Dec 6, 2024 · 3 comments · May be fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@maxgio92
Copy link
Collaborator

maxgio92 commented Dec 6, 2024

When I run ./bin/harpoon analyze --exclude .git it fails on running go test with:

...
analyzing symbols
building test binary
error walking the path: failed to build test file: failed to execute build command '/home/linuxbrew/.linuxbrew/bin/go test -gcflags=-N -l -c ./internal/archiver -o .harpoon/archive.test': exit status 1
---
symbolsOrigins:
@maxgio92 maxgio92 linked a pull request Dec 6, 2024 that will close this issue
@alegrey91
Copy link
Owner

mmm looks like integration tests are failing due to your change.

@alegrey91
Copy link
Owner

could you check it please on your environment?

@alegrey91 alegrey91 added the bug Something isn't working label Dec 24, 2024
@maxgio92
Copy link
Collaborator Author

maxgio92 commented Dec 28, 2024

I reproduced the issue with integration tests with go 1.22. As discussed in #54, the issue I highlighted instead arises only with Go 1.23.

I reproduced the issue with a test environment declared in the following Dockerfile.

Dockerfile
ARG GOVERSION=1.22

FROM golang:$GOVERSION as base

RUN apt update && apt install -y --no-install-recommends \
	clang build-essential \
	libbpf-dev bpftool \
	libseccomp-dev \
	&& rm -rf /var/lib/apt/lists/*

RUN git config --global --add safe.directory /work

FROM cgr.dev/chainguard/wolfi-base as src

WORKDIR /src

COPY . .

FROM base as build

WORKDIR /build

COPY --from=src /src .

RUN rm -rf libbpfgo && make build

FROM cgr.dev/chainguard/wolfi-base as bin

COPY --from=build /build/bin/harpoon /usr/bin/harpoon

FROM base as test

RUN ln -s /usr/local/go/bin/go /usr/bin/go

RUN mkdir /tmp/integration

COPY --from=bin /usr/bin/harpoon /usr/bin/harpoon

WORKDIR /test

COPY --from=src /src .

RUN make -C tests/testcases/example-app

ENTRYPOINT ["/bin/sh", "-c"]

CMD ["go test -cover -v main_test.go -args -test.gocoverdir=/tmp/integration/"]

building the test environment with:

docker build . --target test -t test

and running the tests with:

 docker run --rm --privileged -v /sys:/sys test:latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants