mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-07 10:15:45 +00:00
tests: Address Rust 1.51.0 clippy issue (needless_question_mark)
error: Question mark operator is useless here --> tests/integration.rs:494:13 | 494 | / Ok(self 495 | | .ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? 496 | | .trim() 497 | | .parse() 498 | | .map_err(Error::Parsing)?) | |__________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
c5d15fd938
commit
5c010d489d
@ -475,50 +475,45 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_cpu_count(&self) -> Result<u32, Error> {
|
fn get_cpu_count(&self) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command("grep -c processor /proc/cpuinfo")?
|
||||||
.ssh_command("grep -c processor /proc/cpuinfo")?
|
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_initial_apicid(&self) -> Result<u32, Error> {
|
fn get_initial_apicid(&self) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command("grep \"initial apicid\" /proc/cpuinfo | grep -o \"[0-9]*\"")?
|
||||||
.ssh_command("grep \"initial apicid\" /proc/cpuinfo | grep -o \"[0-9]*\"")?
|
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_total_memory(&self) -> Result<u32, Error> {
|
fn get_total_memory(&self) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
|
||||||
.ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
|
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_total_memory_l2(&self) -> Result<u32, Error> {
|
fn get_total_memory_l2(&self) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command_l2_1("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
|
||||||
.ssh_command_l2_1("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
|
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_numa_node_memory(&self, node_id: usize) -> Result<u32, Error> {
|
fn get_numa_node_memory(&self, node_id: usize) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command(
|
||||||
.ssh_command(
|
format!(
|
||||||
format!(
|
"grep MemTotal /sys/devices/system/node/node{}/meminfo \
|
||||||
"grep MemTotal /sys/devices/system/node/node{}/meminfo \
|
|
||||||
| cut -d \":\" -f 2 | grep -o \"[0-9]*\"",
|
| cut -d \":\" -f 2 | grep -o \"[0-9]*\"",
|
||||||
node_id
|
node_id
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
)?
|
)?
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_vm_boot(&self, custom_timeout: Option<i32>) -> Result<(), Error> {
|
fn wait_vm_boot(&self, custom_timeout: Option<i32>) -> Result<(), Error> {
|
||||||
@ -590,11 +585,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_entropy(&self) -> Result<u32, Error> {
|
fn get_entropy(&self) -> Result<u32, Error> {
|
||||||
Ok(self
|
self.ssh_command("cat /proc/sys/kernel/random/entropy_avail")?
|
||||||
.ssh_command("cat /proc/sys/kernel/random/entropy_avail")?
|
|
||||||
.trim()
|
.trim()
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(Error::Parsing)?)
|
.map_err(Error::Parsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pci_bridge_class(&self) -> Result<String, Error> {
|
fn get_pci_bridge_class(&self) -> Result<String, Error> {
|
||||||
@ -4992,8 +4986,7 @@ mod tests {
|
|||||||
let mut workload_path = dirs::home_dir().unwrap();
|
let mut workload_path = dirs::home_dir().unwrap();
|
||||||
workload_path.push("workloads");
|
workload_path.push("workloads");
|
||||||
|
|
||||||
let mut kernels = vec![];
|
let mut kernels = vec![direct_kernel_boot_path()];
|
||||||
kernels.push(direct_kernel_boot_path());
|
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user