Skip to content

Commit

Permalink
Add valgrind based memory leak check script
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Apr 26, 2020
1 parent c4450fd commit c61812e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ script:
# Adding an extra delay in some places in the code. Makes the tests hit other edge cases.
- cargo test --features test-delay --verbose
- LOOM_MAX_BRANCHES=100000 LOOM_LOG=1 RUSTFLAGS="--cfg loom" cargo test
- if [[ $(uname -s) == "Linux" ]]; then
cargo install cargo-valgrind;
./check_mem_leaks.sh;
fi
- if [[ "${TRAVIS_RUST_VERSION}" = "stable" && $(uname -s) == "Linux" ]]; then
rustup component add rustfmt-preview;
rustfmt --version;
Expand Down
14 changes: 14 additions & 0 deletions check_mem_leaks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -eu

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"

for example_path in examples/*.rs; do
example_filename=$(basename -- $example_path)
example=${example_filename%.*}
echo $example
cargo valgrind --example "$example"
cargo valgrind --features test-delay --example "$example"
done

0 comments on commit c61812e

Please sign in to comment.