Skip to content

Commit

Permalink
[sanity] More robust injection of opt-level 1
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
jonhoo committed Apr 24, 2023
1 parent 16a2c29 commit 45754fb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/safety.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ jobs:
sudo apt install llvm
# to fix buggy leak analyzer:
# https://github.com/japaric/rust-san#unrealiable-leaksanitizer
sed -i '/\[features\]/i [profile.dev]' Cargo.toml
sed -i '/profile.dev/a opt-level = 1' Cargo.toml
# ensure there's a profile.dev section
if ! grep -qE '^[ \t]*[profile.dev]' Cargo.toml; then
echo >> Cargo.toml
echo '[profile.dev]' >> Cargo.toml
fi
# remove pre-existing opt-levels in profile.dev
sed -i '/^\s*\[profile.dev\]/,/^\s*\[/ {/^\s*opt-level/d}' Cargo.toml
# now set opt-level to 1
sed -i '/^\s*\[profile.dev\]/a opt-level = 1' Cargo.toml
cat Cargo.toml
name: Enable debug symbols
- name: cargo test -Zsanitizer=address
Expand Down

0 comments on commit 45754fb

Please sign in to comment.