Skip to content

Commit

Permalink
Remove memory size unit tests
Browse files Browse the repository at this point in the history
These tests are obsolete once the guest memory minimum is enforced.

Replacing these tests is tracked in #265.
  • Loading branch information
mkroening committed Jan 3, 2022
1 parent b6b1193 commit 80f9c2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 72 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v2
- name: Test
run: |
cargo test --lib -- --skip test_vm
cargo test --lib
cargo test --bins --examples
cargo test --doc
Expand All @@ -55,11 +55,8 @@ jobs:
sudo apt-get update
sudo apt-get install -y --no-install-recommends gdb
- uses: actions/checkout@v2
with:
lfs: true
- run: git lfs checkout benches_data/hello_world
- name: Integration Tests
run: cargo test --lib --test '*'
run: cargo test --test '*'

rusty_demo:
name: rusty_demo
Expand Down Expand Up @@ -133,9 +130,6 @@ jobs:
sudo apt-get update
sudo apt-get install -y --no-install-recommends gdb
- uses: actions/checkout@v2
with:
lfs: true
- run: git lfs checkout benches_data/hello_world
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Generate code coverage
Expand Down
64 changes: 0 additions & 64 deletions src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,67 +579,3 @@ pub trait Vm {
Ok(())
}
}

#[cfg(test)]
mod tests {
#[cfg(target_os = "linux")]
use crate::vm::Vm;

#[cfg(target_os = "linux")]
#[test]
fn test_vm_load_min_size_1024() {
let path = [env!("CARGO_MANIFEST_DIR"), "benches_data/hello_world"]
.iter()
.collect();
let res = crate::Uhyve::new(
path,
&crate::vm::Parameter {
mem_size: 1024,
num_cpus: 1,
verbose: false,
hugepage: true,
mergeable: false,
ip: None,
gateway: None,
mask: None,
nic: None,
gdbport: None,
},
);
// EINVAL 22 Invalid argument
assert_eq!(kvm_ioctls::Error::new(22), res.unwrap_err());
}

#[cfg(target_os = "linux")]
#[test]
fn test_vm_load_min_size_102400() {
let path = [env!("CARGO_MANIFEST_DIR"), "benches_data/hello_world"]
.iter()
.collect();
let mut vm = crate::Uhyve::new(
path,
&crate::vm::Parameter {
mem_size: 102400,
num_cpus: 1,
verbose: false,
hugepage: true,
mergeable: false,
ip: None,
gateway: None,
mask: None,
nic: None,
gdbport: None,
},
)
.expect("Unable to create VM");
let res = unsafe { vm.load_kernel() };
match res.unwrap_err() {
crate::vm::LoadKernelError::InsufficientMemory => {}
err => panic!(
"Expected {:?}, got {:?}",
crate::vm::LoadKernelError::InsufficientMemory,
err
),
}
}
}

0 comments on commit 80f9c2a

Please sign in to comment.