From dc83d234254861f142854bdf523581101c3d5c8d Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 22 Apr 2013 13:20:32 -0400 Subject: tests: Add support for testing KVM-based CPUs This changeset adds support for initializing a KVM VM in the BaseSystem test class and adds the following methods in run.py: require_file -- Test if a file exists and abort/skip if not. require_kvm -- Test if KVM support has been compiled into gem5 (i.e., BaseKvmCPU exists) and the KVM device exists on the host. --- tests/configs/base_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/configs/base_config.py') diff --git a/tests/configs/base_config.py b/tests/configs/base_config.py index 370b76c46..b4c400a45 100644 --- a/tests/configs/base_config.py +++ b/tests/configs/base_config.py @@ -43,6 +43,8 @@ m5.util.addToPath('../configs/common') import FSConfig from Caches import * +_have_kvm_support = 'BaseKvmCPU' in globals() + class BaseSystem(object): """Base system builder. @@ -111,6 +113,14 @@ class BaseSystem(object): """ cpu.createInterruptController() + def init_kvm(self, system): + """Do KVM-specific system initialization. + + Arguments: + system -- System to work on. + """ + system.vm = KvmVM() + def init_system(self, system): """Initialize a system. @@ -119,6 +129,10 @@ class BaseSystem(object): """ system.cpu = self.create_cpus() + if _have_kvm_support and \ + any([isinstance(c, BaseKvmCPU) for c in system.cpu]): + self.init_kvm(system) + sha_bus = self.create_caches_shared(system) for cpu in system.cpu: if not cpu.switched_out: -- cgit v1.2.3