aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-04-04 17:02:01 +0100
committerPeter Maydell <peter.maydell@linaro.org>2023-04-04 17:02:01 +0100
commit8a712df4d4d736b7fe6441626677bfd271d95b15 (patch)
treecfffe53ccb3c6a5365f32d23abae8c3fc26b3587
parent992473749f7cf127e71bb8263c02577cca303055 (diff)
parentc8cb603293fd329f2a62ade76ec9de3f462fc5c3 (diff)
Merge tag 'pull-for-8.0-040423-2' of https://gitlab.com/stsquad/qemu into staging
Final test and misc fixes: - add basic coverage analysis script - gdbstub only build one of libgdb_user/softmmu - don't break BSD gdb by advertising AUXV feature - add MAINTAINERS section for policy docs - update hexagon toolchain - explicitly invoke iotests with python for BSDs benefit - use system python on NetBSD - add some tests for the new KVM Xen guest support # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmQsOscACgkQ+9DbCVqe # KkSm6Af/X+vvzdlmXgGt3uw2odqV6KMfXEkds5lHZIIqQhsLvV0mrkTcIKTswWhL # JRC7jiPmn5hfwvgDy5WfcczGzELSqfBgqHsm9zqVcboTGgJfr2eMtoUlMCQi6lFR # InomhTb+VzPxuUx82oryufm7bsopG8C+HVr3ZtHNFI3usIrLlscZstkiYMueGUCb # PJ60mykfd7hegaTgwKNbUXqZ+Oy/u4W7UPWBkrR7xJzW623t7S5EWV2ZNbdJgKO6 # utY3VGikir/OcnNKy7NuXp2t3K+5KALFZW3Jbav8hVLy5biMGYUF8886B0FL2m+n # E44J67crEYNJMamtzYJ+FdkGEMrS5Q== # =yCka # -----END PGP SIGNATURE----- # gpg: Signature made Tue 04 Apr 2023 15:57:11 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * tag 'pull-for-8.0-040423-2' of https://gitlab.com/stsquad/qemu: tests/avocado: Test Xen guest support under KVM gitlab: fix typo tests/vm: use the default system python for NetBSD tests/qemu-iotests: explicitly invoke 'check' via 'python' Use hexagon toolchain version 16.0.0 metadata: add .git-blame-ignore-revs MAINTAINERS: add a section for policy documents gdbstub: don't report auxv feature unless on Linux gdbstub: Only build libgdb_user.fa / libgdb_softmmu.fa if necessary scripts/coverage: initial coverage comparison script Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--.git-blame-ignore-revs21
-rw-r--r--.gitlab-ci.d/base.yml2
-rw-r--r--MAINTAINERS19
-rw-r--r--gdbstub/gdbstub.c2
-rw-r--r--gdbstub/meson.build6
-rwxr-xr-xscripts/coverage/compare_gcov_json.py119
-rw-r--r--tests/avocado/kvm_xen_guest.py171
-rw-r--r--tests/docker/dockerfiles/debian-hexagon-cross.docker2
-rw-r--r--tests/qemu-iotests/meson.build7
-rwxr-xr-xtests/vm/netbsd3
10 files changed, 342 insertions, 10 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 0000000000..93718ef425
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,21 @@
+#
+# List of code-formatting clean ups the git blame can ignore
+#
+# git blame --ignore-revs-file .git-blame-ignore-revs
+#
+# or
+#
+# git config blame.ignoreRevsFile .git-blame-ignore-revs
+#
+
+# gdbstub: clean-up indents
+ad9e4585b3c7425759d3eea697afbca71d2c2082
+
+# e1000e: fix code style
+0eadd56bf53ab196a16d492d7dd31c62e1c24c32
+
+# target/riscv: coding style fixes
+8c7feddddd9218b407792120bcfda0347ed16205
+
+# replace TABs with spaces
+48805df9c22a0700fba4b3b548fafaa21726ca68
diff --git a/.gitlab-ci.d/base.yml b/.gitlab-ci.d/base.yml
index 0274228de8..2fbb58d2a3 100644
--- a/.gitlab-ci.d/base.yml
+++ b/.gitlab-ci.d/base.yml
@@ -75,5 +75,5 @@
- if: '$QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != "qemu-project"'
when: manual
- # Jobs can run if any jobs they depend on were successfull
+ # Jobs can run if any jobs they depend on were successful
- when: on_success
diff --git a/MAINTAINERS b/MAINTAINERS
index f0f7fb3746..2c2068ea5c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -64,6 +64,20 @@ L: qemu-devel@nongnu.org
F: *
F: */
+Project policy and developer guides
+R: Alex Bennée <alex.bennee@linaro.org>
+R: Daniel P. Berrangé <berrange@redhat.com>
+R: Thomas Huth <thuth@redhat.com>
+R: Markus Armbruster <armbru@redhat.com>
+R: Philippe Mathieu-Daudé <philmd@linaro.org>
+W: https://www.qemu.org/docs/master/devel/index.html
+S: Odd Fixes
+F: docs/devel/style.rst
+F: docs/devel/code-of-conduct.rst
+F: docs/devel/conflict-resolution.rst
+F: docs/devel/submitting-a-patch.rst
+F: docs/devel/submitting-a-pull-request.rst
+
Responsible Disclosure, Reporting Security Issues
-------------------------------------------------
W: https://wiki.qemu.org/SecurityProcess
@@ -3906,3 +3920,8 @@ Performance Tools and Tests
M: Ahmed Karaman <ahmedkhaledkaraman@gmail.com>
S: Maintained
F: scripts/performance/
+
+Code Coverage Tools
+M: Alex Bennée <alex.bennee@linaro.org>
+S: Odd Fixes
+F: scripts/coverage/
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 2a66371aa5..0760d78685 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1468,7 +1468,7 @@ static void handle_query_supported(GArray *params, void *user_ctx)
";ReverseStep+;ReverseContinue+");
}
-#ifdef CONFIG_USER_ONLY
+#if defined(CONFIG_USER_ONLY) && defined(CONFIG_LINUX)
if (gdbserver_state.c_cpu->opaque) {
g_string_append(gdbserver_state.str_buf, ";qXfer:auxv:read+");
}
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index bd5c5cd67d..cdb4d28691 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -20,11 +20,13 @@ gdb_softmmu_ss = gdb_softmmu_ss.apply(config_host, strict: false)
libgdb_user = static_library('gdb_user',
gdb_user_ss.sources() + genh,
name_suffix: 'fa',
- c_args: '-DCONFIG_USER_ONLY')
+ c_args: '-DCONFIG_USER_ONLY',
+ build_by_default: have_user)
libgdb_softmmu = static_library('gdb_softmmu',
gdb_softmmu_ss.sources() + genh,
- name_suffix: 'fa')
+ name_suffix: 'fa',
+ build_by_default: have_system)
gdb_user = declare_dependency(link_whole: libgdb_user)
user_ss.add(gdb_user)
diff --git a/scripts/coverage/compare_gcov_json.py b/scripts/coverage/compare_gcov_json.py
new file mode 100755
index 0000000000..1b92dc2c8c
--- /dev/null
+++ b/scripts/coverage/compare_gcov_json.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python3
+#
+# Compare output of two gcovr JSON reports and report differences. To
+# generate the required output first:
+# - create two build dirs with --enable-gcov
+# - run set of tests in each
+# - run make coverage-html in each
+# - run gcovr --json --exclude-unreachable-branches \
+# --print-summary -o coverage.json --root ../../ . *.p
+#
+# Author: Alex Bennée <alex.bennee@linaro.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+
+import argparse
+import json
+import sys
+from pathlib import Path
+
+def create_parser():
+ parser = argparse.ArgumentParser(
+ prog='compare_gcov_json',
+ description='analyse the differences in coverage between two runs')
+
+ parser.add_argument('-a', type=Path, default=None,
+ help=('First file to check'))
+
+ parser.add_argument('-b', type=Path, default=None,
+ help=('Second file to check'))
+
+ parser.add_argument('--verbose', action='store_true', default=False,
+ help=('A minimal verbosity level that prints the '
+ 'overall result of the check/wait'))
+ return parser
+
+
+# See https://gcovr.com/en/stable/output/json.html#json-format-reference
+def load_json(json_file_path: Path, verbose = False) -> dict[str, set[int]]:
+
+ with open(json_file_path) as f:
+ data = json.load(f)
+
+ root_dir = json_file_path.absolute().parent
+ covered_lines = dict()
+
+ for filecov in data["files"]:
+ file_path = Path(filecov["file"])
+
+ # account for generated files - map into src tree
+ resolved_path = Path(file_path).absolute()
+ if resolved_path.is_relative_to(root_dir):
+ file_path = resolved_path.relative_to(root_dir)
+ # print(f"remapped {resolved_path} to {file_path}")
+
+ lines = filecov["lines"]
+
+ executed_lines = set(
+ linecov["line_number"]
+ for linecov in filecov["lines"]
+ if linecov["count"] != 0 and not linecov["gcovr/noncode"]
+ )
+
+ # if this file has any coverage add it to the system
+ if len(executed_lines) > 0:
+ if verbose:
+ print(f"file {file_path} {len(executed_lines)}/{len(lines)}")
+ covered_lines[str(file_path)] = executed_lines
+
+ return covered_lines
+
+def find_missing_files(first, second):
+ """
+ Return a list of files not covered in the second set
+ """
+ missing_files = []
+ for f in sorted(first):
+ file_a = first[f]
+ try:
+ file_b = second[f]
+ except KeyError:
+ missing_files.append(f)
+
+ return missing_files
+
+def main():
+ """
+ Script entry point
+ """
+ parser = create_parser()
+ args = parser.parse_args()
+
+ if not args.a or not args.b:
+ print("We need two files to compare")
+ sys.exit(1)
+
+ first_coverage = load_json(args.a, args.verbose)
+ second_coverage = load_json(args.b, args.verbose)
+
+ first_missing = find_missing_files(first_coverage,
+ second_coverage)
+
+ second_missing = find_missing_files(second_coverage,
+ first_coverage)
+
+ a_name = args.a.parent.name
+ b_name = args.b.parent.name
+
+ print(f"{b_name} missing coverage in {len(first_missing)} files")
+ for f in first_missing:
+ print(f" {f}")
+
+ print(f"{a_name} missing coverage in {len(second_missing)} files")
+ for f in second_missing:
+ print(f" {f}")
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/avocado/kvm_xen_guest.py b/tests/avocado/kvm_xen_guest.py
new file mode 100644
index 0000000000..5391283113
--- /dev/null
+++ b/tests/avocado/kvm_xen_guest.py
@@ -0,0 +1,171 @@
+# KVM Xen guest functional tests
+#
+# Copyright © 2021 Red Hat, Inc.
+# Copyright © 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+#
+# Author:
+# David Woodhouse <dwmw2@infradead.org>
+# Alex Bennée <alex.bennee@linaro.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+
+from qemu.machine import machine
+
+from avocado_qemu import LinuxSSHMixIn
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
+ """
+ :avocado: tags=arch:x86_64
+ :avocado: tags=machine:q35
+ :avocado: tags=accel:kvm
+ :avocado: tags=kvm_xen_guest
+ """
+
+ KERNEL_DEFAULT = 'printk.time=0 root=/dev/xvda console=ttyS0'
+
+ kernel_path = None
+ kernel_params = None
+
+ # Fetch assets from the kvm-xen-guest subdir of my shared test
+ # images directory on fileserver.linaro.org where you can find
+ # build instructions for how they where assembled.
+ def get_asset(self, name, sha1):
+ base_url = ('https://fileserver.linaro.org/s/'
+ 'kE4nCFLdQcoBF9t/download?'
+ 'path=%2Fkvm-xen-guest&files=' )
+ url = base_url + name
+ # use explicit name rather than failing to neatly parse the
+ # URL into a unique one
+ return self.fetch_asset(name=name, locations=(url), asset_hash=sha1)
+
+ def common_vm_setup(self):
+ # We also catch lack of KVM_XEN support if we fail to launch
+ self.require_accelerator("kvm")
+
+ self.vm.set_console()
+
+ self.vm.add_args("-accel", "kvm,xen-version=0x4000a,kernel-irqchip=split")
+ self.vm.add_args("-smp", "2")
+
+ self.kernel_path = self.get_asset("bzImage",
+ "367962983d0d32109998a70b45dcee4672d0b045")
+ self.rootfs = self.get_asset("rootfs.ext4",
+ "f1478401ea4b3fa2ea196396be44315bab2bb5e4")
+
+ def run_and_check(self):
+ self.vm.add_args('-kernel', self.kernel_path,
+ '-append', self.kernel_params,
+ '-drive', f"file={self.rootfs},if=none,format=raw,id=drv0",
+ '-device', 'xen-disk,drive=drv0,vdev=xvda',
+ '-device', 'virtio-net-pci,netdev=unet',
+ '-netdev', 'user,id=unet,hostfwd=:127.0.0.1:0-:22')
+
+ try:
+ self.vm.launch()
+ except machine.VMLaunchFailure as e:
+ if "Xen HVM guest support not present" in e.output:
+ self.cancel("KVM Xen support is not present "
+ "(need v5.12+ kernel with CONFIG_KVM_XEN)")
+ elif "Property 'kvm-accel.xen-version' not found" in e.output:
+ self.cancel("QEMU not built with CONFIG_XEN_EMU support")
+ else:
+ raise e
+
+ self.log.info('VM launched, waiting for sshd')
+ console_pattern = 'Starting dropbear sshd: OK'
+ wait_for_console_pattern(self, console_pattern, 'Oops')
+ self.log.info('sshd ready')
+ self.ssh_connect('root', '', False)
+
+ self.ssh_command('cat /proc/cmdline')
+ self.ssh_command('dmesg | grep -e "Grant table initialized"')
+
+ def test_kvm_xen_guest(self):
+ """
+ :avocado: tags=kvm_xen_guest
+ """
+
+ self.common_vm_setup()
+
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks')
+ self.run_and_check()
+ self.ssh_command('grep xen-pirq.*msi /proc/interrupts')
+
+ def test_kvm_xen_guest_nomsi(self):
+ """
+ :avocado: tags=kvm_xen_guest_nomsi
+ """
+
+ self.common_vm_setup()
+
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks pci=nomsi')
+ self.run_and_check()
+ self.ssh_command('grep xen-pirq.* /proc/interrupts')
+
+ def test_kvm_xen_guest_noapic_nomsi(self):
+ """
+ :avocado: tags=kvm_xen_guest_noapic_nomsi
+ """
+
+ self.common_vm_setup()
+
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks noapic pci=nomsi')
+ self.run_and_check()
+ self.ssh_command('grep xen-pirq /proc/interrupts')
+
+ def test_kvm_xen_guest_vapic(self):
+ """
+ :avocado: tags=kvm_xen_guest_vapic
+ """
+
+ self.common_vm_setup()
+ self.vm.add_args('-cpu', 'host,+xen-vapic')
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks')
+ self.run_and_check()
+ self.ssh_command('grep xen-pirq /proc/interrupts')
+ self.ssh_command('grep PCI-MSI /proc/interrupts')
+
+ def test_kvm_xen_guest_novector(self):
+ """
+ :avocado: tags=kvm_xen_guest_novector
+ """
+
+ self.common_vm_setup()
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks' +
+ ' xen_no_vector_callback')
+ self.run_and_check()
+ self.ssh_command('grep xen-platform-pci /proc/interrupts')
+
+ def test_kvm_xen_guest_novector_nomsi(self):
+ """
+ :avocado: tags=kvm_xen_guest_novector_nomsi
+ """
+
+ self.common_vm_setup()
+
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks pci=nomsi' +
+ ' xen_no_vector_callback')
+ self.run_and_check()
+ self.ssh_command('grep xen-platform-pci /proc/interrupts')
+
+ def test_kvm_xen_guest_novector_noapic(self):
+ """
+ :avocado: tags=kvm_xen_guest_novector_noapic
+ """
+
+ self.common_vm_setup()
+ self.kernel_params = (self.KERNEL_DEFAULT +
+ ' xen_emul_unplug=ide-disks' +
+ ' xen_no_vector_callback noapic')
+ self.run_and_check()
+ self.ssh_command('grep xen-platform-pci /proc/interrupts')
diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/docker/dockerfiles/debian-hexagon-cross.docker
index 5308ccb8fe..b99d99f943 100644
--- a/tests/docker/dockerfiles/debian-hexagon-cross.docker
+++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker
@@ -27,7 +27,7 @@ RUN apt-get update && \
ENV TOOLCHAIN_INSTALL /opt
-ENV TOOLCHAIN_RELEASE 15.0.3
+ENV TOOLCHAIN_RELEASE 16.0.0
ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unknown-linux-musl"
ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolchain-for-hexagon/v${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
index a162f683ef..9735071a29 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
@@ -47,19 +47,20 @@ foreach format, speed: qemu_iotests_formats
endif
rc = run_command(
- [qemu_iotests_check_cmd] + args + ['-n'],
+ [python, qemu_iotests_check_cmd] + args + ['-n'],
check: true,
)
foreach item: rc.stdout().strip().split()
- args = ['-tap', '-' + format, item,
+ args = [qemu_iotests_check_cmd,
+ '-tap', '-' + format, item,
'--source-dir', meson.current_source_dir(),
'--build-dir', meson.current_build_dir()]
# Some individual tests take as long as 45 seconds
# Bump the timeout to 3 minutes for some headroom
# on slow machines to minimize spurious failures
test('io-' + format + '-' + item,
- qemu_iotests_check_cmd,
+ python,
args: args,
depends: qemu_iotests_binaries,
env: qemu_iotests_env,
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index aa54338dfa..0b9536ca17 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -30,7 +30,6 @@ class NetBSDVM(basevm.BaseVM):
"git-base",
"pkgconf",
"xz",
- "python37",
"ninja-build",
# gnu tools
@@ -66,7 +65,7 @@ class NetBSDVM(basevm.BaseVM):
mkdir src build; cd src;
tar -xf /dev/rld1a;
cd ../build
- ../src/configure --python=python3.7 --disable-opengl {configure_opts};
+ ../src/configure --disable-opengl {configure_opts};
gmake --output-sync -j{jobs} {target} {verbose};
"""
poweroff = "/sbin/poweroff"