thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-tests-avocado-update-aarch64_virt-test-to-exercise-c.patch

586cba
From f52aa60217634c96fef59ce76b803a94610bf5c8 Mon Sep 17 00:00:00 2001
586cba
From: Andrew Jones <drjones@redhat.com>
586cba
Date: Wed, 15 Jun 2022 15:28:27 +0200
586cba
Subject: [PATCH 01/18] tests/avocado: update aarch64_virt test to exercise
586cba
 -cpu max
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Daniel P. Berrangé <berrange@redhat.com>
586cba
RH-MergeRequest: 94: i386, aarch64, s390x: deprecate many named CPU models
586cba
RH-Commit: [1/6] df6839e567180a4c32afd98852f68b2279e00f7c (berrange/centos-src-qemu)
586cba
RH-Bugzilla: 2060839
586cba
RH-Acked-by: Thomas Huth <thuth@redhat.com>
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
586cba
586cba
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066824
586cba
586cba
commit 11593544df6f8febb3ce87015c22b429bf43c4c7
586cba
Author: Alex Bennée <alex.bennee@linaro.org>
586cba
Date:   Tue Apr 19 10:09:56 2022 +0100
586cba
586cba
    tests/avocado: update aarch64_virt test to exercise -cpu max
586cba
586cba
    The Fedora 29 kernel is quite old and importantly fails when running
586cba
    in LPA2 scenarios. As it's not really exercising much of the CPU space
586cba
    replace it with a custom 5.16.12 kernel with all the architecture
586cba
    options turned on. There is a minimal buildroot initramfs included in
586cba
    the kernel which has a few tools for stress testing the memory
586cba
    subsystem. The userspace also targets the Neoverse N1 processor so
586cba
    would fail with a v8.0 cpu like cortex-a53.
586cba
586cba
    While we are at it move the test into its own file so it can have an
586cba
    assigned maintainer.
586cba
586cba
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
586cba
    Acked-by: Richard Henderson <richard.henderson@linaro.org>
586cba
    Tested-by: Richard Henderson <richard.henderson@linaro.org>
586cba
    Message-Id: <20220419091020.3008144-2-alex.bennee@linaro.org>
586cba
586cba
Signed-off-by: Andrew Jones <drjones@redhat.com>
586cba
---
586cba
 MAINTAINERS                           |  1 +
586cba
 tests/avocado/boot_linux_console.py   | 25 -------------
586cba
 tests/avocado/machine_aarch64_virt.py | 51 +++++++++++++++++++++++++++
586cba
 3 files changed, 52 insertions(+), 25 deletions(-)
586cba
 create mode 100644 tests/avocado/machine_aarch64_virt.py
586cba
586cba
diff --git a/MAINTAINERS b/MAINTAINERS
586cba
index 2fe20a49ab..bfe8806f60 100644
586cba
--- a/MAINTAINERS
586cba
+++ b/MAINTAINERS
586cba
@@ -942,6 +942,7 @@ S: Maintained
586cba
 F: hw/arm/virt*
586cba
 F: include/hw/arm/virt.h
586cba
 F: docs/system/arm/virt.rst
586cba
+F: tests/avocado/machine_aarch64_virt.py
586cba
 
586cba
 Xilinx Zynq
586cba
 M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
586cba
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
586cba
index b40a3abc81..45a2ceda22 100644
586cba
--- a/tests/avocado/boot_linux_console.py
586cba
+++ b/tests/avocado/boot_linux_console.py
586cba
@@ -325,31 +325,6 @@ def test_mips_malta32el_nanomips_64k_dbg(self):
586cba
         kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
586cba
         self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
586cba
 
586cba
-    def test_aarch64_virt(self):
586cba
-        """
586cba
-        :avocado: tags=arch:aarch64
586cba
-        :avocado: tags=machine:virt
586cba
-        :avocado: tags=accel:tcg
586cba
-        :avocado: tags=cpu:cortex-a53
586cba
-        """
586cba
-        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
586cba
-                      '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
586cba
-                      '/vmlinuz')
586cba
-        kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
586cba
-        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
586cba
-
586cba
-        self.vm.set_console()
586cba
-        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
586cba
-                               'console=ttyAMA0')
586cba
-        self.require_accelerator("tcg")
586cba
-        self.vm.add_args('-cpu', 'cortex-a53',
586cba
-                         '-accel', 'tcg',
586cba
-                         '-kernel', kernel_path,
586cba
-                         '-append', kernel_command_line)
586cba
-        self.vm.launch()
586cba
-        console_pattern = 'Kernel command line: %s' % kernel_command_line
586cba
-        self.wait_for_console_pattern(console_pattern)
586cba
-
586cba
     def test_aarch64_xlnx_versal_virt(self):
586cba
         """
586cba
         :avocado: tags=arch:aarch64
586cba
diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_aarch64_virt.py
586cba
new file mode 100644
586cba
index 0000000000..21848cba70
586cba
--- /dev/null
586cba
+++ b/tests/avocado/machine_aarch64_virt.py
586cba
@@ -0,0 +1,51 @@
586cba
+# Functional test that boots a Linux kernel and checks the console
586cba
+#
586cba
+# Copyright (c) 2022 Linaro Ltd.
586cba
+#
586cba
+# Author:
586cba
+#  Alex Bennée <alex.bennee@linaro.org>
586cba
+#
586cba
+# SPDX-License-Identifier: GPL-2.0-or-later
586cba
+
586cba
+import time
586cba
+
586cba
+from avocado_qemu import QemuSystemTest
586cba
+from avocado_qemu import wait_for_console_pattern
586cba
+from avocado_qemu import exec_command
586cba
+
586cba
+class Aarch64VirtMachine(QemuSystemTest):
586cba
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
586cba
+
586cba
+    def wait_for_console_pattern(self, success_message, vm=None):
586cba
+        wait_for_console_pattern(self, success_message,
586cba
+                                 failure_message='Kernel panic - not syncing',
586cba
+                                 vm=vm)
586cba
+
586cba
+    def test_aarch64_virt(self):
586cba
+        """
586cba
+        :avocado: tags=arch:aarch64
586cba
+        :avocado: tags=machine:virt
586cba
+        :avocado: tags=accel:tcg
586cba
+        :avocado: tags=cpu:max
586cba
+        """
586cba
+        kernel_url = ('https://fileserver.linaro.org/s/'
586cba
+                      'z6B2ARM7DQT3HWN/download')
586cba
+
586cba
+        kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
586cba
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
586cba
+
586cba
+        self.vm.set_console()
586cba
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
586cba
+                               'console=ttyAMA0')
586cba
+        self.require_accelerator("tcg")
586cba
+        self.vm.add_args('-cpu', 'max,pauth-impdef=on',
586cba
+                         '-accel', 'tcg',
586cba
+                         '-kernel', kernel_path,
586cba
+                         '-append', kernel_command_line)
586cba
+        self.vm.launch()
586cba
+        self.wait_for_console_pattern('Welcome to Buildroot')
586cba
+        time.sleep(0.1)
586cba
+        exec_command(self, 'root')
586cba
+        time.sleep(0.1)
586cba
+        exec_command(self, 'cat /proc/self/maps')
586cba
+        time.sleep(0.1)
586cba
-- 
586cba
2.35.3
586cba