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

"go test ./..." fails when llvm-symbolizer is not available (even if llvm-symbolizer-14 is there) #906

Open
aalexand opened this issue Oct 18, 2024 · 3 comments

Comments

@aalexand
Copy link
Collaborator

#891 added support for populating function start lines using llvm-symbolizer data. One caveat is that if llvm-symbolizer is not available, the default go test ./... run fails with the error below. In fact, even if llvm-symbolizer is available in its versioned form, such as llvm-symbolizer-14, the test run still fails with the same error.

The workaround right now is to install llvm-symbolizer and then run a command like sudo update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-14 100. This command makes the symbolizer available as llvm-symbolizer, which enables pprof to locate it.

Maybe we should make the test skipped if llvm-symbolizer is not available, but also have an option (a flag or environment variable) to disable that skippage so that we set that option in our CI to ensure we forcefully test the start function numbers.

$ go test ./...
?   	github.com/google/pprof	[no test files]
?   	github.com/google/pprof/driver	[no test files]
ok  	github.com/google/pprof/fuzz	0.034s
?   	github.com/google/pprof/internal/plugin	[no test files]
?   	github.com/google/pprof/internal/proftest	[no test files]
?   	github.com/google/pprof/internal/transport	[no test files]
?   	github.com/google/pprof/third_party/svgpan	[no test files]
--- FAIL: TestObjFile (1.77s)
    --- FAIL: TestObjFile/fixed_load_address (1.65s)
        binutils_test.go:379: SourceLine for main: got [{main /tmp/hello.c 3 0 0}]; want [{main /tmp/hello.c 3 0 3}]
    --- FAIL: TestObjFile/simulated_ASLR_address (0.12s)
        binutils_test.go:379: SourceLine for main: got [{main /tmp/hello.c 3 0 0}]; want [{main /tmp/hello.c 3 0 3}]
FAIL
FAIL	github.com/google/pprof/internal/binutils	1.867s
ok  	github.com/google/pprof/internal/driver	1.728s
ok  	github.com/google/pprof/internal/elfexec	0.092s
ok  	github.com/google/pprof/internal/graph	0.125s
ok  	github.com/google/pprof/internal/measurement	0.125s
ok  	github.com/google/pprof/internal/report	0.921s
ok  	github.com/google/pprof/internal/symbolizer	0.097s
ok  	github.com/google/pprof/internal/symbolz	0.071s
ok  	github.com/google/pprof/profile	0.114s
FAIL
@gmarin13
Copy link
Contributor

Maybe we should make the test skipped if llvm-symbolizer is not available

It looks like just the function start line is missing. One option is to check everything if llvm-symbolizer is present and ignore the start line if it's missing.

But I agree that we want to force the check in the CI to make sure the code doesn't rot.

@shantuo
Copy link

shantuo commented Oct 22, 2024

I see #891 updated the fake-llvm-symbolizer to output those start lines but that fake is not used in these failed tests.

@aalexand
Copy link
Collaborator Author

I think not all tests use the fake, intentionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants