aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-06-07 15:45:48 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-06-07 15:45:48 +0100
commita35947f15c0ee695eba3c55248ec8ac3e4e23cca (patch)
tree8349ec065369e5007353a96d8ea6223697127336
parent6f398e533f5e259b4f937f4aa9de970f7201d166 (diff)
parent72205289a0799c6d0a73107198098b830dbea2f9 (diff)
downloadqemu-a35947f15c0ee695eba3c55248ec8ac3e4e23cca.zip
qemu-a35947f15c0ee695eba3c55248ec8ac3e4e23cca.tar.gz
qemu-a35947f15c0ee695eba3c55248ec8ac3e4e23cca.tar.bz2
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-updates-070621-2' into staging
A few testing and configure updates: - add the multiarch signals stress test - fix display of multi-word compiler stanzas in meson - fix quoting of multi-word compiler stazas in configure.sh - tag some acceptance tests as TCG only - make checkpatch test work harder to find clean diffs - split gprof/gconv job to avoid timeouts - fix centos8 VM build by adding --source-path - make checkpatch aware of .h.inc and .c.inc paths # gpg: Signature made Mon 07 Jun 2021 14:51:12 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 * remotes/stsquad/tags/pull-testing-updates-070621-2: scripts/checkpatch.pl: process .c.inc and .h.inc files as C source tests/vm: expose --source-path to scripts to find extra files gitlab-ci: Split gprof-gcov job gitlab: work harder to avoid false positives in checkpatch tests/acceptance: tag various arm tests as TCG only tests/tcg/configure.sh: tweak quoting of target_compiler meson.build: fix cosmetics of compiler display tests/tcg: add a multiarch signals test to stress test signal delivery Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--.gitlab-ci.d/buildtest.yml17
-rw-r--r--.gitlab-ci.d/static_checks.yml6
-rw-r--r--meson.build8
-rwxr-xr-xscripts/checkpatch.pl4
-rw-r--r--tests/acceptance/boot_linux_console.py18
-rwxr-xr-xtests/tcg/configure.sh6
-rw-r--r--tests/tcg/multiarch/Makefile.target2
-rw-r--r--tests/tcg/multiarch/signals.c149
-rw-r--r--tests/vm/Makefile.include1
-rw-r--r--tests/vm/basevm.py4
-rwxr-xr-xtests/vm/centos.aarch642
11 files changed, 203 insertions, 14 deletions
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index b72c57e..d9b834c 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -558,16 +558,27 @@ check-deprecated:
allow_failure: true
# gprof/gcov are GCC features
-gprof-gcov:
+build-gprof-gcov:
extends: .native_build_job_template
needs:
job: amd64-ubuntu2004-container
variables:
IMAGE: ubuntu2004
CONFIGURE_ARGS: --enable-gprof --enable-gcov
- MAKE_CHECK_ARGS: check
TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
- timeout: 70m
+ artifacts:
+ expire_in: 1 days
+ paths:
+ - build
+
+check-gprof-gcov:
+ extends: .native_test_job_template
+ needs:
+ - job: build-gprof-gcov
+ artifacts: true
+ variables:
+ IMAGE: ubuntu2004
+ MAKE_CHECK_ARGS: check
after_script:
- ${CI_PROJECT_DIR}/scripts/ci/coverage-summary.sh
diff --git a/.gitlab-ci.d/static_checks.yml b/.gitlab-ci.d/static_checks.yml
index 8e30872..7e685c6 100644
--- a/.gitlab-ci.d/static_checks.yml
+++ b/.gitlab-ci.d/static_checks.yml
@@ -3,7 +3,11 @@ check-patch:
image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
needs:
job: amd64-centos8-container
- script: .gitlab-ci.d/check-patch.py
+ script:
+ - git config --local diff.renamelimit 0
+ - git config --local diff.renames True
+ - git config --local diff.algorithm histogram
+ - .gitlab-ci.d/check-patch.py
variables:
GIT_DEPTH: 1000
rules:
diff --git a/meson.build b/meson.build
index 626cf93..d2a9ce9 100644
--- a/meson.build
+++ b/meson.build
@@ -2537,15 +2537,15 @@ summary(summary_info, bool_yn: true, section: 'Configurable features')
summary_info = {}
summary_info += {'host CPU': cpu}
summary_info += {'host endianness': build_machine.endian()}
-summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
-summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
+summary_info += {'C compiler': ' '.join(meson.get_compiler('c').cmd_array())}
+summary_info += {'Host C compiler': ' '.join(meson.get_compiler('c', native: true).cmd_array())}
if link_language == 'cpp'
- summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
+ summary_info += {'C++ compiler': ' '.join(meson.get_compiler('cpp').cmd_array())}
else
summary_info += {'C++ compiler': false}
endif
if targetos == 'darwin'
- summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
+ summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
endif
if targetos == 'windows'
if 'WIN_SDK' in config_host
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3d185cc..bbcd25a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -12,7 +12,7 @@ use Term::ANSIColor qw(:constants);
my $P = $0;
$P =~ s@.*/@@g;
-our $SrcFile = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
+our $SrcFile = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
my $V = '0.31';
@@ -1671,7 +1671,7 @@ sub process {
}
# check we are in a valid C source file if not then ignore this hunk
- next if ($realfile !~ /\.(h|c|cpp)$/);
+ next if ($realfile !~ /\.((h|c)(\.inc)?|cpp)$/);
# Block comment styles
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 276a53f..cded547 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -333,6 +333,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:aarch64
:avocado: tags=machine:virt
+ :avocado: tags=accel:tcg
"""
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
'/linux/releases/29/Everything/aarch64/os/images/pxeboot'
@@ -343,7 +344,9 @@ class BootLinuxConsole(LinuxKernelTest):
self.vm.set_console()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyAMA0')
+ self.require_accelerator("tcg")
self.vm.add_args('-cpu', 'cortex-a53',
+ '-accel', 'tcg',
'-kernel', kernel_path,
'-append', kernel_command_line)
self.vm.launch()
@@ -356,6 +359,7 @@ class BootLinuxConsole(LinuxKernelTest):
:avocado: tags=machine:xlnx-versal-virt
:avocado: tags=device:pl011
:avocado: tags=device:arm_gicv3
+ :avocado: tags=accel:tcg
"""
images_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
'bionic-updates/main/installer-arm64/'
@@ -370,6 +374,7 @@ class BootLinuxConsole(LinuxKernelTest):
self.vm.set_console()
self.vm.add_args('-m', '2G',
+ '-accel', 'tcg',
'-kernel', kernel_path,
'-initrd', initrd_path)
self.vm.launch()
@@ -379,6 +384,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:virt
+ :avocado: tags=accel:tcg
"""
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
'/linux/releases/29/Everything/armhfp/os/images/pxeboot'
@@ -401,6 +407,7 @@ class BootLinuxConsole(LinuxKernelTest):
:avocado: tags=machine:emcraft-sf2
:avocado: tags=endian:little
:avocado: tags=u-boot
+ :avocado: tags=accel:tcg
"""
uboot_url = ('https://raw.githubusercontent.com/'
'Subbaraya-Sundeep/qemu-test-binaries/'
@@ -429,6 +436,8 @@ class BootLinuxConsole(LinuxKernelTest):
def do_test_arm_raspi2(self, uart_id):
"""
+ :avocado: tags=accel:tcg
+
The kernel can be rebuilt using the kernel source referenced
and following the instructions on the on:
https://www.raspberrypi.org/documentation/linux/kernel/building.md
@@ -464,6 +473,7 @@ class BootLinuxConsole(LinuxKernelTest):
:avocado: tags=arch:arm
:avocado: tags=machine:raspi2
:avocado: tags=device:pl011
+ :avocado: tags=accel:tcg
"""
self.do_test_arm_raspi2(0)
@@ -471,6 +481,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:smdkc210
+ :avocado: tags=accel:tcg
"""
deb_url = ('https://snapshot.debian.org/archive/debian/'
'20190928T224601Z/pool/main/l/linux/'
@@ -511,6 +522,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:cubieboard
+ :avocado: tags=accel:tcg
"""
deb_url = ('https://apt.armbian.com/pool/main/l/'
'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
@@ -551,6 +563,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:cubieboard
+ :avocado: tags=accel:tcg
"""
deb_url = ('https://apt.armbian.com/pool/main/l/'
'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
@@ -595,6 +608,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:quanta-gsj
+ :avocado: tags=accel:tcg
"""
# 25 MiB compressed, 32 MiB uncompressed.
image_url = (
@@ -642,6 +656,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:quanta-gsj
+ :avocado: tags=accel:tcg
"""
initrd_url = (
'https://github.com/hskinnemoen/openbmc/releases/download/'
@@ -678,6 +693,7 @@ class BootLinuxConsole(LinuxKernelTest):
"""
:avocado: tags=arch:arm
:avocado: tags=machine:orangepi-pc
+ :avocado: tags=accel:tcg
"""
deb_url = ('https://apt.armbian.com/pool/main/l/'
'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
@@ -702,6 +718,7 @@ class BootLinuxConsole(LinuxKernelTest):
def test_arm_orangepi_initrd(self):
"""
:avocado: tags=arch:arm
+ :avocado: tags=accel:tcg
:avocado: tags=machine:orangepi-pc
"""
deb_url = ('https://apt.armbian.com/pool/main/l/'
@@ -744,6 +761,7 @@ class BootLinuxConsole(LinuxKernelTest):
def test_arm_orangepi_sd(self):
"""
:avocado: tags=arch:arm
+ :avocado: tags=accel:tcg
:avocado: tags=machine:orangepi-pc
:avocado: tags=device:sd
"""
diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index ed6492c..aa7c243 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -222,10 +222,10 @@ for target in $target_list; do
got_cross_cc=no
- if eval test "x\${cross_cc_$arch}" != xyes; then
- eval "target_compiler=\${cross_cc_$arch}"
+ if eval test "x\"\${cross_cc_$arch}\"" != xyes; then
+ eval "target_compiler=\"\${cross_cc_$arch}\""
- if has "$target_compiler"; then
+ if has $target_compiler; then
if test "$supress_clang" = yes &&
$target_compiler --version | grep -qi "clang"; then
got_cross_cc=no
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index a3a7517..3f283ea 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -30,6 +30,8 @@ testthread: LDFLAGS+=-lpthread
threadcount: LDFLAGS+=-lpthread
+signals: LDFLAGS+=-lrt -lpthread
+
# We define the runner for test-mmap after the individual
# architectures have defined their supported pages sizes. If no
# additional page sizes are defined we only run the default test.
diff --git a/tests/tcg/multiarch/signals.c b/tests/tcg/multiarch/signals.c
new file mode 100644
index 0000000..998c8fd
--- /dev/null
+++ b/tests/tcg/multiarch/signals.c
@@ -0,0 +1,149 @@
+/*
+ * linux-user signal handling tests.
+ *
+ * Copyright (c) 2021 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <string.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/time.h>
+
+static void error1(const char *filename, int line, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(stderr, "%s:%d: ", filename, line);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ exit(1);
+}
+
+static int __chk_error(const char *filename, int line, int ret)
+{
+ if (ret < 0) {
+ error1(filename, line, "%m (ret=%d, errno=%d/%s)",
+ ret, errno, strerror(errno));
+ }
+ return ret;
+}
+
+#define error(fmt, ...) error1(__FILE__, __LINE__, fmt, ## __VA_ARGS__)
+
+#define chk_error(ret) __chk_error(__FILE__, __LINE__, (ret))
+
+/*
+ * Thread handling
+ */
+typedef struct ThreadJob ThreadJob;
+
+struct ThreadJob {
+ int number;
+ int sleep;
+ int count;
+};
+
+static pthread_t *threads;
+static int max_threads = 10;
+__thread int signal_count;
+int total_signal_count;
+
+static void *background_thread_func(void *arg)
+{
+ ThreadJob *job = (ThreadJob *) arg;
+
+ printf("thread%d: started\n", job->number);
+ while (total_signal_count < job->count) {
+ usleep(job->sleep);
+ }
+ printf("thread%d: saw %d alarms from %d\n", job->number,
+ signal_count, total_signal_count);
+ return NULL;
+}
+
+static void spawn_threads(void)
+{
+ int i;
+ threads = calloc(sizeof(pthread_t), max_threads);
+
+ for (i = 0; i < max_threads; i++) {
+ ThreadJob *job = calloc(sizeof(ThreadJob), 1);
+ job->number = i;
+ job->sleep = i * 1000;
+ job->count = i * 100;
+ pthread_create(threads + i, NULL, background_thread_func, job);
+ }
+}
+
+static void close_threads(void)
+{
+ int i;
+ for (i = 0; i < max_threads; i++) {
+ pthread_join(threads[i], NULL);
+ }
+ free(threads);
+ threads = NULL;
+}
+
+static void sig_alarm(int sig, siginfo_t *info, void *puc)
+{
+ if (sig != SIGRTMIN) {
+ error("unexpected signal");
+ }
+ signal_count++;
+ __atomic_fetch_add(&total_signal_count, 1, __ATOMIC_SEQ_CST);
+}
+
+static void test_signals(void)
+{
+ struct sigaction act;
+ struct itimerspec it;
+ timer_t tid;
+ struct sigevent sev;
+
+ /* Set up SIG handler */
+ act.sa_sigaction = sig_alarm;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_SIGINFO;
+ chk_error(sigaction(SIGRTMIN, &act, NULL));
+
+ /* Create POSIX timer */
+ sev.sigev_notify = SIGEV_SIGNAL;
+ sev.sigev_signo = SIGRTMIN;
+ sev.sigev_value.sival_ptr = &tid;
+ chk_error(timer_create(CLOCK_REALTIME, &sev, &tid));
+
+ it.it_interval.tv_sec = 0;
+ it.it_interval.tv_nsec = 1000000;
+ it.it_value.tv_sec = 0;
+ it.it_value.tv_nsec = 1000000;
+ chk_error(timer_settime(tid, 0, &it, NULL));
+
+ spawn_threads();
+
+ do {
+ usleep(1000);
+ } while (total_signal_count < 2000);
+
+ printf("shutting down after: %d signals\n", total_signal_count);
+
+ close_threads();
+
+ chk_error(timer_delete(tid));
+}
+
+int main(int argc, char **argv)
+{
+ test_signals();
+ return 0;
+}
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index e94d95e..f3a3a1c 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -84,6 +84,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \
$(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
$(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
$(if $(LOG_CONSOLE),--log-console) \
+ --source-path $(SRC_PATH) \
--image "$@" \
--force \
--build-image $@, \
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 0f2e436..254e11c 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -96,6 +96,7 @@ class BaseVM(object):
self._genisoimage = args.genisoimage
self._build_path = args.build_path
self._efi_aarch64 = args.efi_aarch64
+ self._source_path = args.source_path
# Allow input config to override defaults.
self._config = DEFAULT_CONFIG.copy()
if config != None:
@@ -591,6 +592,9 @@ def parse_args(vmcls):
parser.add_argument("--build-path", default=None,
help="Path of build directory, "\
"for using build tree QEMU binary. ")
+ parser.add_argument("--source-path", default=None,
+ help="Path of source directory, "\
+ "for finding additional files. ")
parser.add_argument("--interactive", "-I", action="store_true",
help="Interactively run command")
parser.add_argument("--snapshot", "-s", action="store_true",
diff --git a/tests/vm/centos.aarch64 b/tests/vm/centos.aarch64
index e687b93..81c3004 100755
--- a/tests/vm/centos.aarch64
+++ b/tests/vm/centos.aarch64
@@ -64,7 +64,7 @@ class CentosAarch64VM(basevm.BaseVM):
def create_kickstart(self):
"""Generate the kickstart file used to generate the centos image."""
# Start with the template for the kickstart.
- ks_file = "../tests/vm/centos-8-aarch64.ks"
+ ks_file = self._source_path + "/tests/vm/centos-8-aarch64.ks"
subprocess.check_call("cp {} ./ks.cfg".format(ks_file), shell=True)
# Append the ssh keys to the kickstart file
# as the post processing phase of installation.