2019-07-16 09:54:33 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source $HOME/.cargo/env
|
|
|
|
|
2020-04-21 06:02:58 +00:00
|
|
|
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
2020-06-12 00:58:50 +00:00
|
|
|
cargo_args=("$@")
|
|
|
|
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
2020-07-07 11:06:40 +00:00
|
|
|
[ $(uname -m) = "aarch64" ] && cargo_args+=("--features mmio,kvm")
|
2020-06-17 10:16:19 +00:00
|
|
|
[ $(uname -m) = "aarch64" ] && sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
2020-04-21 06:02:58 +00:00
|
|
|
|
2020-06-12 00:58:50 +00:00
|
|
|
cargo test --target $BUILD_TARGET --workspace --no-run ${cargo_args[@]}
|
2020-04-21 06:02:58 +00:00
|
|
|
pushd target/$BUILD_TARGET/debug
|
2019-07-19 07:57:20 +00:00
|
|
|
ls | grep net_util | grep -v "\.d" | xargs -n 1 sudo setcap cap_net_admin,cap_net_raw+ep
|
2019-07-16 09:54:33 +00:00
|
|
|
popd
|
|
|
|
|
2019-08-16 14:11:47 +00:00
|
|
|
sudo adduser $USER kvm
|
|
|
|
newgrp kvm << EOF || exit 1
|
2019-08-16 15:08:16 +00:00
|
|
|
export RUST_BACKTRACE=1
|
2020-06-12 00:58:50 +00:00
|
|
|
cargo test --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1;
|
2019-08-16 14:11:47 +00:00
|
|
|
EOF
|