tests: Move test_infra from a module to crate

It must be specified as excluded from the workspace as it must not be
built on non-test targets due to issues with the ssh2 dependency and the
musl toolchain.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-03-23 16:15:48 +00:00 committed by Sebastien Boeuf
parent 91145afa9b
commit 88c30764e0
5 changed files with 30 additions and 4 deletions

14
Cargo.lock generated
View File

@ -230,7 +230,7 @@ dependencies = [
"seccomp",
"serde_json",
"signal-hook",
"ssh2",
"test_infra",
"thiserror",
"vm-memory",
"vmm",
@ -1098,6 +1098,18 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "test_infra"
version = "0.1.0"
dependencies = [
"dirs",
"epoll",
"libc",
"ssh2",
"vmm-sys-util",
"wait-timeout",
]
[[package]]
name = "textwrap"
version = "0.11.0"

View File

@ -43,7 +43,7 @@ dirs = "3.0.1"
lazy_static= "1.4.0"
net_util = { path = "net_util" }
serde_json = "1.0.64"
ssh2 = "0.9.1"
test_infra = { path = "test_infra" }
wait-timeout = "0.2.0"
[features]
@ -86,3 +86,4 @@ members = [
"vm-migration",
"vm-virtio"
]
exclude = ["test_infra"]

13
test_infra/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "test_infra"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
[dependencies]
dirs = "3.0.1"
epoll = "4.3.1"
libc = "0.2.91"
ssh2 = "0.9.1"
vmm-sys-util = "0.8.0"
wait-timeout = "0.2.0"

View File

@ -10,12 +10,11 @@ extern crate lazy_static;
#[cfg(test)]
#[cfg(feature = "integration_tests")]
mod test_infra;
extern crate test_infra;
#[cfg(test)]
#[cfg(feature = "integration_tests")]
mod tests {
use crate::test_infra::*;
use net_util::MacAddr;
use std::collections::HashMap;
use std::env;
@ -31,6 +30,7 @@ mod tests {
use std::sync::mpsc::Receiver;
use std::sync::{mpsc, Mutex};
use std::thread;
use test_infra::*;
use vmm_sys_util::{tempdir::TempDir, tempfile::TempFile};
#[cfg_attr(target_arch = "aarch64", allow(unused_imports))]
use wait_timeout::ChildExt;