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

More generic target directory for rust coverage #5366

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

catenacyber
Copy link
Contributor

cc @alexcrichton for the tip in #4697 (comment)
(just needed to add -r to jq)
This should fix wasmtime coverage build (works locally)

cc @inferno-chromium

@inferno-chromium inferno-chromium enabled auto-merge (squash) March 12, 2021 06:57
@inferno-chromium inferno-chromium merged commit be203e3 into google:master Mar 12, 2021
@alexcrichton
Copy link
Contributor

Ah unfortunately wasmtime's fuzzing build is still failing, and I think it's due to this line because wasmtime's compile directory means the path to the fuzzers would be fuzz/fuzz_targets/...

Since this may not affect many other projects, would it be possible to have wasmtime-specific configuration in this case perhaps?

@catenacyber
Copy link
Contributor Author

@alexcrichton

If I get right the latest coverage build logs from https://oss-fuzz-build-logs.storage.googleapis.com/index.html#wasmtime
It looks like the target is compiled ok, but the coverage report cannot find the referenced files, because we have only relative paths and not absolute paths.
cf rust-lang/cargo#5450
The cargo wrapper tries to hack this using export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix src=$crate_src_abspath/src"
But regalloc.rs uses also bin directory for some source files
Hence we get the error AssertionError: File path "bin/fuzzing.rs" in coverage summary is outside source checkout. even if we have the file /out/src/regalloc.rs/bin/fuzzing.rs
There are more directories than regalloc.rs/bin which look problematic

So, I see 3 solutions

  • adding as many --remap-path-prefix as there are directories with rust source code other than src for wasmtime
  • Having the cargo wrapper do this automatically with something like a loop on find . -name "*.rs" | cut -d/ -f2 | uniq
  • have cargo output absolute paths
    Do you see another one ?
    cc @richkadel do you have an idea about this ?

@alexcrichton
Copy link
Contributor

I think the best solution is probably integration into cargo fuzz itself which should have all the logic availble to it, but in the meantime would it be possible for wasmtime to use its own cargo wrapper for this?

@catenacyber
Copy link
Contributor Author

in the meantime would it be possible for wasmtime to use its own cargo wrapper for this?

It is possible, but I am not sure what you mean.
Do you want the cargo wrapper to do find . -name "*.rs" | cut -d/ -f2 | uniq and sets multiple --remap-path-prefix ?
If so, why would you like it only for wasmtime ?

@alexcrichton
Copy link
Contributor

Sorry I don't know what the cut utility does so I'm not sure what that shell command would do. My thinking is that Wasmtime knows what paths are in play and how to pass through --remap-path-prefix so we can do something appropriate for Wasmtime if necessary. I'm not sure if it's possibly for wasmtime to bypass this wrapper, however.

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

Successfully merging this pull request may close these issues.

3 participants