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

Error while executing llvm tools #695

Closed
CalvinNeo opened this issue Oct 27, 2021 · 7 comments · Fixed by #902
Closed

Error while executing llvm tools #695

CalvinNeo opened this issue Oct 27, 2021 · 7 comments · Fixed by #902

Comments

@CalvinNeo
Copy link

I got this error when running the following command.

grcov . --binary-path target/debug/ . -t html --branch --ignore-not-existing -o ./coverage/  --keep-only *raftstore*
15:12:17 [ERROR] Error while executing llvm tools: Failed to execute "/Users/calvin/.rustup/toolchains/nightly-2021-04-15-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/llvm-profdata" "merge" "-sparse" "/var/folders/2q/sfkj3vg13z175flb8j9znf9w0000gn/T/.tmpe7XB6K/tidb-engine-ext-99132-10660545001084846649_0_1.profraw" 
... (Leave out lots of *.profraw files)

Argument list too long (os error 7)
15:12:20 [ERROR] A panic occurred at /Users/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/grcov-0.8.2/src/html.rs:458: attempt to divide by zero

Seems that the argument for llvm-profdata are too long

@CalvinNeo
Copy link
Author

I think you can not just splice all profraw_paths in func profraws_to_lcov at src/llvm_tools.rs

@calixteman
Copy link
Collaborator

Sorry but I don't really understand what Seems that the argument for llvm-profdata are too long means here.
Is it about the total length (as a string) of the command line ? or is it about the max number of arguments ?
Anyway, you should be able to see the different limits on your system (I assume you're using a linux) in using xargs --show-limits.
If it is really a matter of limits, we can split (as you do it in your PR) but in using the values of the environment where the user is running instead of using this arbitrary 2000.

@CalvinNeo
Copy link
Author

@calixteman Yes, there are too many characters in this command line, since there are too *.profraw files.
How about adding a argument here, such like --batch_size <NUM>, and let users to decide?

@marco-c
Copy link
Collaborator

marco-c commented Nov 8, 2021

@CalvinNeo this seems like an implementation detail that we should hide from users. We can retrieve the maximum number of characters that can be used, so we should automatically batch the arguments in the right way based on that maximum.

@calixteman
Copy link
Collaborator

The problem with --batch_size is that you would need to change this value in the CI scripts if the configuration changed.
So as @marco-c said we must rely on the "constants" we've in the system to guess how to split correctly.

@CalvinNeo
Copy link
Author

@calixteman I get that. I gonna try to find a way to do that.

@obsgolem
Copy link
Contributor

I have a fix for this; llvm-profdata merge can actually take a -f - parameter which lets you pass an arbitrary number of filenames. PR incoming.

obsgolem added a commit to obsgolem/grcov that referenced this issue Oct 21, 2022
…s more files than the max command line length to llvm-profdata. Added the ability to grab coverage info for dll and other secondary executables.

Resolves mozilla#695, mozilla#838, and mozilla#848
obsgolem added a commit to obsgolem/grcov that referenced this issue Oct 21, 2022
…s more files than the max command line length to llvm-profdata. Added the ability to grab coverage info for dll and other secondary executables.

Resolves mozilla#695, mozilla#838, and mozilla#848
marco-c pushed a commit that referenced this issue Oct 31, 2022
- Add --llvm-path feature for configurable LLVM path (fixes #848).
- Add ability to pass more files than the max command line length to llvm-profdata (fixes #695 and fixes #838).
- Add the ability to grab coverage info for DLL and other secondary executables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants