diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-01-10 13:19:34 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-01-10 13:19:34 +0000 |
commit | f38a71b01f839c7b65ea73ddd507903cb9489ed6 (patch) | |
tree | 5b25ccbcf076e764d306a5133874e288f7f8e57e /tests | |
parent | 0dba4897be3a458a419820f4598450907647c864 (diff) | |
parent | 486e58b188c1b093a8f64d4b5cd11ff5c3514cb2 (diff) | |
download | qemu-f38a71b01f839c7b65ea73ddd507903cb9489ed6.zip qemu-f38a71b01f839c7b65ea73ddd507903cb9489ed6.tar.gz qemu-f38a71b01f839c7b65ea73ddd507903cb9489ed6.tar.bz2 |
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-semihosting-090120-2' into staging
Testing fixes and semiconsole support:
- build fix (missing x86-iommu stubs)
- python fixes for freebsd and OSX
- nicer reporting of acceptance failures
- fix build nesting of fp-test (breaks bsds)
- semihosting clean-ups
- support for blocking semihosting console
# gpg: Signature made Thu 09 Jan 2020 11:42:51 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-and-semihosting-090120-2:
tests/tcg: add user version of dumb-as-bricks semiconsole test
tests/tcg: extract __semi_call into a header and expand
tests/tcg: add a dumb-as-bricks semihosting console test
semihosting: add qemu_semihosting_console_inc for SYS_READC
target/arm: only update pc after semihosting completes
target/arm: remove unused EXCP_SEMIHOST leg
testing: don't nest build for fp-test
travis.yml: install homebrew python for OS X
travis.yml: duplicate before_script for MacOSX
travis.yml: Detach build and test steps
travis.yml: avocado: Print logs of non-pass tests only
freebsd: use python37
tests/vm: update openbsd to release 6.6
hw/i386/x86-iommu: Add missing stubs
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.include | 2 | ||||
-rw-r--r-- | tests/fp/Makefile | 14 | ||||
-rw-r--r-- | tests/tcg/aarch64/Makefile.softmmu-target | 11 | ||||
-rw-r--r-- | tests/tcg/aarch64/Makefile.target | 7 | ||||
-rw-r--r-- | tests/tcg/aarch64/system/semiconsole.c | 38 | ||||
-rw-r--r-- | tests/tcg/arm/Makefile.target | 28 | ||||
-rw-r--r-- | tests/tcg/arm/semicall.h | 35 | ||||
-rw-r--r-- | tests/tcg/arm/semiconsole.c | 27 | ||||
-rw-r--r-- | tests/tcg/arm/semihosting.c | 21 | ||||
-rwxr-xr-x | tests/vm/freebsd | 3 | ||||
-rwxr-xr-x | tests/vm/openbsd | 4 |
11 files changed, 157 insertions, 33 deletions
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) 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/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/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 <inttypes.h> +#include <minilib.h> + +#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; +} diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 0765f37..11c39c6 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -31,15 +31,43 @@ 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,$@) \ $(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/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 <alex.bennee@linaro.org> + * + * 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/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 <alex.bennee@linaro.org> + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include <stdio.h> +#include <stdint.h> +#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; +} 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 <stdint.h> - -#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]) { 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}; """ 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 |