diff options
Diffstat (limited to 'infra/base-images/base-builder/cargo')
-rwxr-xr-x | infra/base-images/base-builder/cargo | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/infra/base-images/base-builder/cargo b/infra/base-images/base-builder/cargo index bed8e7660..c60c7611b 100755 --- a/infra/base-images/base-builder/cargo +++ b/infra/base-images/base-builder/cargo @@ -27,7 +27,7 @@ then export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix src=$crate_src_abspath/src" fi -if [ "$SANITIZER" = "coverage" ] && [ $1 = "fuzz" ] +if [ "$SANITIZER" = "coverage" ] && [ $1 = "fuzz" ] && [ $2 = "build" ] then # hack to turn cargo fuzz build into cargo build so as to get coverage # cargo fuzz adds "--target" "x86_64-unknown-linux-gnu" @@ -35,7 +35,11 @@ then # go into fuzz directory if not already the case cd fuzz || true fuzz_src_abspath=`pwd` - export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix fuzz_targets=$fuzz_src_abspath/fuzz_targets" + # Default directory is fuzz_targets, but some projects like image-rs use fuzzers. + while read i; do + export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix $i=$fuzz_src_abspath/$i" + # Bash while syntax so that we modify RUSTFLAGS in main shell instead of a subshell. + done <<< "$(ls */*.rs | cut -d/ -f1 | uniq)" # we do not want to trigger debug assertions and stops export RUSTFLAGS="$RUSTFLAGS -C debug-assertions=no" # do not optimize with --release, leading to Malformed instrumentation profile data |