From 22db66a436346fcccddf7617bacacdc926d2680d Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 18 Oct 2019 12:24:43 +0200 Subject: tests/vm: update openbsd to release 6.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20191018102443.26469-1-kraxel@redhat.com> --- tests/vm/openbsd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 6df5162..d617350 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -22,8 +22,8 @@ class OpenBSDVM(basevm.BaseVM): name = "openbsd" arch = "x86_64" - link = "https://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.iso" - csum = "38d1f8cadd502f1c27bf05c5abde6cc505dd28f3f34f8a941048ff9a54f9f608" + link = "https://cdn.openbsd.org/pub/OpenBSD/6.6/amd64/install66.iso" + csum = "b22e63df56e6266de6bbeed8e9be0fbe9ee2291551c5bc03f3cc2e4ab9436ee3" size = "20G" pkgs = [ # tools -- cgit v1.1 From bc2bf7f3480c51c3e7f38bdab1542deec765601e Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 6 Jan 2020 13:37:46 +0100 Subject: freebsd: use python37 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FreeBSD seems to use python37 by default now, which breaks the build script. Add python to the package list, to explicitly pick the version, and also adapt the configure command line. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20200106123746.18201-1-kraxel@redhat.com> --- tests/vm/freebsd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/vm/freebsd b/tests/vm/freebsd index 1825cc5..33a7362 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -32,6 +32,7 @@ class FreeBSDVM(basevm.BaseVM): "git", "pkgconf", "bzip2", + "python37", # gnu tools "bash", @@ -63,7 +64,7 @@ class FreeBSDVM(basevm.BaseVM): mkdir src build; cd src; tar -xf /dev/vtbd1; cd ../build - ../src/configure --python=python3.6 {configure_opts}; + ../src/configure --python=python3.7 {configure_opts}; gmake --output-sync -j{jobs} {target} {verbose}; """ -- cgit v1.1 From 3618e3a6403079383904a1a61d53d0a57508b746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 7 Jan 2020 17:55:52 +0000 Subject: testing: don't nest build for fp-test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-calling the main make is counter-productive and really messes up with parallel builds. Just ensure we have built the pre-requisites before we build the fp-test bits. If the user builds manually just complain if the parent build hasn't got the bits we need. Signed-off-by: Alex Bennée Reviewed-by: Emilio G. Cota --- tests/Makefile.include | 2 +- tests/fp/Makefile | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 49e3b0d..7a767bf 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -969,7 +969,7 @@ FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test # the build dir is created by configure .PHONY: $(FP_TEST_BIN) -$(FP_TEST_BIN): +$(FP_TEST_BIN): config-host.h $(test-util-obj-y) $(call quiet-command, \ $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), \ "BUILD", "$(notdir $@)") diff --git a/tests/fp/Makefile b/tests/fp/Makefile index 5a35e7c2..56768ec 100644 --- a/tests/fp/Makefile +++ b/tests/fp/Makefile @@ -554,15 +554,13 @@ TF_OBJS_LIB += $(TF_OBJS_TEST) BINARIES := fp-test$(EXESUF) fp-bench$(EXESUF) -# everything depends on config-host.h because platform.h includes it -all: $(BUILD_DIR)/config-host.h - $(MAKE) $(BINARIES) +# We require artefacts from the main build including config-host.h +# because platform.h includes it. Rather than re-invoking the main +# build we just error out if things aren't there. +$(LIBQEMUUTIL) $(BUILD_DIR)/config-host.h: + $(error $@ missing, re-run parent build) -$(LIBQEMUUTIL): - $(MAKE) -C $(BUILD_DIR) libqemuutil.a - -$(BUILD_DIR)/config-host.h: - $(MAKE) -C $(BUILD_DIR) config-host.h +all: $(BUILD_DIR)/config-host.h $(BINARIES) # libtestfloat.a depends on libsoftfloat.a, so specify it first FP_TEST_LIBS := libtestfloat.a libsoftfloat.a $(LIBQEMUUTIL) -- cgit v1.1 From 9c354591cae35d91e97244469904ab4483482d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 18 Dec 2019 14:28:36 +0000 Subject: tests/tcg: add a dumb-as-bricks semihosting console test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't run this during check-tcg as we would need to check stuff is echoed back. However we can still build the binary so people can test it manually. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- tests/tcg/aarch64/Makefile.softmmu-target | 11 ++++++++- tests/tcg/aarch64/system/semiconsole.c | 38 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/system/semiconsole.c (limited to 'tests') diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index 950dbb4..7b4eede 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -31,7 +31,16 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc memory: CFLAGS+=-DCHECK_UNALIGNED=1 # Running -QEMU_OPTS+=-M virt -cpu max -display none -semihosting-config enable=on,target=native,chardev=output -kernel +QEMU_BASE_MACHINE=-M virt -cpu max -display none +QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel + +# console test is manual only +QEMU_SEMIHOST=-chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline +run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") +run-plugin-semiconsole-with-%: semiconsole + $(call skip-test, $<, "MANUAL ONLY") # Simple Record/Replay Test .PHONY: memory-record diff --git a/tests/tcg/aarch64/system/semiconsole.c b/tests/tcg/aarch64/system/semiconsole.c new file mode 100644 index 0000000..bfe7c9e --- /dev/null +++ b/tests/tcg/aarch64/system/semiconsole.c @@ -0,0 +1,38 @@ +/* + * Semihosting Console Test + * + * Copyright (c) 2019 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include + +#define SYS_READC 0x7 + +uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) +{ + register uintptr_t t asm("x0") = type; + register uintptr_t a0 asm("x1") = arg0; + asm("hlt 0xf000" + : "=r" (t) + : "r" (t), "r" (a0)); + + return t; +} + +int main(void) +{ + char c; + + ml_printf("Semihosting Console Test\n"); + ml_printf("hit X to exit:"); + + do { + c = __semi_call(SYS_READC, 0); + __sys_outc(c); + } while (c != 'X'); + + return 0; +} -- cgit v1.1 From f05938090b966e58739d98fe6c755b72234d34ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 8 Jan 2020 12:24:38 +0000 Subject: tests/tcg: extract __semi_call into a header and expand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two types of ARM semicall - lets test them both. Putting the logic in a header will make re-using the functions easier later. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- tests/tcg/arm/Makefile.target | 9 +++++++++ tests/tcg/arm/semicall.h | 35 +++++++++++++++++++++++++++++++++++ tests/tcg/arm/semihosting.c | 21 +-------------------- 3 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 tests/tcg/arm/semicall.h (limited to 'tests') diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 0765f37..41aa26f 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -31,9 +31,18 @@ run-fcvt: fcvt # Semihosting smoke test for linux-user ARM_TESTS += semihosting +semihosting: CFLAGS += -mthumb run-semihosting: semihosting $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") +ARM_TESTS += semihosting-arm +semihosting-arm: CFLAGS += -marm +semihosting-arm: semihosting.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +run-semihosting-arm: semihosting-arm + $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + run-plugin-semihosting-with-%: $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \ diff --git a/tests/tcg/arm/semicall.h b/tests/tcg/arm/semicall.h new file mode 100644 index 0000000..d4f6818 --- /dev/null +++ b/tests/tcg/arm/semicall.h @@ -0,0 +1,35 @@ +/* + * Semihosting Tests + * + * Copyright (c) 2019 + * Written by Alex Bennée + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define SYS_WRITE0 0x04 +#define SYS_READC 0x07 +#define SYS_REPORTEXC 0x18 + +uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) +{ +#if defined(__arm__) + register uintptr_t t asm("r0") = type; + register uintptr_t a0 asm("r1") = arg0; +#ifdef __thumb__ +# define SVC "svc 0xab" +#else +# define SVC "svc 0x123456" +#endif + asm(SVC : "=r" (t) + : "r" (t), "r" (a0)); +#else + register uintptr_t t asm("x0") = type; + register uintptr_t a0 asm("x1") = arg0; + asm("hlt 0xf000" + : "=r" (t) + : "r" (t), "r" (a0)); +#endif + + return t; +} diff --git a/tests/tcg/arm/semihosting.c b/tests/tcg/arm/semihosting.c index 09c89cb..33faac9 100644 --- a/tests/tcg/arm/semihosting.c +++ b/tests/tcg/arm/semihosting.c @@ -8,26 +8,7 @@ */ #include - -#define SYS_WRITE0 0x04 -#define SYS_REPORTEXC 0x18 - -void __semi_call(uintptr_t type, uintptr_t arg0) -{ -#if defined(__arm__) - register uintptr_t t asm("r0") = type; - register uintptr_t a0 asm("r1") = arg0; - asm("svc 0xab" - : /* no return */ - : "r" (t), "r" (a0)); -#else - register uintptr_t t asm("x0") = type; - register uintptr_t a0 asm("x1") = arg0; - asm("hlt 0xf000" - : /* no return */ - : "r" (t), "r" (a0)); -#endif -} +#include "semicall.h" int main(int argc, char *argv[argc]) { -- cgit v1.1 From 486e58b188c1b093a8f64d4b5cd11ff5c3514cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 19 Dec 2019 12:13:44 +0000 Subject: tests/tcg: add user version of dumb-as-bricks semiconsole test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are linux-user users of semihosting so we'd better check things work for them as well. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- tests/tcg/aarch64/Makefile.target | 7 +++++++ tests/tcg/arm/Makefile.target | 19 +++++++++++++++++++ tests/tcg/arm/semiconsole.c | 27 +++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tests/tcg/arm/semiconsole.c (limited to 'tests') diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 96d2321..df3fe80 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -32,4 +32,11 @@ run-plugin-semihosting-with-%: $(call strip-plugin,$<) 2> $<.err, \ "$< on $(TARGET_NAME) with $*") +AARCH64_TESTS += semiconsole +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") + +run-plugin-semiconsole-with-%: + $(call skip-test, $<, "MANUAL ONLY") + TESTS += $(AARCH64_TESTS) diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 41aa26f..11c39c6 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -49,6 +49,25 @@ run-plugin-semihosting-with-%: $(call strip-plugin,$<) 2> $<.err, \ "$< on $(TARGET_NAME) with $*") +ARM_TESTS += semiconsole semiconsole-arm + +semiconsole: CFLAGS += -mthumb +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") + +run-plugin-semiconsole-with-%: + $(call skip-test, $<, "MANUAL ONLY") + +semiconsole-arm: CFLAGS += -marm +semiconsole-arm: semiconsole.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +run-semiconsole-arm: semiconsole-arm + $(call skip-test, $<, "MANUAL ONLY") + +run-plugin-semiconsole-arm-with-%: + $(call skip-test, $<, "MANUAL ONLY") + TESTS += $(ARM_TESTS) # On ARM Linux only supports 4k pages diff --git a/tests/tcg/arm/semiconsole.c b/tests/tcg/arm/semiconsole.c new file mode 100644 index 0000000..6ef0bd2 --- /dev/null +++ b/tests/tcg/arm/semiconsole.c @@ -0,0 +1,27 @@ +/* + * linux-user semihosting console + * + * Copyright (c) 2019 + * Written by Alex Bennée + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include +#include "semicall.h" + +int main(void) +{ + char c; + + printf("Semihosting Console Test\n"); + printf("hit X to exit:"); + + do { + c = __semi_call(SYS_READC, 0); + printf("got '%c'\n", c); + } while (c != 'X'); + + return 0; +} -- cgit v1.1