aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-11-06 15:01:16 +0000
committerPeter Maydell <peter.maydell@linaro.org>2024-11-06 15:01:16 +0000
commit851ed57d7a24ddf234a90b5bb196a143c84c10bc (patch)
tree4470450bd37e8dcf8404a9ee68d9112ba6a43ee2 /tests
parentf7bc08e935382e80a2b9e1110e246d6aaabadb51 (diff)
parent6f58b090328f5b47ee688c77542bf20d521239a2 (diff)
Merge tag 'pull-lu-20241105' of https://gitlab.com/rth7680/qemu into staging
tests/tcg: Replace -mpower8-vector with -mcpu=power8 linux-user: Fix GDB complaining about system-supplied DSO string table index linux-user: Allow custom rt signal mappings # -----BEGIN PGP SIGNATURE----- # # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmcqM2wdHHJpY2hhcmQu # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV86KQgAhR1OmVAhPYTJiYH6 # Bhp9s+PbdFw/UbxConf9+WFoa/vM1x/QvX1ybzNDl9aOeiH9RIX4hFWUH5WR8xu+ # gZrzplHDcsrUEs5Q7/GWGJaCbd92Rn6g5wcXyoVebMaVP1g/m+NJoxo2XOpZvY06 # G0BcNj4Ib/D0FgkgZrUJcf3DBWaW/9WCd17fBXLo1bpahdKvqV4PbmhhH+QZCVXr # GHg03F+/35U85kNVnPcUg4PJARQHdK4ZmfE4etgGvVkTdS8r43qfO1nMT0ul8aOD # uATdMQrbwKA0XLjWVOVxe4165c+luHpUweKNgiOie+s849YUM3TsFpunKoPBIEpQ # Gu0ejw== # =wipF # -----END PGP SIGNATURE----- # gpg: Signature made Tue 05 Nov 2024 15:02:04 GMT # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * tag 'pull-lu-20241105' of https://gitlab.com/rth7680/qemu: tests/tcg: Add SIGRTMIN/SIGRTMAX test linux-user: Allow custom rt signal mappings linux-user: Fix GDB complaining about system-supplied DSO string table index tests/tcg: Replace -mpower8-vector with -mcpu=power8 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/tcg/Makefile.target4
-rw-r--r--tests/tcg/multiarch/linux/linux-sigrtminmax.c74
2 files changed, 76 insertions, 2 deletions
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index 9722145b97..95ff76ea44 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -179,10 +179,10 @@ run-plugin-%-with-libmem.so: PLUGIN_ARGS=$(COMMA)inline=true
ifeq ($(filter %-softmmu, $(TARGET)),)
run-%: %
- $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<)
+ $(call run-test, $<, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) $<)
run-plugin-%:
- $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
+ $(call run-test, $@, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) \
-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \
-d plugin -D $*.pout \
$(call strip-plugin,$<))
diff --git a/tests/tcg/multiarch/linux/linux-sigrtminmax.c b/tests/tcg/multiarch/linux/linux-sigrtminmax.c
new file mode 100644
index 0000000000..a7059aacd9
--- /dev/null
+++ b/tests/tcg/multiarch/linux/linux-sigrtminmax.c
@@ -0,0 +1,74 @@
+/*
+ * Test the lowest and the highest real-time signals.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* For hexagon and microblaze. */
+#ifndef __SIGRTMIN
+#define __SIGRTMIN 32
+#endif
+
+extern char **environ;
+
+static bool seen_sigrtmin, seen_sigrtmax;
+
+static void handle_signal(int sig)
+{
+ if (sig == SIGRTMIN) {
+ seen_sigrtmin = true;
+ } else if (sig == SIGRTMAX) {
+ seen_sigrtmax = true;
+ } else {
+ _exit(1);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ char *qemu = getenv("QEMU");
+ struct sigaction act;
+
+ assert(qemu);
+
+ if (!getenv("QEMU_RTSIG_MAP")) {
+ char **new_argv = malloc((argc + 2) + sizeof(char *));
+ int tsig1, hsig1, count1, tsig2, hsig2, count2;
+ char rt_sigmap[64];
+
+ /* Re-exec with a mapping that includes SIGRTMIN and SIGRTMAX. */
+ new_argv[0] = qemu;
+ memcpy(&new_argv[1], argv, (argc + 1) * sizeof(char *));
+ tsig1 = __SIGRTMIN;
+ /* The host must have a few signals starting from this one. */
+ hsig1 = 36;
+ count1 = SIGRTMIN - __SIGRTMIN + 1;
+ tsig2 = SIGRTMAX;
+ hsig2 = hsig1 + count1;
+ count2 = 1;
+ snprintf(rt_sigmap, sizeof(rt_sigmap), "%d %d %d,%d %d %d",
+ tsig1, hsig1, count1, tsig2, hsig2, count2);
+ setenv("QEMU_RTSIG_MAP", rt_sigmap, 0);
+ assert(execve(new_argv[0], new_argv, environ) == 0);
+ return EXIT_FAILURE;
+ }
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = handle_signal;
+ assert(sigaction(SIGRTMIN, &act, NULL) == 0);
+ assert(sigaction(SIGRTMAX, &act, NULL) == 0);
+
+ assert(kill(getpid(), SIGRTMIN) == 0);
+ assert(seen_sigrtmin);
+ assert(kill(getpid(), SIGRTMAX) == 0);
+ assert(seen_sigrtmax);
+
+ return EXIT_SUCCESS;
+}