Skip to content

Commit fb14c25

Browse files
vmm: implement test method in mod tests
The functions get_kernel_cmdline and remove_addr are only used in tests, but they were defined in the Vmm implementation. Add a test implementation for Vmm in mod tests for these functions because otherwise they are included in the coverage report. Signed-off-by: Andreea Florescu <[email protected]>
1 parent af18e51 commit fb14c25

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

vmm/src/lib.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,23 +1501,6 @@ impl Vmm {
15011501

15021502
Ok(())
15031503
}
1504-
1505-
#[cfg(test)]
1506-
fn get_kernel_cmdline(&self) -> &str {
1507-
if let Some(ref k) = self.kernel_config {
1508-
k.cmdline.as_str()
1509-
} else {
1510-
""
1511-
}
1512-
}
1513-
1514-
#[cfg(test)]
1515-
fn remove_addr(&mut self, id: &String) {
1516-
self.mmio_device_manager
1517-
.as_mut()
1518-
.unwrap()
1519-
.remove_address(id);
1520-
}
15211504
}
15221505

15231506
/// Starts a new vmm thread that can service API requests.
@@ -1570,6 +1553,23 @@ mod tests {
15701553
use devices::virtio::ActivateResult;
15711554
use net_util::MacAddr;
15721555

1556+
impl Vmm {
1557+
fn get_kernel_cmdline(&self) -> &str {
1558+
if let Some(ref k) = self.kernel_config {
1559+
k.cmdline.as_str()
1560+
} else {
1561+
""
1562+
}
1563+
}
1564+
1565+
fn remove_addr(&mut self, id: &String) {
1566+
self.mmio_device_manager
1567+
.as_mut()
1568+
.unwrap()
1569+
.remove_address(id);
1570+
}
1571+
}
1572+
15731573
struct DummyEpollHandler {
15741574
pub evt: Option<DeviceEventT>,
15751575
pub flags: Option<u32>,

0 commit comments

Comments
 (0)