devices: vhost-user: Add a test case for ClientExit

The vhost-user VMM process is supposed to stop before the device
process, and the device process is supposed to get
`vmm_vhost::Error::ClientExit` when the VMM stops. Add the check in the
existing unit test.

BUG=b:219674197
BUG=b:220639724
TEST=cargo test in /devices/

Change-Id: I1768b9b43855e3b80f1e6e175877317338309e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543005
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2022-03-23 00:14:57 +09:00 committed by Chromeos LUCI
parent 6cda440730
commit 52a0f3b1e8

View file

@ -997,6 +997,9 @@ mod tests {
.unwrap();
}
// The VMM side is supposed to stop before the device side.
drop(vmm_handler);
vmm_bar.wait();
});
@ -1035,5 +1038,10 @@ mod tests {
}
dev_bar.wait();
match listener.handle_request() {
Err(VhostError::ClientExit) => (),
r => panic!("Err(ClientExit) was expected but {:?}", r),
}
}
}