summary refs log tree commit diff
path: root/hypervisor/tests/types.rs
diff options
context:
space:
mode:
authorSteven Richman <srichman@google.com>2020-05-01 17:30:24 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-09 06:23:33 +0000
commite1f8d9187d3f16e31d0c1304030ad412cf43b2bf (patch)
tree45b8606c4d9fb31a4d4d335d8e0ea3bb31a6d9c2 /hypervisor/tests/types.rs
parenta7469062a2b25541cfe887f55441284553659ea0 (diff)
downloadcrosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.gz
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.bz2
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.lz
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.xz
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.zst
crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.zip
hypervisor: add Vm/Vcpu traits and Kvm impls
Add arch-agnostic traits Vm and Vcpu.  Add arch-specific traits
HypervisorXXX, VmXXX, VcpuXXX, with impls for KVM.

BUG=chromium:1077058
TEST=added test for functions and structs interacting with the traits

Change-Id: I809f42f32a558c7835831c90e24fca82ce7744ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2176562
Reviewed-by: Udam Saini <udam@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Steven Richman <srichman@google.com>
Diffstat (limited to 'hypervisor/tests/types.rs')
-rw-r--r--hypervisor/tests/types.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/hypervisor/tests/types.rs b/hypervisor/tests/types.rs
new file mode 100644
index 0000000..d9272af
--- /dev/null
+++ b/hypervisor/tests/types.rs
@@ -0,0 +1,18 @@
+// Copyright 2020 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+use hypervisor::*;
+
+pub struct HyperVm<HyperT, VmT, VcpuT>
+where
+    HyperT: Hypervisor,
+    VmT: Vm,
+    VcpuT: Vcpu,
+{
+    pub hypervisor: HyperT,
+    pub vm: VmT,
+    pub vcpus: Vec<VcpuT>,
+}
+
+pub struct RunnableLinuxVm {}