Skip to content

Commit

Permalink
Run the tests in the subcrate (#51)
Browse files Browse the repository at this point in the history
* Run the tests in the sub crate

* Run tests in sub crate by the sanitizers

* Add format and lint(clippy) checks in run_tests.sh

The format check should always be run, in main crate and sub crate, not
only in Travis CI server only. The format checks and lints(clippy)
checks should be moved from .travis.yml to run_tests.sh.
  • Loading branch information
ChunMinChang authored Feb 20, 2020
1 parent 132d209 commit 54d950a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ before_script:
- cargo --version
- sh install_rustfmt_clippy.sh
script:
- cargo fmt --all -- --check
- cargo clippy -- -D warnings
- cargo build --verbose
- sh run_tests.sh
- sh run_sanitizers.sh
Expand Down
20 changes: 20 additions & 0 deletions run_sanitizers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ else
exit
fi

# Run tests in the sub crate
# -------------------------------------------------------------------------------------------------
cd coreaudio-sys-utils

echo "\n\nRun ASan\n-----------\n"
RUSTFLAGS="-Z sanitizer=address" cargo test

echo "\n\nRun LSan\n-----------\n"
RUSTFLAGS="-Z sanitizer=leak" cargo test

echo "\n\nRun MSan\n-----------\n"
RUSTFLAGS="-Z sanitizer=memory" cargo test

echo "\n\nRun TSan\n-----------\n"
RUSTFLAGS="-Z sanitizer=thread" cargo test

cd ..

# Run tests in the main crate
# -------------------------------------------------------------------------------------------------
echo "\n\nRun ASan\n-----------\n"
RUSTFLAGS="-Z sanitizer=address" sh run_tests.sh

Expand Down
23 changes: 23 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# display backtrace for debugging
export RUST_BACKTRACE=1

# Run tests in the sub crate
# -------------------------------------------------------------------------------------------------
cd coreaudio-sys-utils

# Format check
cargo fmt --all -- --check

# Lints check
cargo clippy -- -D warnings

# Regular Tests
cargo test

cd ..

# Run tests in the main crate
# -------------------------------------------------------------------------------------------------
# Format check
cargo fmt --all -- --check

# Lints check
cargo clippy -- -D warnings

# Regular Tests
cargo test --verbose
cargo test test_configure_output -- --ignored
Expand Down

0 comments on commit 54d950a

Please sign in to comment.