cloud-hypervisor/scripts/run_cargo_tests.sh
Rob Bradford 6e6b2b84fe scripts: Check the Rust formatting is valid
Check the rust formatting rather than just reformatting code on the CI
agent.

Also fix a formatting error that slipped in whilst the cargo fmt check
was not working correctly.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-02-04 16:47:05 +01:00

29 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
set -x
source $HOME/.cargo/env
# Install cargo components
time rustup component add clippy
time rustup component add rustfmt
time which cargo-audit || cargo install cargo-audit
# Run cargo builds and checks
time cargo clippy --all-targets --all-features -- -D warnings
time cargo rustc --bin cloud-hypervisor -- -D warnings
time cargo rustc --bin vhost_user_net -- -D warnings
time cargo test
time cargo audit
time cargo clippy --all-targets --no-default-features --features "pci,acpi" -- -D warnings
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,acpi" -- -D warnings
time cargo rustc --bin vhost_user_net --no-default-features --features "pci,acpi" -- -D warnings
time cargo clippy --all-targets --no-default-features --features "pci" -- -D warnings
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci" -- -D warnings
time cargo rustc --bin vhost_user_net --no-default-features --features "pci" -- -D warnings
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 cargo fmt -- --check
time cargo build --release