Skip to content

Commit 3c724e5

Browse files
committed
feat: switch to a per-device metrics model for vsock and rng devices
to allow for running vmm tests in parallel Signed-off-by: aerosouund <aerosound161@gmail.com>
1 parent f0691f8 commit 3c724e5

10 files changed

Lines changed: 487 additions & 167 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/vmm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ log = { version = "0.4.29", features = ["std", "serde"] }
4040
log-instrument = { path = "../log-instrument", optional = true }
4141
memfd = "0.6.5"
4242
micro_http = { git = "https://github.com/firecracker-microvm/micro-http" }
43+
regex = "1"
4344
pci = { path = "../pci" }
4445
semver = { version = "1.0.27", features = ["serde"] }
4546
serde = { version = "1.0.228", features = ["derive", "rc"] }

src/vmm/src/devices/virtio/net/tap.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ pub mod tests {
221221

222222
use std::os::unix::ffi::OsStrExt;
223223

224+
use regex::Regex;
225+
224226
use super::*;
227+
225228
use crate::devices::virtio::net::generated;
226229
use crate::devices::virtio::net::test_utils::{TapTrafficSimulator, enable, if_index};
227230

@@ -241,10 +244,16 @@ pub mod tests {
241244
generated::ifreq__bindgen_ty_1::default().ifrn_name.len()
242245
});
243246

244-
// Empty name - The tap should be named "tap0" by default
247+
// Empty name - The tap should be named by the kernel (e.g., "tap0", "tap1", etc.)
245248
let tap = Tap::open_named("").unwrap();
246-
assert_eq!(b"tap0\0\0\0\0\0\0\0\0\0\0\0\0", &tap.if_name);
247-
assert_eq!("tap0", tap.if_name_as_str());
249+
let tap_name_str = tap.if_name_as_str();
250+
251+
// Check that it starts with "tap" and the remainder is numeric.
252+
assert!(
253+
Regex::new(r"^tap\d+$").unwrap().is_match(tap_name_str),
254+
"Generated tap name '{}' does not match expected pattern",
255+
tap_name_str
256+
);
248257

249258
// Test using '%d' to have the kernel assign an unused name,
250259
// and that we correctly copy back that generated name

0 commit comments

Comments
 (0)