.editorconfig | 5 + .travis.yml | 2 +- MAINTAINERS | 8 + Makefile | 4 +- Makefile.target | 16 + default-configs/arm-softmmu.mak | 1 + default-configs/lm32-softmmu.mak | 2 + default-configs/m68k-softmmu.mak | 2 + default-configs/mips-softmmu-common.mak | 1 + default-configs/nios2-softmmu.mak | 2 + default-configs/xtensa-softmmu.mak | 2 + gdbstub.c | 2 +- hw/Kconfig | 1 + hw/Makefile.objs | 1 + hw/mips/mips_malta.c | 2 +- hw/semihosting/Kconfig | 3 + hw/semihosting/Makefile.objs | 2 + hw/semihosting/config.c | 186 ++++++++ hw/semihosting/console.c | 84 ++++ include/hw/semihosting/console.h | 38 ++ include/{exec => hw/semihosting}/semihost.h | 17 +- include/sysemu/sysemu.h | 1 + linux-user/Makefile.objs | 2 + linux-user/arm/semihost.c | 24 + qemu-options.hx | 6 +- stubs/Makefile.objs | 1 + stubs/semihost.c | 70 +++ target/arm/arm-semi.c | 96 ++-- target/arm/helper.c | 2 +- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 2 +- target/lm32/helper.c | 2 +- target/m68k/op_helper.c | 2 +- target/mips/Makefile.objs | 3 +- target/mips/helper.h | 2 + target/mips/mips-semi.c | 14 +- target/mips/translate.c | 10 +- target/nios2/helper.c | 2 +- target/xtensa/translate.c | 2 +- target/xtensa/xtensa-semi.c | 2 +- tests/Makefile.include | 8 +- tests/check-block.sh | 44 +- tests/docker/dockerfiles/fedora.docker | 7 + tests/docker/dockerfiles/ubuntu1804.docker | 57 +++ tests/qemu-iotests-quick.sh | 8 - tests/qemu-iotests/check | 177 ++++--- tests/qemu-iotests/group | 177 +++---- tests/tcg/Makefile | 1 + tests/tcg/aarch64/Makefile.softmmu-target | 34 ++ tests/tcg/aarch64/system/boot.S | 239 ++++++++++ tests/tcg/aarch64/system/kernel.ld | 24 + tests/tcg/alpha/Makefile.softmmu-target | 34 ++ tests/tcg/alpha/system/boot.S | 511 +++++++++++++++++++++ tests/tcg/alpha/system/kernel.ld | 30 ++ tests/tcg/i386/Makefile.softmmu-target | 4 +- tests/tcg/i386/system/memory.c | 243 ---------- tests/tcg/minilib/printf.c | 3 + tests/tcg/multiarch/system/Makefile.softmmu-target | 14 + tests/tcg/{i386 => multiarch}/system/hello.c | 0 tests/tcg/multiarch/system/memory.c | 449 ++++++++++++++++++ vl.c | 128 +----- 61 files changed, 2216 insertions(+), 602 deletions(-) create mode 100644 hw/semihosting/Kconfig create mode 100644 hw/semihosting/Makefile.objs create mode 100644 hw/semihosting/config.c create mode 100644 hw/semihosting/console.c create mode 100644 include/hw/semihosting/console.h rename include/{exec => hw/semihosting}/semihost.h (78%) create mode 100644 linux-user/arm/semihost.c create mode 100644 stubs/semihost.c create mode 100644 tests/docker/dockerfiles/ubuntu1804.docker delete mode 100755 tests/qemu-iotests-quick.sh create mode 100644 tests/tcg/aarch64/Makefile.softmmu-target create mode 100644 tests/tcg/aarch64/system/boot.S create mode 100644 tests/tcg/aarch64/system/kernel.ld create mode 100644 tests/tcg/alpha/Makefile.softmmu-target create mode 100644 tests/tcg/alpha/system/boot.S create mode 100644 tests/tcg/alpha/system/kernel.ld delete mode 100644 tests/tcg/i386/system/memory.c create mode 100644 tests/tcg/multiarch/system/Makefile.softmmu-target rename tests/tcg/{i386 => multiarch}/system/hello.c (100%) create mode 100644 tests/tcg/multiarch/system/memory.c
The following changes since commit a7b21f6762a2d6ec08106d8a7ccb11829914523f: Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-05-24 12:47:49 +0100) are available in the Git repository at: https://github.com/stsquad/qemu.git tags/pull-testing-next-280519-1 for you to fetch changes up to 4a344d91083e351c1c5ac877c0ab215335a1e23d: tests: Run the iotests during "make check" again (2019-05-28 10:28:51 +0100) ---------------------------------------------------------------- Various testing updates - semihosting re-factor (used in system tests) - aarch64 and alpha system tests - editorconfig tweak for .S - some docker image updates - iotests clean-up and make check inclusion ---------------------------------------------------------------- Alex Bennée (23): semihosting: move semihosting configuration into its own directory semihosting: introduce CONFIG_SEMIHOSTING semihosting: implement a semihosting console semihosting: enable chardev backed output for console target/arm: fixup some of the commentary for arm-semi target/arm: use the common interface for WRITE0/WRITEC in arm-semi target/arm: add LOG_UNIMP messages to arm-semi target/arm: correct return values for WRITE/READ in arm-semi target/mips: only build mips-semi for softmmu target/mips: convert UHI_plog to use common semihosting code MAINTAINERS: update for semihostings new home tests/tcg/multiarch: add support for multiarch system tests tests/tcg/multiarch: add hello world system test editorconfig: add settings for .s/.S files tests/tcg/aarch64: add system boot.S tests/tcg/multiarch: move the system memory test tests/tcg/minilib: support %c format char tests/tcg/multiarch: expand system memory test to cover more .travis.yml: enable aarch64-softmmu and alpha-softmmu tcg tests Makefile: fix coverage-report reference to BUILD_DIR Makefile: include per-target build directories in coverage report Makefile.target: support per-target coverage reports tests/qemu-iotests: re-format output to for make check-block Gerd Hoffmann (1): tests/docker: add ubuntu 18.04 Philippe Mathieu-Daudé (1): tests/docker: Test more components on the Fedora default image Richard Henderson (1): tests/tcg/alpha: add system boot.S Thomas Huth (2): tests/qemu-iotests/group: Re-use the "auto" group for tests that can always run tests: Run the iotests during "make check" again .editorconfig | 5 + .travis.yml | 2 +- MAINTAINERS | 8 + Makefile | 4 +- Makefile.target | 16 + default-configs/arm-softmmu.mak | 1 + default-configs/lm32-softmmu.mak | 2 + default-configs/m68k-softmmu.mak | 2 + default-configs/mips-softmmu-common.mak | 1 + default-configs/nios2-softmmu.mak | 2 + default-configs/xtensa-softmmu.mak | 2 + gdbstub.c | 2 +- hw/Kconfig | 1 + hw/Makefile.objs | 1 + hw/mips/mips_malta.c | 2 +- hw/semihosting/Kconfig | 3 + hw/semihosting/Makefile.objs | 2 + hw/semihosting/config.c | 186 ++++++++ hw/semihosting/console.c | 84 ++++ include/hw/semihosting/console.h | 38 ++ include/{exec => hw/semihosting}/semihost.h | 17 +- include/sysemu/sysemu.h | 1 + linux-user/Makefile.objs | 2 + linux-user/arm/semihost.c | 24 + qemu-options.hx | 6 +- stubs/Makefile.objs | 1 + stubs/semihost.c | 70 +++ target/arm/arm-semi.c | 96 ++-- target/arm/helper.c | 2 +- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 2 +- target/lm32/helper.c | 2 +- target/m68k/op_helper.c | 2 +- target/mips/Makefile.objs | 3 +- target/mips/helper.h | 2 + target/mips/mips-semi.c | 14 +- target/mips/translate.c | 10 +- target/nios2/helper.c | 2 +- target/xtensa/translate.c | 2 +- target/xtensa/xtensa-semi.c | 2 +- tests/Makefile.include | 8 +- tests/check-block.sh | 44 +- tests/docker/dockerfiles/fedora.docker | 7 + tests/docker/dockerfiles/ubuntu1804.docker | 57 +++ tests/qemu-iotests-quick.sh | 8 - tests/qemu-iotests/check | 177 ++++--- tests/qemu-iotests/group | 177 +++---- tests/tcg/Makefile | 1 + tests/tcg/aarch64/Makefile.softmmu-target | 34 ++ tests/tcg/aarch64/system/boot.S | 239 ++++++++++ tests/tcg/aarch64/system/kernel.ld | 24 + tests/tcg/alpha/Makefile.softmmu-target | 34 ++ tests/tcg/alpha/system/boot.S | 511 +++++++++++++++++++++ tests/tcg/alpha/system/kernel.ld | 30 ++ tests/tcg/i386/Makefile.softmmu-target | 4 +- tests/tcg/i386/system/memory.c | 243 ---------- tests/tcg/minilib/printf.c | 3 + tests/tcg/multiarch/system/Makefile.softmmu-target | 14 + tests/tcg/{i386 => multiarch}/system/hello.c | 0 tests/tcg/multiarch/system/memory.c | 449 ++++++++++++++++++ vl.c | 128 +----- 61 files changed, 2216 insertions(+), 602 deletions(-) create mode 100644 hw/semihosting/Kconfig create mode 100644 hw/semihosting/Makefile.objs create mode 100644 hw/semihosting/config.c create mode 100644 hw/semihosting/console.c create mode 100644 include/hw/semihosting/console.h rename include/{exec => hw/semihosting}/semihost.h (78%) create mode 100644 linux-user/arm/semihost.c create mode 100644 stubs/semihost.c create mode 100644 tests/docker/dockerfiles/ubuntu1804.docker delete mode 100755 tests/qemu-iotests-quick.sh create mode 100644 tests/tcg/aarch64/Makefile.softmmu-target create mode 100644 tests/tcg/aarch64/system/boot.S create mode 100644 tests/tcg/aarch64/system/kernel.ld create mode 100644 tests/tcg/alpha/Makefile.softmmu-target create mode 100644 tests/tcg/alpha/system/boot.S create mode 100644 tests/tcg/alpha/system/kernel.ld delete mode 100644 tests/tcg/i386/system/memory.c create mode 100644 tests/tcg/multiarch/system/Makefile.softmmu-target rename tests/tcg/{i386 => multiarch}/system/hello.c (100%) create mode 100644 tests/tcg/multiarch/system/memory.c -- 2.20.1
On Tue, 28 May 2019 at 10:49, Alex Bennée <alex.bennee@linaro.org> wrote: > > The following changes since commit a7b21f6762a2d6ec08106d8a7ccb11829914523f: > > Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-05-24 12:47:49 +0100) > > are available in the Git repository at: > > https://github.com/stsquad/qemu.git tags/pull-testing-next-280519-1 > > for you to fetch changes up to 4a344d91083e351c1c5ac877c0ab215335a1e23d: > > tests: Run the iotests during "make check" again (2019-05-28 10:28:51 +0100) > > ---------------------------------------------------------------- > Various testing updates > > - semihosting re-factor (used in system tests) > - aarch64 and alpha system tests > - editorconfig tweak for .S > - some docker image updates > - iotests clean-up and make check inclusion > Hi; this fails 'make check' on the clang sanitiser build for Linux x86-64. It looks like the code in qemu-imo-cmds.c is incorrectly doing a division-by-zero if the operation it is reporting on took less than a second... make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/clang' /home/petmay01/linaro/qemu-for-merges/tests/check-block.sh TEST iotest-qcow2: 001 TEST iotest-qcow2: 002 TEST iotest-qcow2: 003 TEST iotest-qcow2: 004 TEST iotest-qcow2: 005 TEST iotest-qcow2: 007 TEST iotest-qcow2: 008 TEST iotest-qcow2: 009 TEST iotest-qcow2: 010 TEST iotest-qcow2: 011 TEST iotest-qcow2: 012 --- /home/petmay01/linaro/qemu-for-merges/tests/qemu-iotests/013.out 2014-12-15 11:11:04.234972929 +0000 +++ /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/013.out.bad 2019-05-28 14:06:57.827692927 +010 0 @@ -17596,6 +17596,7 @@ With offset 0: === IO: pattern 0 +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime error: division by zero read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 4096/4096 bytes at offset 4096 @@ -21994,6 +21995,7 @@ No errors were found on the image. With offset 4294967296: === IO: pattern 0 +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime error: division by zero read 4096/4096 bytes at offset 4294967296 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 4096/4096 bytes at offset 4294971392 TEST iotest-qcow2: 013 [fail] QEMU -- "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x8 6_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-io" --cache writeback - f qcow2 QEMU_NBD -- "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- qcow2 (compat=1.1) IMGPROTO -- file PLATFORM -- Linux/x86_64 e104462 4.15.0-48-generic TEST_DIR -- /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/socket_scm_helper --- /home/petmay01/linaro/qemu-for-merges/tests/qemu-iotests/013.out 2014-12-15 11:11:04.234972929 +0000 +++ /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/013.out.bad 2019-05-28 14:06:57.827692927 +0100 @@ -17596,6 +17596,7 @@ With offset 0: === IO: pattern 0 +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime error: division by zero read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 4096/4096 bytes at offset 4096 @@ -21994,6 +21995,7 @@ No errors were found on the image. With offset 4294967296: === IO: pattern 0 +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime error: division by zero read 4096/4096 bytes at offset 4294967296 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 4096/4096 bytes at offset 4294971392 thanks -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On Tue, 28 May 2019 at 10:49, Alex Bennée <alex.bennee@linaro.org> wrote: >> >> The following changes since commit a7b21f6762a2d6ec08106d8a7ccb11829914523f: >> >> Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-05-24 12:47:49 +0100) >> >> are available in the Git repository at: >> >> https://github.com/stsquad/qemu.git tags/pull-testing-next-280519-1 >> >> for you to fetch changes up to 4a344d91083e351c1c5ac877c0ab215335a1e23d: >> >> tests: Run the iotests during "make check" again (2019-05-28 10:28:51 +0100) >> >> ---------------------------------------------------------------- >> Various testing updates >> >> - semihosting re-factor (used in system tests) >> - aarch64 and alpha system tests >> - editorconfig tweak for .S >> - some docker image updates >> - iotests clean-up and make check inclusion >> > > Hi; this fails 'make check' on the clang sanitiser build for Linux x86-64. > It looks like the code in qemu-imo-cmds.c is incorrectly doing > a division-by-zero if the operation it is reporting on took > less than a second... Sounds like we should include the sanitizer build in our normal setup. We currently only do: ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" with gcc-7. What are the clang configure runes you are using? > > make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/clang' > /home/petmay01/linaro/qemu-for-merges/tests/check-block.sh > TEST iotest-qcow2: 001 > TEST iotest-qcow2: 002 > TEST iotest-qcow2: 003 > TEST iotest-qcow2: 004 > TEST iotest-qcow2: 005 > TEST iotest-qcow2: 007 > TEST iotest-qcow2: 008 > TEST iotest-qcow2: 009 > TEST iotest-qcow2: 010 > TEST iotest-qcow2: 011 > TEST iotest-qcow2: 012 > --- /home/petmay01/linaro/qemu-for-merges/tests/qemu-iotests/013.out > 2014-12-15 11:11:04.234972929 +0000 > +++ /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/013.out.bad > 2019-05-28 14:06:57.827692927 +010 > 0 > @@ -17596,6 +17596,7 @@ > > With offset 0: > === IO: pattern 0 > +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime > error: division by zero > read 4096/4096 bytes at offset 0 > 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > read 4096/4096 bytes at offset 4096 > @@ -21994,6 +21995,7 @@ > No errors were found on the image. > With offset 4294967296: > === IO: pattern 0 > +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime > error: division by zero > read 4096/4096 bytes at offset 4294967296 > 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > read 4096/4096 bytes at offset 4294971392 > TEST iotest-qcow2: 013 [fail] > QEMU -- > "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x8 > 6_64" -nodefaults -machine accel=qtest > QEMU_IMG -- > "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-img" > QEMU_IO -- > "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-io" > --cache writeback - > f qcow2 > QEMU_NBD -- > "/home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/../../qemu-nbd" > IMGFMT -- qcow2 (compat=1.1) > IMGPROTO -- file > PLATFORM -- Linux/x86_64 e104462 4.15.0-48-generic > TEST_DIR -- > /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/scratch > SOCKET_SCM_HELPER -- > /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/socket_scm_helper > > --- /home/petmay01/linaro/qemu-for-merges/tests/qemu-iotests/013.out > 2014-12-15 11:11:04.234972929 +0000 > +++ /home/petmay01/linaro/qemu-for-merges/build/clang/tests/qemu-iotests/013.out.bad > 2019-05-28 14:06:57.827692927 +0100 > @@ -17596,6 +17596,7 @@ > > With offset 0: > === IO: pattern 0 > +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime > error: division by zero > read 4096/4096 bytes at offset 0 > 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > read 4096/4096 bytes at offset 4096 > @@ -21994,6 +21995,7 @@ > No errors were found on the image. > With offset 4294967296: > === IO: pattern 0 > +/home/petmay01/linaro/qemu-for-merges/qemu-io-cmds.c:264:18: runtime > error: division by zero > read 4096/4096 bytes at offset 4294967296 > 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > read 4096/4096 bytes at offset 4294971392 > > thanks > -- PMM -- Alex Bennée
On Tue, 28 May 2019 at 14:47, Alex Bennée <alex.bennee@linaro.org> wrote: > Sounds like we should include the sanitizer build in our normal setup. > We currently only do: > > ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread > -fuse-ld=gold" > > with gcc-7. What are the clang configure runes you are using? I use '../../configure' '--cc=clang' '--cxx=clang++' '--enable-gtk' '--extra-cflags=-fsanitize=undefined -fno-sanitize=shift-base -Werror' (which we document at https://wiki.qemu.org/Testing#clang_UBSan) thanks -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On Tue, 28 May 2019 at 14:47, Alex Bennée <alex.bennee@linaro.org> wrote: >> Sounds like we should include the sanitizer build in our normal setup. >> We currently only do: >> >> ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread >> -fuse-ld=gold" >> >> with gcc-7. What are the clang configure runes you are using? > > I use > '../../configure' '--cc=clang' '--cxx=clang++' '--enable-gtk' > '--extra-cflags=-fsanitize=undefined -fno-sanitize=shift-base > -Werror' OK - I'll drop the final patch for now and respin and include it the next testing/next > > (which we document at https://wiki.qemu.org/Testing#clang_UBSan) > > thanks > -- PMM -- Alex Bennée
On 28/05/19 16:02, Peter Maydell wrote: > On Tue, 28 May 2019 at 14:47, Alex Bennée <alex.bennee@linaro.org> wrote: >> Sounds like we should include the sanitizer build in our normal setup. >> We currently only do: >> >> ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread >> -fuse-ld=gold" >> >> with gcc-7. What are the clang configure runes you are using? > > I use > '../../configure' '--cc=clang' '--cxx=clang++' '--enable-gtk' > '--extra-cflags=-fsanitize=undefined -fno-sanitize=shift-base > -Werror' > > (which we document at https://wiki.qemu.org/Testing#clang_UBSan) Oh, so this is ubsan! It is not covered by Patchew, which however found some issues in the Address Sanitizer build that were uncovered by check-block. Logs are available at https://patchew.org/logs/20190530101603.22254-1-alex.bennee@linaro.org/testing.asan/?type=message. Paolo
This cleans up a number of the block comments to fit the proper style. While we are at it we also reference the official specification and document what the return register value can be. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index a99049c7d58..d812eef1519 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -2,6 +2,7 @@ * Arm "Angel" semihosting syscalls * * Copyright (c) 2005, 2007 CodeSourcery. + * Copyright (c) 2019 Linaro * Written by Paul Brook. * * This program is free software; you can redistribute it and/or modify @@ -16,6 +17,10 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. + * + * ARM Semihosting is documented in: + * Semihosting for AArch32 and AArch64 Release 2.0 + * https://static.docs.arm.com/100863/0200/semihosting.pdf */ #include "qemu/osdep.h" @@ -239,6 +244,15 @@ static target_ulong arm_gdb_syscall(ARMCPU *cpu, gdb_syscall_complete_cb cb, put_user_u64(val, args + (n) * 8) : \ put_user_u32(val, args + (n) * 4)) +/* + * Do a semihosting call. + * + * The specification always says that the "return register" either + * returns a specific value or is corrupted, so we don't need to + * report to our caller whether we are returning a value or trying to + * leave the register unchanged. We use 0xdeadbeef as the return value + * when there isn't a defined return value for the call. + */ target_ulong do_arm_semihosting(CPUARMState *env) { ARMCPU *cpu = arm_env_get_cpu(env); @@ -509,14 +523,16 @@ target_ulong do_arm_semihosting(CPUARMState *env) output_size = ts->info->arg_end - ts->info->arg_start; if (!output_size) { - /* We special-case the "empty command line" case (argc==0). - Just provide the terminating 0. */ + /* + * We special-case the "empty command line" case (argc==0). + * Just provide the terminating 0. + */ output_size = 1; } #endif if (output_size > input_size) { - /* Not enough space to store command-line arguments. */ + /* Not enough space to store command-line arguments. */ return -1; } @@ -570,8 +586,10 @@ target_ulong do_arm_semihosting(CPUARMState *env) GET_ARG(0); #ifdef CONFIG_USER_ONLY - /* Some C libraries assume the heap immediately follows .bss, so - allocate it using sbrk. */ + /* + * Some C libraries assume the heap immediately follows .bss, so + * allocate it using sbrk. + */ if (!ts->heap_limit) { abi_ulong ret; @@ -619,7 +637,8 @@ target_ulong do_arm_semihosting(CPUARMState *env) } case TARGET_SYS_EXIT: if (is_a64(env)) { - /* The A64 version of this call takes a parameter block, + /* + * The A64 version of this call takes a parameter block, * so the application-exit type can return a subcode which * is the exit status code from the application. */ @@ -632,14 +651,17 @@ target_ulong do_arm_semihosting(CPUARMState *env) ret = 1; } } else { - /* ARM specifies only Stopped_ApplicationExit as normal - * exit, everything else is considered an error */ + /* + * ARM specifies only Stopped_ApplicationExit as normal + * exit, everything else is considered an error + */ ret = (args == ADP_Stopped_ApplicationExit) ? 0 : 1; } gdb_exit(env, ret); exit(ret); case TARGET_SYS_SYNCCACHE: - /* Clean the D-cache and invalidate the I-cache for the specified + /* + * Clean the D-cache and invalidate the I-cache for the specified * virtual address range. This is a nop for us since we don't * implement caches. This is only present on A64. */ -- 2.20.1
Clean-up our unimplemented bits with a proper message. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 384b01124e1..86e6ec48c2f 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -28,6 +28,7 @@ #include "cpu.h" #include "hw/semihosting/semihost.h" #include "hw/semihosting/console.h" +#include "qemu/log.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" @@ -363,7 +364,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) return len - ret; } case TARGET_SYS_READC: - /* XXX: Read from debug console. Not implemented. */ + qemu_log_mask(LOG_UNIMP, "%s: SYS_READC not implemented", __func__); return 0; case TARGET_SYS_ISTTY: GET_ARG(0); @@ -397,7 +398,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) return buf.st_size; } case TARGET_SYS_TMPNAM: - /* XXX: Not implemented. */ + qemu_log_mask(LOG_UNIMP, "%s: SYS_TMPNAM not implemented", __func__); return -1; case TARGET_SYS_REMOVE: GET_ARG(0); -- 2.20.1
The documentation says the write should return the number of bytes not written on an error (0 means everything was written). Read provides a buffer length and the return value should be the buffer length - bytes actually read. Remove the incorrect FIXME's and return the correct values. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 86e6ec48c2f..53e807ab721 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -331,13 +331,15 @@ target_ulong do_arm_semihosting(CPUARMState *env) } else { s = lock_user(VERIFY_READ, arg1, len, 1); if (!s) { - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; + /* Return bytes not written on error */ + return len; } ret = set_swi_errno(ts, write(arg0, s, len)); unlock_user(s, arg1, 0); - if (ret == (uint32_t)-1) - return -1; + if (ret == (uint32_t)-1) { + ret = 0; + } + /* Return bytes not written */ return len - ret; } case TARGET_SYS_READ: @@ -352,15 +354,17 @@ target_ulong do_arm_semihosting(CPUARMState *env) } else { s = lock_user(VERIFY_WRITE, arg1, len, 0); if (!s) { - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; + /* return bytes not read */ + return len; } do { ret = set_swi_errno(ts, read(arg0, s, len)); } while (ret == -1 && errno == EINTR); unlock_user(s, arg1, len); - if (ret == (uint32_t)-1) - return -1; + if (ret == (uint32_t)-1) { + ret = 0; + } + /* Return bytes not read */ return len - ret; } case TARGET_SYS_READC: -- 2.20.1
Rather than printing directly to stdout lets use our common semihosting code. There is one minor difference in that the output currently defaults to stderr instead of stdout however this can be controlled by connecting semihosting to a chardev. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c index eac8374fb34..35bdfd7c77e 100644 --- a/target/mips/mips-semi.c +++ b/target/mips/mips-semi.c @@ -23,6 +23,7 @@ #include "exec/helper-proto.h" #include "exec/softmmu-semi.h" #include "hw/semihosting/semihost.h" +#include "hw/semihosting/console.h" typedef enum UHIOp { UHI_exit = 1, @@ -329,13 +330,12 @@ void helper_do_semihosting(CPUMIPSState *env) p2 = strstr(p, "%d"); if (p2) { int char_num = p2 - p; - char *buf = g_malloc(char_num + 1); - strncpy(buf, p, char_num); - buf[char_num] = '\0'; - gpr[2] = printf("%s%d%s", buf, (int)gpr[5], p2 + 2); - g_free(buf); + GString *s = g_string_new_len(p, char_num); + g_string_append_printf(s, "%d%s", (int)gpr[5], p2 + 2); + gpr[2] = qemu_semihosting_log_out(s->str, s->len); + g_string_free(s, true); } else { - gpr[2] = printf("%s", p); + gpr[2] = qemu_semihosting_log_out(p, strlen(p)); } FREE_TARGET_STRING(p, gpr[4]); break; -- 2.20.1
Seeing as I touched it I should at least keep an eye on it. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 3cacd751bf3..cc1178fe692 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2562,6 +2562,13 @@ F: docs/pvrdma.txt F: contrib/rdmacm-mux/* F: qapi/rdma.json +Semihosting +M: Alex Bennée <alex.bennee@linaro.org> +L: qemu-devel@nongnu.org +S: Maintained +F: hw/semihosting/ +F: include/hw/semihosting/ + Build and test automation ------------------------- Build and test automation -- 2.20.1
From: Gerd Hoffmann <kraxel@redhat.com> Based on the ubuntu.docker file. Used to reproduce the build failure Peter was seeing. Others might find this useful too ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20190503070241.24786-1-kraxel@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/tests/docker/dockerfiles/ubuntu1804.docker b/tests/docker/dockerfiles/ubuntu1804.docker new file mode 100644 index 00000000000..2e2900150b0 --- /dev/null +++ b/tests/docker/dockerfiles/ubuntu1804.docker @@ -0,0 +1,57 @@ +FROM ubuntu:18.04 +ENV PACKAGES flex bison \ + ccache \ + clang \ + gcc \ + gettext \ + git \ + glusterfs-common \ + libaio-dev \ + libattr1-dev \ + libbluetooth-dev \ + libbrlapi-dev \ + libbz2-dev \ + libcacard-dev \ + libcap-dev \ + libcap-ng-dev \ + libcurl4-gnutls-dev \ + libdrm-dev \ + libepoxy-dev \ + libfdt-dev \ + libgbm-dev \ + libgtk-3-dev \ + libibverbs-dev \ + libiscsi-dev \ + libjemalloc-dev \ + libjpeg-turbo8-dev \ + liblzo2-dev \ + libncurses5-dev \ + libncursesw5-dev \ + libnfs-dev \ + libnss3-dev \ + libnuma-dev \ + libpixman-1-dev \ + librados-dev \ + librbd-dev \ + librdmacm-dev \ + libsasl2-dev \ + libsdl2-dev \ + libseccomp-dev \ + libsnappy-dev \ + libspice-protocol-dev \ + libspice-server-dev \ + libssh2-1-dev \ + libusb-1.0-0-dev \ + libusbredirhost-dev \ + libvdeplug-dev \ + libvte-2.91-dev \ + libxen-dev \ + make \ + python-yaml \ + sparse \ + texinfo \ + xfslibs-dev +RUN apt-get update && \ + apt-get -y install $PACKAGES +RUN dpkg -l $PACKAGES | sort > /packages.txt +ENV FEATURES clang pyyaml sdl2 -- 2.20.1
From: Philippe Mathieu-Daudé <philmd@redhat.com> Install optional dependencies of QEMU to get better coverage. The following components are now enabled: $ ./configure ... Multipath support yes VNC SASL support yes RDMA support yes PVRDMA support yes libiscsi support yes seccomp support yes libpmem support yes libudev yes Note: The udev-devel package is provided by systemd-devel. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190504055440.20406-1-philmd@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com> diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker index 69d4a7f5d75..afbba29adaa 100644 --- a/tests/docker/dockerfiles/fedora.docker +++ b/tests/docker/dockerfiles/fedora.docker @@ -8,6 +8,7 @@ ENV PACKAGES \ bzip2-devel \ ccache \ clang \ + cyrus-sasl-devel \ device-mapper-multipath-devel \ findutils \ flex \ @@ -23,13 +24,17 @@ ENV PACKAGES \ libaio-devel \ libasan \ libattr-devel \ + libblockdev-mpath-devel \ libcap-devel \ libcap-ng-devel \ libcurl-devel \ libfdt-devel \ + libiscsi-devel \ libjpeg-devel \ + libpmem-devel \ libpng-devel \ librbd-devel \ + libseccomp-devel \ libssh2-devel \ libubsan \ libusbx-devel \ @@ -74,10 +79,12 @@ ENV PACKAGES \ pixman-devel \ python3 \ PyYAML \ + rdma-core-devel \ SDL2-devel \ snappy-devel \ sparse \ spice-server-devel \ + systemd-devel \ systemtap-sdt-devel \ tar \ usbredir-devel \ -- 2.20.1
This is not really i386 only, we can have the same test for all architectures supporting system tests. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target index 53c9c5ece06..c31bbbf39a7 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -27,7 +27,7 @@ CFLAGS+=-m32 LINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386 # FIXME: move to common once x86_64 is bootstrapped -TESTS+=$(X86_TESTS) +TESTS+=$(X86_TESTS) $(MULTIARCH_TESTS) endif CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc diff --git a/tests/tcg/i386/system/hello.c b/tests/tcg/multiarch/system/hello.c similarity index 100% rename from tests/tcg/i386/system/hello.c rename to tests/tcg/multiarch/system/hello.c -- 2.20.1
We are starting to add assembler foe tests/tcg so lets make sure we get the mode right. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/.editorconfig b/.editorconfig index 15828833938..df6db65531d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,6 +26,11 @@ file_type_emacs = makefile indent_style = space indent_size = 4 +[*.{s,S}] +indent_style = tab +indent_size = 8 +file_type_emacs = asm + [*.{vert,frag}] file_type_emacs = glsl -- 2.20.1
There is nothing inherently architecture specific about the memory test although we may have to manage different restrictions of unaligned access across architectures. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/i386/system/memory.c b/tests/tcg/multiarch/system/memory.c similarity index 100% rename from tests/tcg/i386/system/memory.c rename to tests/tcg/multiarch/system/memory.c -- 2.20.1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/minilib/printf.c b/tests/tcg/minilib/printf.c index 121620cb162..10472b4f585 100644 --- a/tests/tcg/minilib/printf.c +++ b/tests/tcg/minilib/printf.c @@ -119,6 +119,9 @@ void ml_printf(const char *fmt, ...) str = va_arg(ap, char*); print_str(str); break; + case 'c': + __sys_outc(va_arg(ap, int)); + break; case '%': __sys_outc(*fmt); break; -- 2.20.1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/.travis.yml b/.travis.yml index 6fd89b3d915..b053a836a32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -284,5 +284,5 @@ matrix: # Run check-tcg against softmmu targets - env: - - CONFIG="--target-list=xtensa-softmmu,arm-softmmu" + - CONFIG="--target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" - TEST_CMD="make -j3 check-tcg V=1" -- 2.20.1
Commit 337f2311f actually claimed to do this in the commit log but didn't actually. Oops. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/Makefile b/Makefile index e02b88bcb11..73370874841 100644 --- a/Makefile +++ b/Makefile @@ -1009,7 +1009,7 @@ $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl %/coverage-report.html: @mkdir -p $* $(call quiet-command,\ - gcovr -r $(SRC_PATH) --object-directory $(BUILD_PATH) \ + gcovr -r $(SRC_PATH) --object-directory $(BUILD_DIR) \ -p --html --html-details -o $@, \ "GEN", "coverage-report.html") -- 2.20.1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/Makefile b/Makefile index 73370874841..f0be624f471 100644 --- a/Makefile +++ b/Makefile @@ -1009,7 +1009,9 @@ $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl %/coverage-report.html: @mkdir -p $* $(call quiet-command,\ - gcovr -r $(SRC_PATH) --object-directory $(BUILD_DIR) \ + gcovr -r $(SRC_PATH) \ + $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \ + --object-directory $(BUILD_DIR) \ -p --html --html-details -o $@, \ "GEN", "coverage-report.html") -- 2.20.1
Add support for generating a single targets coverage report. Execute: make coverage-report In the target build directory. This coverage report only cares about target specific blobs so only searches the target build subdirectory. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/Makefile.target b/Makefile.target index 4ef4ce59969..ecd856e3a3f 100644 --- a/Makefile.target +++ b/Makefile.target @@ -238,3 +238,19 @@ endif generated-files-y += config-target.h Makefile: $(generated-files-y) + +# Reports/Analysis +# +# The target specific coverage report only cares about target specific +# blobs and not the shared code. +# + +%/coverage-report.html: + @mkdir -p $* + $(call quiet-command,\ + gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \ + -p --html --html-details -o $@, \ + "GEN", "coverage-report.html") + +.PHONY: coverage-report +coverage-report: $(CURDIR)/reports/coverage/coverage-report.html -- 2.20.1
From: Thomas Huth <thuth@redhat.com> Currently, all tests are in the "auto" group. This is a little bit pointless. OTOH, we need a group for the tests that we can automatically run during "make check" each time, too. Tests in this new group are supposed to run with every possible QEMU configuration, for example they must run with every QEMU binary (also non-x86), without failing when an optional features is missing (but reporting "skip" is ok), and be able to run on all kind of host filesystems and users (i.e. also as "nobody" or "root"). So let's use the "auto" group for this class of tests now. The initial list has been determined by running the iotests with non-x86 QEMU targets and with our CI pipelines on Gitlab, Cirrus-CI and Travis (i.e. including macOS and FreeBSD). Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20190502084506.8009-7-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 52b7c16e155..2c74deec00e 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -1,8 +1,21 @@ # # QA groups control file # Defines test groups +# +# Some notes about the groups: +# # - do not start group names with a digit # +# - quick : Tests in this group should finish within some few seconds. +# +# - img : Tests in this group can be used to excercise the qemu-img tool. +# +# - auto : Tests in this group are used during "make check" and should be +# runnable in any case. That means they should run with every QEMU binary +# (also non-x86), with every QEMU configuration (i.e. must not fail if +# an optional feature is not compiled in - but reporting a "skip" is ok), +# and work all kind of host filesystems and users (e.g. "nobody" or "root"). +# # # test-group association ... one line per test @@ -32,11 +45,11 @@ 023 rw auto 024 rw backing auto quick 025 rw auto quick -026 rw blkdbg auto +026 rw blkdbg 027 rw auto quick -028 rw backing auto quick +028 rw backing quick 029 rw auto quick -030 rw auto backing +030 rw backing 031 rw auto quick 032 rw auto quick 033 rw auto quick @@ -46,35 +59,35 @@ 037 rw auto backing quick 038 rw auto backing quick 039 rw auto quick -040 rw auto -041 rw auto backing +040 rw +041 rw backing 042 rw auto quick 043 rw auto backing -044 rw auto -045 rw auto quick +044 rw +045 rw quick 046 rw auto aio quick 047 rw auto quick 048 img auto quick 049 rw auto 050 rw auto backing quick -051 rw auto +051 rw 052 rw auto backing quick 053 rw auto quick 054 rw auto quick -055 rw auto -056 rw auto backing -057 rw auto -058 rw auto quick +055 rw +056 rw backing +057 rw +058 rw quick 059 rw auto quick 060 rw auto quick 061 rw auto 062 rw auto quick 063 rw auto quick 064 rw auto quick -065 rw auto quick +065 rw quick 066 rw auto quick -067 rw auto quick -068 rw auto quick +067 rw quick +068 rw quick 069 rw auto quick 070 rw auto quick 071 rw auto quick @@ -91,18 +104,18 @@ 082 rw auto quick 083 rw auto 084 img auto quick -085 rw auto +085 rw 086 rw auto quick -087 rw auto quick +087 rw quick 088 rw auto quick 089 rw auto quick 090 rw auto quick 091 rw auto migration 092 rw auto quick -093 auto +093 throttle 094 rw auto quick -095 rw auto quick -096 rw auto quick +095 rw quick +096 rw quick 097 rw auto backing 098 rw auto backing quick 099 rw auto quick @@ -118,60 +131,60 @@ 109 rw auto 110 rw auto backing quick 111 rw auto quick -112 rw auto +112 rw 113 rw auto quick 114 rw auto quick -115 rw auto +115 rw 116 rw auto quick 117 rw auto -118 rw auto +118 rw 119 rw auto quick 120 rw auto quick -121 rw auto +121 rw 122 rw auto 123 rw auto quick -124 rw auto backing -125 rw auto +124 rw backing +125 rw 126 rw auto backing -127 rw auto backing quick +127 rw backing quick 128 rw auto quick -129 rw auto quick +129 rw quick 130 rw auto quick 131 rw auto quick -132 rw auto quick +132 rw quick 133 auto quick 134 rw auto quick 135 rw auto -136 rw auto +136 rw 137 rw auto 138 rw auto quick -139 rw auto quick +139 rw quick 140 rw auto quick 141 rw auto quick 142 auto 143 auto quick -144 rw auto quick -145 auto quick +144 rw quick +145 quick 146 auto quick -147 auto -148 rw auto quick -149 rw auto sudo +147 img +148 rw quick +149 rw sudo 150 rw auto quick -151 rw auto -152 rw auto quick -153 rw auto quick +151 rw +152 rw quick +153 rw quick 154 rw auto backing quick -155 rw auto +155 rw 156 rw auto quick -157 auto +157 quick 158 rw auto quick 159 rw auto quick 160 rw auto quick 161 rw auto quick -162 auto quick -163 rw auto -165 rw auto quick -169 rw auto quick migration +162 quick +163 rw +165 rw quick +169 rw quick migration 170 rw auto quick 171 rw auto quick 172 auto @@ -180,74 +193,74 @@ 175 auto quick 176 rw auto backing 177 rw auto quick -178 auto +178 img 179 rw auto quick 181 rw auto migration -182 rw auto quick -183 rw auto migration +182 rw quick +183 rw migration 184 rw auto quick -185 rw auto +185 rw 186 rw auto 187 rw auto -188 rw auto quick -189 rw auto +188 rw quick +189 rw 190 rw auto quick 191 rw auto 192 rw auto quick -194 rw auto migration quick +194 rw migration quick 195 rw auto quick -196 rw auto quick migration +196 rw quick migration 197 rw auto quick -198 rw auto -199 rw auto migration -200 rw auto +198 rw +199 rw migration +200 rw 201 rw auto migration -202 rw auto quick -203 rw auto migration -204 rw auto quick -205 rw auto quick -206 rw auto +202 rw quick +203 rw migration +204 rw quick +205 rw quick +206 rw 207 rw auto -208 rw auto quick -209 rw auto quick +208 rw quick +209 rw quick 210 rw auto 211 rw auto quick 212 rw auto quick 213 rw auto quick 214 rw auto 215 rw auto quick -216 rw auto quick +216 rw quick 217 rw auto quick -218 rw auto quick -219 rw auto +218 rw quick +219 rw 220 rw auto 221 rw auto quick -222 rw auto quick -223 rw auto quick -224 rw auto quick +222 rw quick +223 rw quick +224 rw quick 225 rw auto quick 226 auto quick -227 auto quick -228 rw auto quick +227 quick +228 rw quick 229 auto quick 231 auto quick -232 auto quick +232 quick 233 auto quick -234 auto quick migration -235 auto quick -236 auto quick +234 quick migration +235 quick +236 quick 237 rw auto quick -238 auto quick +238 quick 239 rw auto quick -240 auto quick +240 quick 241 rw auto quick -242 rw auto quick +242 rw quick 243 rw auto quick 244 rw auto quick -245 rw auto -246 rw auto quick -247 rw auto quick -248 rw auto quick +245 rw +246 rw quick +247 rw quick +248 rw quick 249 rw auto quick 252 rw auto backing quick 253 rw auto quick -- 2.20.1
This attempts to clean-up the output to better match the output of the rest of the QEMU check system when called with -makecheck. This includes: - formatting as " TEST iotest-FMT: nnn" - only dumping config on failure (when -makecheck enabled) The non-make check output has been cleaned up as well: - line re-displayed (\r) at the end - fancy colours for pass/fail/skip - timestamps always printed (option removed) Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20190503143904.31211-1-alex.bennee@linaro.org> Tested-by: Thomas Huth <thuth@redhat.com> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 922c5d1d3d3..95162c6cf90 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -27,9 +27,7 @@ bad="" notrun="" casenotrun="" interrupt=true - -# by default don't output timestamps -timestamp=${TIMESTAMP:=false} +makecheck=false _init_error() { @@ -88,6 +86,22 @@ _full_platform_details() echo "$os/$platform $host $kernel" } +_full_env_details() +{ + cat <<EOF +QEMU -- "$QEMU_PROG" $QEMU_OPTIONS +QEMU_IMG -- "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS +QEMU_IO -- "$QEMU_IO_PROG" $QEMU_IO_OPTIONS +QEMU_NBD -- "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS +IMGFMT -- $FULL_IMGFMT_DETAILS +IMGPROTO -- $IMGPROTO +PLATFORM -- $FULL_HOST_DETAILS +TEST_DIR -- $TEST_DIR +SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER + +EOF +} + # $1 = prog to look for set_prog_path() { @@ -254,8 +268,8 @@ other options -misalign misalign memory allocations -n show me, do not run tests -o options -o options to pass to qemu-img create/convert - -T output timestamps -c mode cache mode + -makecheck pretty print output for make check testlist options -g group[,group...] include tests from these groups @@ -403,7 +417,10 @@ testlist options command -v xxdiff >/dev/null 2>&1 && diff=xxdiff fi ;; - + -makecheck) # makecheck friendly output + makecheck=true + xpand=false + ;; -n) # show me, don't do it showme=true xpand=false @@ -416,8 +433,7 @@ testlist options cachemode=true xpand=false ;; - -T) # turn on timestamp output - timestamp=true + -T) # deprecated timestamp option xpand=false ;; @@ -633,12 +649,6 @@ _wallclock() date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }' } -_timestamp() -{ - now=$(date "+%T") - printf %s " [$now]" -} - _wrapup() { if $showme @@ -704,23 +714,54 @@ END { if (NR > 0) { trap "_wrapup; exit \$status" 0 1 2 3 15 +# Report the test start and results. For makecheck we want to pretty +# print the whole report at the end of the execution. +# args: $seq, $starttime, $lasttime +_report_test_start() +{ + if ! $makecheck; then + if [ -n "$3" ]; then + local lasttime=" (last: $3s)" + fi + printf "%-8s %-10s [%s] %4s%-14s\r" "$1" "..." "$2" "..." "$lasttime" + fi +} +# args:$seq $status $starttime $lasttime $thistime $details +_report_test_result() +{ + local status lasttime thistime + if $makecheck; then + if [ -n "$2" ] && [ "$2" != "pass" ]; then + status=" [$2]" + fi + printf " TEST iotest-$IMGFMT: %s%s\n" "$1" "$status" + return + fi + + if [ -n "$4" ]; then + lasttime=" (last: $4s)" + fi + if [ -n "$5" ]; then + thistime=" $5s" + fi + case "$2" in + "pass") status=$(printf "\e[32m%-10s\e[0m" "$2") ;; + "fail") status=$(printf "\e[1m\e[31m%-10s\e[0m" "$2") ;; + "not run") status=$(printf "\e[33m%-10s\e[0m" "$2") ;; + *) status=$(printf "%-10s" "$2") ;; + esac + + printf "%-8s %s [%s] [%s] %4s%-14s %s\n" "$1" "$status" "$3" "$(date '+%T')" "$thistime" "$lasttime" "$6" +} + [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE FULL_IMGFMT_DETAILS=$(_full_imgfmt_details) FULL_HOST_DETAILS=$(_full_platform_details) -cat <<EOF -QEMU -- "$QEMU_PROG" $QEMU_OPTIONS -QEMU_IMG -- "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS -QEMU_IO -- "$QEMU_IO_PROG" $QEMU_IO_OPTIONS -QEMU_NBD -- "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS -IMGFMT -- $FULL_IMGFMT_DETAILS -IMGPROTO -- $IMGPROTO -PLATFORM -- $FULL_HOST_DETAILS -TEST_DIR -- $TEST_DIR -SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER - -EOF +if ! $makecheck; then + _full_env_details +fi seq="check" @@ -728,42 +769,43 @@ seq="check" for seq in $list do - err=false - printf %s "$seq" + err=false # error flag + printdiff=false # show diff to reference output? + status="" # test result summary + results="" # test result details + if [ -n "$TESTS_REMAINING_LOG" ] ; then sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG sync fi + lasttime=$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE) + starttime=$(date "+%T") + _report_test_start $seq $starttime $lasttime + if $showme then - echo - continue + status="not run" elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null then - echo " - expunged" + status="not run" + results="expunged" rm -f $seq.out.bad echo "/^$seq\$/d" >>$tmp.expunged elif [ ! -f "$source_iotests/$seq" ] then - echo " - no such test?" + status="not run" + results="no such test?" echo "/^$seq\$/d" >>$tmp.expunged else # really going to try and run this one # rm -f $seq.out.bad - lasttime=$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE) - if [ "X$lasttime" != X ]; then - printf %s " ${lasttime}s ..." - else - printf " " # prettier output with timestamps. - fi rm -f core $seq.notrun rm -f $seq.casenotrun start=$(_wallclock) - $timestamp && printf %s " [$(date "+%T")]" if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then run_command="$PYTHON $seq" @@ -781,26 +823,26 @@ do $run_command >$tmp.out 2>&1) fi sts=$? - $timestamp && _timestamp stop=$(_wallclock) if [ -f core ] then - printf " [dumped core]" mv core $seq.core + status="fail" + results="[dumped core] $seq.core" err=true fi if [ -f $seq.notrun ] then - $timestamp || printf " [not run] " - $timestamp && echo " [not run]" && printf %s " $seq -- " - cat $seq.notrun - notrun="$notrun $seq" + # overwrites timestamp output + status="not run" + results="$(cat $seq.notrun)" else if [ $sts -ne 0 ] then - printf %s " [failed, exit status $sts]" + status="fail" + results=$(printf %s "[failed, exit status $sts]") err=true fi @@ -821,22 +863,23 @@ do if [ ! -f "$reference" ] then - echo " - no qualified output" + status="fail" + reason="no qualified output" err=true else if diff -w "$reference" $tmp.out >/dev/null 2>&1 then - echo "" - if $err - then - : - else - echo "$seq $(expr $stop - $start)" >>$tmp.time + if ! $err; then + status="pass" + thistime=$(expr $stop - $start) + echo "$seq $thistime" >>$tmp.time fi else - echo " - output mismatch (see $seq.out.bad)" mv $tmp.out $seq.out.bad $diff -w "$reference" "$PWD"/$seq.out.bad + status="fail" + results="output mismatch (see $seq.out.bad)" + printdiff=true err=true fi fi @@ -850,13 +893,27 @@ do # come here for each test, except when $showme is true # - if $err - then - bad="$bad $seq" - n_bad=$(expr $n_bad + 1) - quick=false - fi - [ -f $seq.notrun ] || try=$(expr $try + 1) + _report_test_result $seq "$status" "$starttime" "$lasttime" "$thistime" "$results" + case "$status" in + "pass") + try=$(expr $try + 1) + ;; + "fail") + try=$(expr $try + 1) + if $makecheck; then + _full_env_details + fi + if $printdiff; then + $diff -w "$reference" "$PWD"/$seq.out.bad + fi + bad="$bad $seq" + n_bad=$(expr $n_bad + 1) + quick=false + ;; + "not run") + notrun="$notrun $seq" + ;; + esac seq="after_$seq" done -- 2.20.1
© 2016 - 2024 Red Hat, Inc.