mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
build: add a default feature KVM
It gets bubbled all the way up from hypervsior crate to top-level Cargo.toml. Cloud Hypervisor can't function without KVM at this point, so make it a default feature. Fix all scripts that use --no-default-features. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -204,7 +204,7 @@ cmd_build() {
|
||||
[ $build = "release" ] && cargo_args+=("--release")
|
||||
cargo_args+=(--target "$target")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=(--features "mmio")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=(--features "mmio,kvm")
|
||||
|
||||
rustflags=""
|
||||
if [ $(uname -m) = "aarch64" ] && [ $libc = "musl" ] ; then
|
||||
|
||||
@@ -15,14 +15,14 @@ time cargo rustc --bin cloud-hypervisor -- -D warnings
|
||||
time cargo rustc -p vhost_user_net --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 -p vhost_user_net --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 -p vhost_user_net --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 -p vhost_user_net --bin vhost_user_net --no-default-features --features "mmio" -- -D warnings
|
||||
time cargo clippy --all-targets --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||
time cargo clippy --all-targets --no-default-features --features "pci,kvm" -- -D warnings
|
||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,kvm" -- -D warnings
|
||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci,kvm" -- -D warnings
|
||||
time cargo clippy --all-targets --no-default-features --features "mmio,kvm" -- -D warnings
|
||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio,kvm" -- -D warnings
|
||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "mmio,kvm" -- -D warnings
|
||||
time cargo fmt -- --check
|
||||
time cargo build --all --release
|
||||
|
||||
@@ -178,7 +178,7 @@ sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
||||
|
||||
cargo_args=("$@")
|
||||
cargo_args+=("--no-default-features")
|
||||
cargo_args+=("--features mmio")
|
||||
cargo_args+=("--features mmio,kvm")
|
||||
cargo build --release --target $BUILD_TARGET ${cargo_args[@]}
|
||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||
@@ -204,7 +204,7 @@ RES=$?
|
||||
|
||||
if [ $RES -eq 0 ]; then
|
||||
# virtio-mmio based testing
|
||||
cargo build --release --target $BUILD_TARGET --no-default-features --features "mmio"
|
||||
cargo build --release --target $BUILD_TARGET --no-default-features --features "mmio,kvm"
|
||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||
strip target/$BUILD_TARGET/release/ch-remote
|
||||
@@ -212,12 +212,12 @@ if [ $RES -eq 0 ]; then
|
||||
sudo setcap cap_net_admin+ep target/$BUILD_TARGET/release/cloud-hypervisor
|
||||
|
||||
# Ensure test binary has the same caps as the cloud-hypervisor one
|
||||
time cargo test --no-run --no-default-features --features "integration_tests,mmio" -- --nocapture || exit 1
|
||||
time cargo test --no-run --no-default-features --features "integration_tests,mmio,kvm" -- --nocapture || exit 1
|
||||
ls target/debug/deps/cloud_hypervisor-* | xargs -n 1 sudo setcap cap_net_admin+ep
|
||||
|
||||
newgrp kvm << EOF
|
||||
export RUST_BACKTRACE=1
|
||||
time cargo test --no-default-features --features "integration_tests,mmio" "tests::parallel::test_aarch64_pe_boot" -- --nocapture
|
||||
time cargo test --no-default-features --features "integration_tests,mmio,kvm" "tests::parallel::test_aarch64_pe_boot" -- --nocapture
|
||||
EOF
|
||||
|
||||
RES=$?
|
||||
|
||||
@@ -249,7 +249,7 @@ fi
|
||||
|
||||
if [ $RES -eq 0 ]; then
|
||||
# virtio-mmio based testing
|
||||
cargo build --all --release --target $BUILD_TARGET --no-default-features --features "mmio"
|
||||
cargo build --all --release --target $BUILD_TARGET --no-default-features --features "mmio,kvm"
|
||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||
strip target/$BUILD_TARGET/release/ch-remote
|
||||
|
||||
@@ -5,7 +5,7 @@ source $HOME/.cargo/env
|
||||
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
||||
cargo_args=("$@")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--features mmio")
|
||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--features mmio,kvm")
|
||||
[ $(uname -m) = "aarch64" ] && sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
||||
|
||||
cargo test --target $BUILD_TARGET --workspace --no-run ${cargo_args[@]}
|
||||
|
||||
Reference in New Issue
Block a user