summary refs log tree commit diff
path: root/kvm/tests/real_run_adder.rs
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2019-10-22 18:30:36 +0300
committerCommit Bot <commit-bot@chromium.org>2019-12-10 05:16:06 +0000
commitbb30b2f7cf2721b32da71adfa7f7482bfce7b915 (patch)
treee364b4b3d1e605ec1aa7ba032e1d3211cd12ca18 /kvm/tests/real_run_adder.rs
parent7434c0002022541f34a929d9a8e3bfaaf4dfc2d9 (diff)
downloadcrosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar.gz
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar.bz2
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar.lz
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar.xz
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.tar.zst
crosvm-bb30b2f7cf2721b32da71adfa7f7482bfce7b915.zip
Add runnable vcpu
Add a new type `RunnableVcpu` for a vcpu that is bound to a thread. This
adds type safety to ensure that vcpus are only ever run on one thread
because RunnableVcpu can't `Send`. It also ensures multiple vcpus can't
run on the same thread.

Change-Id: Ia50dc127bc7a4ea4ce3ca99ef1062edbcaa912d0
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898909
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'kvm/tests/real_run_adder.rs')
-rw-r--r--kvm/tests/real_run_adder.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/kvm/tests/real_run_adder.rs b/kvm/tests/real_run_adder.rs
index a419ad9..60869ed 100644
--- a/kvm/tests/real_run_adder.rs
+++ b/kvm/tests/real_run_adder.rs
@@ -49,8 +49,9 @@ fn test_run() {
     vcpu.set_regs(&vcpu_regs).expect("set regs failed");
 
     let mut out = String::new();
+    let runnable_vcpu = vcpu.to_runnable(None).unwrap();
     loop {
-        match vcpu.run().expect("run failed") {
+        match runnable_vcpu.run().expect("run failed") {
             VcpuExit::IoOut {
                 port: 0x3f8,
                 size,