diff --git a/Jenkinsfile b/Jenkinsfile index b837f9865..5abc0936b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,11 @@ pipeline{ sh "nohup curl https://sh.rustup.rs -sSf | sh -s -- -y" } } + stage ('Run Cargo tests') { + steps { + sh "scripts/run_cargo_tests.sh" + } + } stage ('Run unit tests') { steps { sh "scripts/run_unit_tests.sh" diff --git a/scripts/run_cargo_tests.sh b/scripts/run_cargo_tests.sh new file mode 100755 index 000000000..8a7a41aaf --- /dev/null +++ b/scripts/run_cargo_tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +set -x + +source $HOME/.cargo/env + +# Install cargo components +rustup component add clippy +rustup component add rustfmt +cargo install --force cargo-audit + +# Run cargo builds and checks +cargo rustc --bin cloud-hypervisor -- -D warnings +cargo rustc --bin vhost_user_net -- -D warnings +cargo test +cargo audit +cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,acpi" -- -D warnings +cargo rustc --bin vhost_user_net --no-default-features --features "pci,acpi" -- -D warnings +cargo clippy --all-targets --all-features -- -D warnings +cargo rustc --bin cloud-hypervisor --no-default-features --features "pci" -- -D warnings +cargo rustc --bin vhost_user_net --no-default-features --features "pci" -- -D warnings +cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio" -- -D warnings +cargo rustc --bin vhost_user_net --no-default-features --features "mmio" -- -D warnings +find . -name "*.rs" | xargs rustfmt --check +cargo build --release