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

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