arch-x86, cpu-kvm: add x86 kvm test to long regression
authormichaelupton <michaelupton@gmail.com>
Sun, 20 Sep 2020 22:58:36 +0000 (15:58 -0700)
committermike upton <michaelupton@gmail.com>
Fri, 6 Nov 2020 18:21:39 +0000 (18:21 +0000)
revised patch based on reviews

Change-Id: I18d219080ff8ab1c42c9e1a12aadd89606802b25
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34855
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: mike upton <michaelupton@gmail.com>
tests/gem5/x86-boot-tests/test_linux_boot.py

index d73f3a1202a5c4882588143a79341eec29666103..94b6e7eff02c34474db9c9693e5bfa78e5a5edf0 100644 (file)
@@ -25,7 +25,9 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
+import subprocess
 from testlib import *
+import platform
 
 
 if config.bin_path:
@@ -43,8 +45,10 @@ kernel_name = 'vmlinux-4.19.83' # 4.19 is LTS (Projected EOL: Dec, 2020)
 image = DownloadedProgram(image_url, base_path, image_name, True)
 kernel = DownloadedProgram(kernel_url, base_path, kernel_name)
 
+def support_kvm():
+    return os.access("/dev/kvm", os.R_OK | os.W_OK)
 
-def test_boot(cpu_type, num_cpus, boot_type):
+def test_boot(cpu_type, num_cpus, boot_type, host):
     gem5_verify_config(
         name = 'test-ubuntu_boot-' + cpu_type + '_cpu-' + num_cpus + '_cpus-'
                + boot_type + '_boot',
@@ -59,14 +63,19 @@ def test_boot(cpu_type, num_cpus, boot_type):
             '--boot-type', boot_type,
         ],
         valid_isas = ('X86',),
-        valid_hosts = constants.supported_hosts,
+        valid_hosts = host,
         length = constants.long_tag,
     )
 
 # Test every CPU type
 cpu_types = ('atomic', 'simple',)
 for cpu_type in cpu_types:
-    test_boot(cpu_type, '1', 'init')
+    test_boot(cpu_type, '1', 'init', constants.supported_hosts)
 
 # Test a multicore system
-test_boot('atomic', '4', 'systemd')
+test_boot('atomic', '4', 'systemd', constants.supported_hosts)
+
+#KVM
+if(support_kvm() and (platform.machine() == constants.host_x86_64_tag)):
+    test_boot('kvm', '1', 'init', (constants.host_x86_64_tag,))
+    test_boot('kvm', '4', 'systemd', (constants.host_x86_64_tag,))