Testing, guest-loader and other misc tweaks

- add warning text to quickstart example
   - add CFI tests to CI
   - use --arch-only for docker pre-requisites
   - fix .editorconfig for emacs
   - add guest-loader for Xen-like hypervisor testing
   - move generic-loader docs into manual proper
   - move semihosting out of hw/
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmBI50MACgkQ+9DbCVqe
 KkSyKggAhPZW+7sReVEsFdnVfwuo3evW7auoW44mghNbikTnm3RfoahYTrek8lGZ
 AEo2gFMbzENW0j88e0OvSYYtwkVz3sD68bygfXerti6sQwWlwkf42I/suWjJNLph
 oVKGEEdJess9+zR13Cu6RAq5RaTwzDPGPjUwTbeJPpAps4+UZV3hsxhaxs8keII6
 GBa/idnh0qEApP2NDLKiSASrYZM7xGvljE7zO4qhchd6iSH/o5rCtkoB2tRCcXGo
 +KF8LyBsUNf7GiWp0yYZMZUQ3Pqskqma8N3d2A4UlS1kXvxeX/FiORkG/Ne8bH1Z
 VZ1Z/xbyXGlVkiP1bcoYSc6XWHNDTw==
 =R9zQ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-docs-xen-updates-100321-2' into staging

Testing, guest-loader and other misc tweaks

  - add warning text to quickstart example
  - add CFI tests to CI
  - use --arch-only for docker pre-requisites
  - fix .editorconfig for emacs
  - add guest-loader for Xen-like hypervisor testing
  - move generic-loader docs into manual proper
  - move semihosting out of hw/

# gpg: Signature made Wed 10 Mar 2021 15:35:31 GMT
# 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

* remotes/stsquad/tags/pull-testing-docs-xen-updates-100321-2:
  semihosting: Move hw/semihosting/ -> semihosting/
  semihosting: Move include/hw/semihosting/ -> include/semihosting/
  tests/avocado: add boot_xen tests
  docs: add some documentation for the guest-loader
  docs: move generic-loader documentation into the main manual
  hw/core: implement a guest-loader to support static hypervisor guests
  device_tree: add qemu_fdt_setprop_string_array helper
  hw/riscv: migrate fdt field to generic MachineState
  hw/board: promote fdt from ARM VirtMachineState to MachineState
  .editorconfig: update the automatic mode setting for Emacs
  tests/docker: Use --arch-only when building Debian cross image
  gitlab-ci.yml: Add jobs to test CFI flags
  gitlab-ci.yml: Allow custom # of parallel linkers
  tests/docker: add a test-tcg for building then running check-tcg
  docs/system: add a gentle prompt for the complexity to come

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-03-11 16:20:57 +00:00
commit f4abdf3271
56 changed files with 921 additions and 318 deletions

View file

@ -0,0 +1,118 @@
# Functional test that boots a Xen hypervisor with a domU kernel and
# checks the console output is vaguely sane .
#
# Copyright (c) 2020 Linaro
#
# Author:
# Alex Bennée <alex.bennee@linaro.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
import os
from avocado import skipIf
from avocado_qemu import wait_for_console_pattern
from boot_linux_console import LinuxKernelTest
class BootXenBase(LinuxKernelTest):
"""
Boots a Xen hypervisor with a Linux DomU kernel.
"""
timeout = 90
XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all'
def fetch_guest_kernel(self):
# Using my own built kernel - which works
kernel_url = ('https://fileserver.linaro.org/'
's/JSsewXGZ6mqxPr5/download?path=%2F&files='
'linux-5.9.9-arm64-ajb')
kernel_sha1 = '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83'
kernel_path = self.fetch_asset(kernel_url,
asset_hash=kernel_sha1)
return kernel_path
def launch_xen(self, xen_path):
"""
Launch Xen with a dom0 guest kernel
"""
self.log.info("launch with xen_path: %s", xen_path)
kernel_path = self.fetch_guest_kernel()
self.vm.set_console()
xen_command_line = self.XEN_COMMON_COMMAND_LINE
self.vm.add_args('-machine', 'virtualization=on',
'-cpu', 'cortex-a57',
'-m', '768',
'-kernel', xen_path,
'-append', xen_command_line,
'-device',
'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0'
% (kernel_path))
self.vm.launch()
console_pattern = 'VFS: Cannot open root device'
wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:")
class BootXen(BootXenBase):
def test_arm64_xen_411_and_dom0(self):
"""
:avocado: tags=arch:aarch64
:avocado: tags=accel:tcg
:avocado: tags=cpu:cortex-a57
:avocado: tags=machine:virt
"""
# archive of file from https://deb.debian.org/debian/pool/main/x/xen/
xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
'download?path=%2F&files='
'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb')
xen_sha1 = '034e634d4416adbad1212d59b62bccdcda63e62a'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.11-arm64")
self.launch_xen(xen_path)
def test_arm64_xen_414_and_dom0(self):
"""
:avocado: tags=arch:aarch64
:avocado: tags=accel:tcg
:avocado: tags=cpu:cortex-a57
:avocado: tags=machine:virt
"""
# archive of file from https://deb.debian.org/debian/pool/main/x/xen/
xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
'download?path=%2F&files='
'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb')
xen_sha1 = 'b9d209dd689ed2b393e625303a225badefec1160'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.14-arm64")
self.launch_xen(xen_path)
def test_arm64_xen_415_and_dom0(self):
"""
:avocado: tags=arch:aarch64
:avocado: tags=accel:tcg
:avocado: tags=cpu:cortex-a57
:avocado: tags=machine:virt
"""
xen_url = ('https://fileserver.linaro.org/'
's/JSsewXGZ6mqxPr5/download'
'?path=%2F&files=xen-upstream-4.15-unstable.deb')
xen_sha1 = 'fc191172b85cf355abb95d275a24cc0f6d6579d8'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.15-unstable")
self.launch_xen(xen_path)

View file

@ -32,6 +32,6 @@ RUN apt update && \
psmisc \
python3 \
python3-sphinx \
$(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\ -f2)
$(apt-get -s build-dep --arch-only qemu | egrep ^Inst | fgrep '[all]' | cut -d\ -f2)
ENV FEATURES docs

22
tests/docker/test-tcg Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash -e
#
# Build and run the TCG tests
#
# Copyright (c) 2021 Linaro Ltd.
#
# Authors:
# Alex Bennée <alex.bennee@linaro.org>
#
# This work is licensed under the terms of the GNU GPL, version 2
# or (at your option) any later version. See the COPYING file in
# the top-level directory.
. common.rc
cd "$BUILD_DIR"
# although we are not building QEMU itself we still need a configured
# build for the unit tests to be built and run
TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
build_qemu
check_qemu check-tcg