mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
ci: Pass target triple to the test scripts
We pass it to the integration and unit tests script through --libc. Cargo tests are left unmodified. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
33b0e15804
commit
ce794f7858
@ -3,6 +3,8 @@ set -x
|
||||
|
||||
source $HOME/.cargo/env
|
||||
|
||||
export BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
||||
|
||||
WORKLOADS_DIR="$HOME/workloads"
|
||||
mkdir -p "$WORKLOADS_DIR"
|
||||
|
||||
@ -208,13 +210,13 @@ sudo ip tuntap add name vunet-tap0 mode tap
|
||||
# Create tap interface with multipe queues support for vhost_user_net test.
|
||||
sudo ip tuntap add name vunet-tap1 mode tap multi_queue
|
||||
|
||||
cargo build --release
|
||||
sudo setcap cap_net_admin+ep target/release/cloud-hypervisor
|
||||
sudo setcap cap_net_admin+ep target/release/vhost_user_net
|
||||
cargo build --release --target $BUILD_TARGET
|
||||
sudo setcap cap_net_admin+ep target/$BUILD_TARGET/release/cloud-hypervisor
|
||||
sudo setcap cap_net_admin+ep target/$BUILD_TARGET/release/vhost_user_net
|
||||
|
||||
# We always copy a fresh version of our binary for our L2 guest.
|
||||
cp target/release/cloud-hypervisor $VFIO_DIR
|
||||
cp target/release/ch-remote $VFIO_DIR
|
||||
cp target/$BUILD_TARGET/release/cloud-hypervisor $VFIO_DIR
|
||||
cp target/$BUILD_TARGET/release/ch-remote $VFIO_DIR
|
||||
|
||||
# Enable KSM with some reasonable parameters so that it won't take too long
|
||||
# for the memory to be merged between two processes.
|
||||
@ -239,8 +241,8 @@ RES=$?
|
||||
|
||||
if [ $RES -eq 0 ]; then
|
||||
# virtio-mmio based testing
|
||||
cargo build --release --no-default-features --features "mmio"
|
||||
sudo setcap cap_net_admin+ep target/release/cloud-hypervisor
|
||||
cargo build --release --target $BUILD_TARGET --no-default-features --features "mmio"
|
||||
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 --features "integration_tests,mmio" -- --nocapture || exit 1
|
||||
|
@ -2,13 +2,15 @@
|
||||
|
||||
source $HOME/.cargo/env
|
||||
|
||||
cargo test --workspace --no-run
|
||||
pushd target/debug
|
||||
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
||||
|
||||
cargo test --target $BUILD_TARGET --workspace --no-run
|
||||
pushd target/$BUILD_TARGET/debug
|
||||
ls | grep net_util | grep -v "\.d" | xargs -n 1 sudo setcap cap_net_admin,cap_net_raw+ep
|
||||
popd
|
||||
|
||||
sudo adduser $USER kvm
|
||||
newgrp kvm << EOF || exit 1
|
||||
export RUST_BACKTRACE=1
|
||||
cargo test --workspace "$@" || exit 1;
|
||||
cargo test --target $BUILD_TARGET --workspace "$@" || exit 1;
|
||||
EOF
|
||||
|
@ -18,6 +18,7 @@ extern crate lazy_static;
|
||||
mod tests {
|
||||
#![allow(dead_code)]
|
||||
use ssh2::Session;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
@ -130,6 +131,13 @@ mod tests {
|
||||
Err(io::Error::last_os_error())
|
||||
}
|
||||
|
||||
fn clh_command(cmd: &str) -> String {
|
||||
env::var("BUILD_TARGET").map_or(
|
||||
format!("target/x86_64-unknown-linux-gnu/release/{}", cmd),
|
||||
|target| format!("target/{}/release/{}", target, cmd),
|
||||
)
|
||||
}
|
||||
|
||||
impl DiskConfig for ClearDiskConfig {
|
||||
fn prepare_cloudinit(&self, tmp_dir: &TempDir, network: &GuestNetworkConfig) -> String {
|
||||
let cloudinit_file_path =
|
||||
@ -358,7 +366,7 @@ mod tests {
|
||||
String::from(tmp_dir.path().join("virtiofs.sock").to_str().unwrap());
|
||||
|
||||
// Start the daemon
|
||||
let child = Command::new("target/release/vhost_user_fs")
|
||||
let child = Command::new(clh_command("vhost_user_fs"))
|
||||
.args(&["--shared-dir", shared_dir])
|
||||
.args(&["--sock", virtiofsd_socket_path.as_str()])
|
||||
.spawn()
|
||||
@ -386,7 +394,7 @@ mod tests {
|
||||
let vubd_socket_path = String::from(tmp_dir.path().join("vub.sock").to_str().unwrap());
|
||||
|
||||
// Start the daemon
|
||||
let child = Command::new("target/release/cloud-hypervisor")
|
||||
let child = Command::new(clh_command("cloud-hypervisor"))
|
||||
.args(&[
|
||||
"--block-backend",
|
||||
format!(
|
||||
@ -445,7 +453,7 @@ mod tests {
|
||||
)
|
||||
};
|
||||
|
||||
let child = Command::new("target/release/cloud-hypervisor")
|
||||
let child = Command::new(clh_command("cloud-hypervisor"))
|
||||
.args(&["--net-backend", net_params.as_str()])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
@ -477,7 +485,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn remote_command(api_socket: &str, command: &str, arg: Option<&str>) -> bool {
|
||||
let mut cmd = Command::new("target/release/ch-remote");
|
||||
let mut cmd = Command::new(clh_command("ch-remote"));
|
||||
cmd.args(&[&format!("--api-socket={}", api_socket), command]);
|
||||
|
||||
if let Some(arg) = arg {
|
||||
@ -492,7 +500,7 @@ mod tests {
|
||||
desired_vcpus: Option<u8>,
|
||||
desired_ram: Option<usize>,
|
||||
) -> bool {
|
||||
let mut cmd = Command::new("target/release/ch-remote");
|
||||
let mut cmd = Command::new(clh_command("ch-remote"));
|
||||
cmd.args(&[&format!("--api-socket={}", api_socket), "resize"]);
|
||||
|
||||
if let Some(desired_vcpus) = desired_vcpus {
|
||||
@ -813,7 +821,7 @@ mod tests {
|
||||
impl<'a> GuestCommand<'a> {
|
||||
fn new(guest: &'a Guest) -> Self {
|
||||
Self {
|
||||
command: Command::new("target/release/cloud-hypervisor"),
|
||||
command: Command::new(clh_command("cloud-hypervisor")),
|
||||
guest,
|
||||
capture_output: false,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user