mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-30 17:49:08 +00:00
Merge branch 'main' into dependabot/cargo/clap-3.1.0
This commit is contained in:
commit
97ac597adb
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -134,9 +134,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.117"
|
||||
version = "0.2.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
|
||||
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
|
||||
@ -163,9 +163,9 @@ impl TryFrom<I2cArgs> for I2cConfiguration {
|
||||
return Err(Error::SocketCountInvalid(0));
|
||||
}
|
||||
|
||||
let devices = AdapterConfig::try_from(args.device_list.as_str())?;
|
||||
let devices = AdapterConfig::try_from(args.device_list.trim())?;
|
||||
Ok(I2cConfiguration {
|
||||
socket_path: args.socket_path,
|
||||
socket_path: args.socket_path.trim().to_string(),
|
||||
socket_count: args.socket_count,
|
||||
devices,
|
||||
})
|
||||
@ -324,6 +324,12 @@ mod tests {
|
||||
fn test_parse_successful() {
|
||||
let socket_name = "vi2c.sock";
|
||||
|
||||
// Space before and after the device list and socket name
|
||||
let cmd_args = I2cArgs::from_args(" ./vi2c.sock", " 1:4 ", 1);
|
||||
let config = I2cConfiguration::try_from(cmd_args).unwrap();
|
||||
Listener::new(config.socket_path, true).unwrap();
|
||||
|
||||
// Valid configuration
|
||||
let cmd_args = I2cArgs::from_args(socket_name, "1:4,2:32:21,5:5:23", 5);
|
||||
let config = I2cConfiguration::try_from(cmd_args).unwrap();
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit d216a46879096a4f1e83af3a7b6c90c26e1a688d
|
||||
Subproject commit ee6be8ca18bdfd9de294652472307c6776194f89
|
||||
Loading…
Reference in New Issue
Block a user