summary refs log tree commit diff
path: root/tests/plugins.rs
diff options
context:
space:
mode:
authorMatt Delco <delco@chromium.org>2019-11-01 16:45:46 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-06 23:01:15 +0000
commita52b2a6c8167eebb285b70b54077919bbf113a35 (patch)
tree600d2fec69fd89e3216a84b2bc64de510c7f9207 /tests/plugins.rs
parent1de9cb53e1eccfaf138553c45a800f26927663bb (diff)
downloadcrosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar.gz
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar.bz2
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar.lz
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar.xz
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.tar.zst
crosvm-a52b2a6c8167eebb285b70b54077919bbf113a35.zip
crosvm: add plugin API for async writes
A plugin might care to be immediately notified when a write
is made to a port, but it doesn't care to have the VM stopped
while the plugin calls back to resume the VM.

Unfortunately this means that multiple messages can be queued up in the
pipe and read() together by the plugin API.  Protobuf's parsing function
doesn't report how many bytes it read, so I've resorted to having crosvm
prefix every message with a length and then have the plugin lib parse
this number.  Impact on performance has not been measured.

BUG=b:143294496
TEST=Local build and run of build_test.  Verified that new unit
test was executed, exercised the case where multiple msgs are
received together, and completed successfully.

Change-Id: If6ef463e7b4d2e688e649f832a764fa644bf2d36
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1896376
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Diffstat (limited to 'tests/plugins.rs')
-rw-r--r--tests/plugins.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/plugins.rs b/tests/plugins.rs
index 47b0ca3..d56f4ce 100644
--- a/tests/plugins.rs
+++ b/tests/plugins.rs
@@ -231,6 +231,11 @@ fn test_hint() {
 }
 
 #[test]
+fn test_async_write() {
+    test_plugin(include_str!("plugin_async_write.c"));
+}
+
+#[test]
 fn test_dirty_log() {
     test_plugin(include_str!("plugin_dirty_log.c"));
 }