add more tests, fix event-command response race condition #1

Merged
oysteikt merged 2 commits from add-more-tests into master 2024-05-01 23:52:26 +02:00
2 changed files with 25 additions and 1 deletions
Showing only changes of commit bb3426f111 - Show all commits

View File

@ -26,9 +26,10 @@
devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell { devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell {
packages = [ packages = [
(toolchain.withComponents [ (toolchain.withComponents [
"cargo" "rustc" "rustfmt" "clippy" "cargo" "rustc" "rustfmt" "clippy" "llvm-tools"
]) ])
pkgs.mpv pkgs.mpv
pkgs.grcov
]; ];
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/"; RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/";
}); });

23
scripts/coverage.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
rm -rf target/coverage || true
mkdir -p target/coverage
echo "Running tests"
RUST_LOG=mpvipc=trace RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="target/coverage/%p-%m.profraw" cargo test --all-features --release --no-fail-fast
echo "Generating coverage report"
grcov \
--source-dir . \
--binary-path ./target/release/deps/ \
--excl-start 'mod test* \{' \
--ignore 'tests/*' \
--ignore "*test.rs" \
--ignore "*tests.rs" \
--ignore "*github.com*" \
--ignore "*libcore*" \
--ignore "*rustc*" \
--ignore "*liballoc*" \
--ignore "*cargo*" \
-t html \
-o ./target/coverage/html \
target/coverage/