From 76087f1235eb966d5551f83562ad795697c99678 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Thu, 30 Jan 2020 23:59:11 +0100 Subject: [PATCH] script: cargo: Improve the cargo tests We don't need to force the cargo-audit install, we can check if it's already available instead and install if it's not. Also, since we now have workspaces properly setup, we can call directly into cargo fmt and avoid calling into find magic incantation. Signed-off-by: Samuel Ortiz --- scripts/run_cargo_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_cargo_tests.sh b/scripts/run_cargo_tests.sh index 8f9d46846..aed76ae93 100755 --- a/scripts/run_cargo_tests.sh +++ b/scripts/run_cargo_tests.sh @@ -7,7 +7,7 @@ source $HOME/.cargo/env # Install cargo components time rustup component add clippy time rustup component add rustfmt -time cargo install --force cargo-audit +time which cargo-audit || cargo install cargo-audit # Run cargo builds and checks time cargo clippy --all-targets --all-features -- -D warnings @@ -24,5 +24,5 @@ time cargo rustc --bin vhost_user_net --no-default-features --features "pci" -- time cargo clippy --all-targets --no-default-features --features "mmio" -- -D warnings time cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio" -- -D warnings time cargo rustc --bin vhost_user_net --no-default-features --features "mmio" -- -D warnings -time sh -c 'find . \( -name "*.rs" ! -wholename "*/out/*.rs" \) | xargs rustfmt --check' +time cargo fmt time cargo build --release