vhost/kernel: handle EADDRINUSE in set_guest_cid test
When running tests in parallel (e.g. in CI), set_guest_cid() can fail with EADDRINUSE if another test or VM already claimed the same CID. From the test's perspective this is still a successful outcome: the ioctl was issued correctly and the kernel rejected it for a valid reason, so the code path is exercised either way. Rather than complicating the test by retrying with different CIDs, skip the assertion gracefully. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
parent
93e2d9cf91
commit
e01ece1a60
1 changed files with 7 additions and 1 deletions
|
|
@ -189,7 +189,13 @@ mod tests {
|
|||
vsock.set_vring_kick(0, &eventfd).unwrap();
|
||||
vsock.set_vring_err(0, &eventfd).unwrap();
|
||||
assert_eq!(vsock.get_vring_base(0).unwrap(), 1);
|
||||
vsock.set_guest_cid(0xdead).unwrap();
|
||||
match vsock.set_guest_cid(0xdead) {
|
||||
Ok(()) => {}
|
||||
Err(Error::IoctlError(e)) if e.raw_os_error() == Some(libc::EADDRINUSE) => {
|
||||
println!("set_guest_cid: CID already in use (e.g. by the same test running for another target/architecture in CI), skipping");
|
||||
}
|
||||
Err(e) => panic!("set_guest_cid failed: {:?}", e),
|
||||
}
|
||||
//vsock.start().unwrap();
|
||||
//vsock.stop().unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue