[PULL 00/41] testing updates (vm, gitlab, misc build fixes)

Alex Bennée posted 41 patches 3 years, 9 months ago
Only 17 patches received!
There is a newer version of this series
configure                                          |  31 +-
linux-user/elfload.c                               |  10 +-
tests/qht-bench.c                                  |  40 ++-
util/coroutine-ucontext.c                          |  52 ++--
.gitignore                                         |   1 +
.gitlab-ci.d/containers.yml                        | 263 ++++++++++++++++
.gitlab-ci.d/edk2.yml                              |   5 +-
.gitlab-ci.d/opensbi.yml                           |   5 +-
.gitlab-ci.yml                                     | 281 ++++++++++-------
.shippable.yml                                     |   8 +-
.travis.yml                                        |  62 ++--
python/qemu/console_socket.py                      | 110 +++++++
python/qemu/machine.py                             |  23 +-
tests/Makefile.include                             |  19 +-
tests/acceptance/boot_linux.py                     |   2 +
tests/acceptance/linux_initrd.py                   |   3 +
tests/acceptance/machine_mips_malta.py             |   3 +
tests/acceptance/machine_rx_gdbsim.py              |   2 +-
tests/acceptance/replay_kernel.py                  |   2 +-
tests/docker/Makefile.include                      |  17 +-
tests/docker/common.rc                             |   2 +-
tests/docker/docker.py                             |  46 ++-
.../dockerfiles/debian-all-test-cross.docker       |  53 ++++
tests/docker/dockerfiles/debian-alpha-cross.docker |   2 +-
tests/docker/dockerfiles/debian-amd64-cross.docker |   2 +-
tests/docker/dockerfiles/debian-amd64.docker       |   2 +-
tests/docker/dockerfiles/debian-arm64-cross.docker |   2 +-
.../dockerfiles/debian-arm64-test-cross.docker     |   2 +-
tests/docker/dockerfiles/debian-armel-cross.docker |   2 +-
tests/docker/dockerfiles/debian-armhf-cross.docker |   2 +-
tests/docker/dockerfiles/debian-hppa-cross.docker  |   2 +-
tests/docker/dockerfiles/debian-m68k-cross.docker  |   2 +-
tests/docker/dockerfiles/debian-mips-cross.docker  |   2 +-
.../docker/dockerfiles/debian-mips64-cross.docker  |   2 +-
.../dockerfiles/debian-mips64el-cross.docker       |   2 +-
.../docker/dockerfiles/debian-mipsel-cross.docker  |   2 +-
.../docker/dockerfiles/debian-powerpc-cross.docker |   2 +-
tests/docker/dockerfiles/debian-ppc64-cross.docker |   2 +-
.../docker/dockerfiles/debian-ppc64el-cross.docker |   2 +-
.../docker/dockerfiles/debian-riscv64-cross.docker |   2 +-
tests/docker/dockerfiles/debian-s390x-cross.docker |   2 +-
tests/docker/dockerfiles/debian-sh4-cross.docker   |   2 +-
.../docker/dockerfiles/debian-sparc64-cross.docker |   2 +-
.../docker/dockerfiles/debian-tricore-cross.docker |   2 +-
tests/docker/dockerfiles/debian-win32-cross.docker |   2 +-
tests/docker/dockerfiles/debian-win64-cross.docker |   2 +-
tests/docker/dockerfiles/debian9-mxe.docker        |   2 +-
tests/docker/dockerfiles/fedora.docker             |   7 +
tests/docker/dockerfiles/ubuntu2004.docker         |  10 +-
tests/tcg/Makefile.qemu                            |   4 +-
tests/tcg/configure.sh                             |  19 +-
tests/vm/Makefile.include                          |  22 ++
tests/vm/aarch64vm.py                              | 106 +++++++
tests/vm/basevm.py                                 | 344 +++++++++++++++------
tests/vm/centos-8-aarch64.ks                       |  51 +++
tests/vm/centos.aarch64                            | 227 ++++++++++++++
tests/vm/conf_example_aarch64.yml                  |  51 +++
tests/vm/conf_example_x86.yml                      |  50 +++
tests/vm/fedora                                    |  17 +-
tests/vm/freebsd                                   |  16 +-
tests/vm/netbsd                                    |  19 +-
tests/vm/openbsd                                   |  17 +-
tests/vm/ubuntu.aarch64                            |  68 ++++
tests/vm/ubuntu.i386                               |  46 +--
tests/vm/ubuntuvm.py                               |  60 ++++
65 files changed, 1839 insertions(+), 383 deletions(-)
create mode 100644 .gitlab-ci.d/containers.yml
create mode 100644 python/qemu/console_socket.py
create mode 100644 tests/docker/dockerfiles/debian-all-test-cross.docker
create mode 100644 tests/vm/aarch64vm.py
create mode 100644 tests/vm/centos-8-aarch64.ks
create mode 100755 tests/vm/centos.aarch64
create mode 100644 tests/vm/conf_example_aarch64.yml
create mode 100644 tests/vm/conf_example_x86.yml
create mode 100755 tests/vm/ubuntu.aarch64
create mode 100644 tests/vm/ubuntuvm.py
[PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Alex Bennée 3 years, 9 months ago
There will be some docker failures until the official repository has
seeded but local builds should continue to work.

----

The following changes since commit eb6490f544388dd24c0d054a96dd304bc7284450:

  Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200703' into staging (2020-07-04 16:08:41 +0100)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-testing-and-misc-070720-1

for you to fetch changes up to 6a726e8ca0286e3ed69945abd447099f6f6a903c:

  tests/qht-bench: Adjust threshold computation (2020-07-07 07:57:41 +0100)

----------------------------------------------------------------
Testing and build updates:

  - tests/vm support for aarch64 VMs
  - tests/tcg better cross-compiler detection
  - update docker tooling to support registries
  - gitlab build docker images and store in registry
  - gitlab use docker images for builds
  - a number of skipIf updates to support move
  - linux-user MAP_FIXED_NOREPLACE fix
  - qht-bench compiler tweaks
  - configure fix for secret keyring
  - tsan fiber annotation clean-up

----------------------------------------------------------------
Alex Bennée (23):
      tests/vm: switch from optsparse to argparse
      tests/vm: allow us to take advantage of MTTCG
      tests/docker: check for an parameters not empty string
      tests/docker: change tag naming scheme of our images
      .gitignore: un-ignore .gitlab-ci.d
      gitlab: build containers with buildkit and metadata
      tests/docker: add --registry support to tooling
      tests/docker: add packages needed for check-acceptance
      tests/acceptance: skip s390x_ccw_vrtio_tcg on GitLab
      tests/acceptance: fix dtb path for machine_rx_gdbsim
      tests/acceptance: skip multicore mips_malta tests on GitLab
      tests/acceptance: skip LinuxInitrd 2gib with v4.16 on GitLab
      gitlab: add acceptance testing to system builds
      tests/tcg: add more default compilers to configure.sh
      tests/docker: add a linux-user testing focused image
      linux-user/elfload: use MAP_FIXED_NOREPLACE in pgb_reserved_va
      gitlab: enable check-tcg for linux-user tests
      gitlab: add avocado asset caching
      gitlab: split build-disabled into two phases
      gitlab: limit re-builds of the containers
      containers.yml: build with docker.py tooling
      testing: add check-build target
      shippable: pull images from registry instead of building

Daniel P. Berrangé (3):
      gitlab: introduce explicit "container" and "build" stages
      gitlab: build all container images during CI
      gitlab: convert jobs to use custom built containers

David Edmondson (1):
      crypto/linux_keyring: fix 'secret_keyring' configure test

Richard Henderson (2):
      tests/qht-bench: Adjust testing rate by -1
      tests/qht-bench: Adjust threshold computation

Robert Foley (10):
      util/coroutine: Cleanup start_switch_fiber_ for TSAN.
      tests/vm: pass args through to BaseVM's __init__
      tests/vm: Add configuration to basevm.py
      tests/vm: Added configuration file support
      tests/vm: Add common Ubuntu python module
      tests/vm: Added a new script for ubuntu.aarch64.
      tests/vm: Added a new script for centos.aarch64.
      tests/vm: change scripts to use self._config
      python/qemu: Add ConsoleSocket for optional use in QEMUMachine
      tests/vm: Add workaround to consume console

Thomas Huth (2):
      gitlab-ci: Fix the change rules after moving the YML files
      travis.yml: Test also the other targets on s390x

 configure                                          |  31 +-
 linux-user/elfload.c                               |  10 +-
 tests/qht-bench.c                                  |  40 ++-
 util/coroutine-ucontext.c                          |  52 ++--
 .gitignore                                         |   1 +
 .gitlab-ci.d/containers.yml                        | 263 ++++++++++++++++
 .gitlab-ci.d/edk2.yml                              |   5 +-
 .gitlab-ci.d/opensbi.yml                           |   5 +-
 .gitlab-ci.yml                                     | 281 ++++++++++-------
 .shippable.yml                                     |   8 +-
 .travis.yml                                        |  62 ++--
 python/qemu/console_socket.py                      | 110 +++++++
 python/qemu/machine.py                             |  23 +-
 tests/Makefile.include                             |  19 +-
 tests/acceptance/boot_linux.py                     |   2 +
 tests/acceptance/linux_initrd.py                   |   3 +
 tests/acceptance/machine_mips_malta.py             |   3 +
 tests/acceptance/machine_rx_gdbsim.py              |   2 +-
 tests/acceptance/replay_kernel.py                  |   2 +-
 tests/docker/Makefile.include                      |  17 +-
 tests/docker/common.rc                             |   2 +-
 tests/docker/docker.py                             |  46 ++-
 .../dockerfiles/debian-all-test-cross.docker       |  53 ++++
 tests/docker/dockerfiles/debian-alpha-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-amd64-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-amd64.docker       |   2 +-
 tests/docker/dockerfiles/debian-arm64-cross.docker |   2 +-
 .../dockerfiles/debian-arm64-test-cross.docker     |   2 +-
 tests/docker/dockerfiles/debian-armel-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-armhf-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-hppa-cross.docker  |   2 +-
 tests/docker/dockerfiles/debian-m68k-cross.docker  |   2 +-
 tests/docker/dockerfiles/debian-mips-cross.docker  |   2 +-
 .../docker/dockerfiles/debian-mips64-cross.docker  |   2 +-
 .../dockerfiles/debian-mips64el-cross.docker       |   2 +-
 .../docker/dockerfiles/debian-mipsel-cross.docker  |   2 +-
 .../docker/dockerfiles/debian-powerpc-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-ppc64-cross.docker |   2 +-
 .../docker/dockerfiles/debian-ppc64el-cross.docker |   2 +-
 .../docker/dockerfiles/debian-riscv64-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-s390x-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-sh4-cross.docker   |   2 +-
 .../docker/dockerfiles/debian-sparc64-cross.docker |   2 +-
 .../docker/dockerfiles/debian-tricore-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-win32-cross.docker |   2 +-
 tests/docker/dockerfiles/debian-win64-cross.docker |   2 +-
 tests/docker/dockerfiles/debian9-mxe.docker        |   2 +-
 tests/docker/dockerfiles/fedora.docker             |   7 +
 tests/docker/dockerfiles/ubuntu2004.docker         |  10 +-
 tests/tcg/Makefile.qemu                            |   4 +-
 tests/tcg/configure.sh                             |  19 +-
 tests/vm/Makefile.include                          |  22 ++
 tests/vm/aarch64vm.py                              | 106 +++++++
 tests/vm/basevm.py                                 | 344 +++++++++++++++------
 tests/vm/centos-8-aarch64.ks                       |  51 +++
 tests/vm/centos.aarch64                            | 227 ++++++++++++++
 tests/vm/conf_example_aarch64.yml                  |  51 +++
 tests/vm/conf_example_x86.yml                      |  50 +++
 tests/vm/fedora                                    |  17 +-
 tests/vm/freebsd                                   |  16 +-
 tests/vm/netbsd                                    |  19 +-
 tests/vm/openbsd                                   |  17 +-
 tests/vm/ubuntu.aarch64                            |  68 ++++
 tests/vm/ubuntu.i386                               |  46 +--
 tests/vm/ubuntuvm.py                               |  60 ++++
 65 files changed, 1839 insertions(+), 383 deletions(-)
 create mode 100644 .gitlab-ci.d/containers.yml
 create mode 100644 python/qemu/console_socket.py
 create mode 100644 tests/docker/dockerfiles/debian-all-test-cross.docker
 create mode 100644 tests/vm/aarch64vm.py
 create mode 100644 tests/vm/centos-8-aarch64.ks
 create mode 100755 tests/vm/centos.aarch64
 create mode 100644 tests/vm/conf_example_aarch64.yml
 create mode 100644 tests/vm/conf_example_x86.yml
 create mode 100755 tests/vm/ubuntu.aarch64
 create mode 100644 tests/vm/ubuntuvm.py

-- 
2.20.1


Re: [PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Alex Bennée 3 years, 9 months ago
Alex Bennée <alex.bennee@linaro.org> writes:

> There will be some docker failures until the official repository has
> seeded but local builds should continue to work.

You can force the docker builds to use my registry for example by setting:

  make docker-test-build REGISTRY=registry.gitlab.com/stsquad/qemu
>
> ----
>
> The following changes since commit eb6490f544388dd24c0d054a96dd304bc7284450:
>
>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200703' into staging (2020-07-04 16:08:41 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-testing-and-misc-070720-1
>
> for you to fetch changes up to 6a726e8ca0286e3ed69945abd447099f6f6a903c:
>
>   tests/qht-bench: Adjust threshold computation (2020-07-07 07:57:41 +0100)
>
> ----------------------------------------------------------------
> Testing and build updates:
>
>   - tests/vm support for aarch64 VMs
>   - tests/tcg better cross-compiler detection
>   - update docker tooling to support registries
>   - gitlab build docker images and store in registry
>   - gitlab use docker images for builds
>   - a number of skipIf updates to support move
>   - linux-user MAP_FIXED_NOREPLACE fix
>   - qht-bench compiler tweaks
>   - configure fix for secret keyring
>   - tsan fiber annotation clean-up
>
> ----------------------------------------------------------------
> Alex Bennée (23):
>       tests/vm: switch from optsparse to argparse
>       tests/vm: allow us to take advantage of MTTCG
>       tests/docker: check for an parameters not empty string
>       tests/docker: change tag naming scheme of our images
>       .gitignore: un-ignore .gitlab-ci.d
>       gitlab: build containers with buildkit and metadata
>       tests/docker: add --registry support to tooling
>       tests/docker: add packages needed for check-acceptance
>       tests/acceptance: skip s390x_ccw_vrtio_tcg on GitLab
>       tests/acceptance: fix dtb path for machine_rx_gdbsim
>       tests/acceptance: skip multicore mips_malta tests on GitLab
>       tests/acceptance: skip LinuxInitrd 2gib with v4.16 on GitLab
>       gitlab: add acceptance testing to system builds
>       tests/tcg: add more default compilers to configure.sh
>       tests/docker: add a linux-user testing focused image
>       linux-user/elfload: use MAP_FIXED_NOREPLACE in pgb_reserved_va
>       gitlab: enable check-tcg for linux-user tests
>       gitlab: add avocado asset caching
>       gitlab: split build-disabled into two phases
>       gitlab: limit re-builds of the containers
>       containers.yml: build with docker.py tooling
>       testing: add check-build target
>       shippable: pull images from registry instead of building
>
> Daniel P. Berrangé (3):
>       gitlab: introduce explicit "container" and "build" stages
>       gitlab: build all container images during CI
>       gitlab: convert jobs to use custom built containers
>
> David Edmondson (1):
>       crypto/linux_keyring: fix 'secret_keyring' configure test
>
> Richard Henderson (2):
>       tests/qht-bench: Adjust testing rate by -1
>       tests/qht-bench: Adjust threshold computation
>
> Robert Foley (10):
>       util/coroutine: Cleanup start_switch_fiber_ for TSAN.
>       tests/vm: pass args through to BaseVM's __init__
>       tests/vm: Add configuration to basevm.py
>       tests/vm: Added configuration file support
>       tests/vm: Add common Ubuntu python module
>       tests/vm: Added a new script for ubuntu.aarch64.
>       tests/vm: Added a new script for centos.aarch64.
>       tests/vm: change scripts to use self._config
>       python/qemu: Add ConsoleSocket for optional use in QEMUMachine
>       tests/vm: Add workaround to consume console
>
> Thomas Huth (2):
>       gitlab-ci: Fix the change rules after moving the YML files
>       travis.yml: Test also the other targets on s390x
>
>  configure                                          |  31 +-
>  linux-user/elfload.c                               |  10 +-
>  tests/qht-bench.c                                  |  40 ++-
>  util/coroutine-ucontext.c                          |  52 ++--
>  .gitignore                                         |   1 +
>  .gitlab-ci.d/containers.yml                        | 263 ++++++++++++++++
>  .gitlab-ci.d/edk2.yml                              |   5 +-
>  .gitlab-ci.d/opensbi.yml                           |   5 +-
>  .gitlab-ci.yml                                     | 281 ++++++++++-------
>  .shippable.yml                                     |   8 +-
>  .travis.yml                                        |  62 ++--
>  python/qemu/console_socket.py                      | 110 +++++++
>  python/qemu/machine.py                             |  23 +-
>  tests/Makefile.include                             |  19 +-
>  tests/acceptance/boot_linux.py                     |   2 +
>  tests/acceptance/linux_initrd.py                   |   3 +
>  tests/acceptance/machine_mips_malta.py             |   3 +
>  tests/acceptance/machine_rx_gdbsim.py              |   2 +-
>  tests/acceptance/replay_kernel.py                  |   2 +-
>  tests/docker/Makefile.include                      |  17 +-
>  tests/docker/common.rc                             |   2 +-
>  tests/docker/docker.py                             |  46 ++-
>  .../dockerfiles/debian-all-test-cross.docker       |  53 ++++
>  tests/docker/dockerfiles/debian-alpha-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-amd64-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-amd64.docker       |   2 +-
>  tests/docker/dockerfiles/debian-arm64-cross.docker |   2 +-
>  .../dockerfiles/debian-arm64-test-cross.docker     |   2 +-
>  tests/docker/dockerfiles/debian-armel-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-armhf-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-hppa-cross.docker  |   2 +-
>  tests/docker/dockerfiles/debian-m68k-cross.docker  |   2 +-
>  tests/docker/dockerfiles/debian-mips-cross.docker  |   2 +-
>  .../docker/dockerfiles/debian-mips64-cross.docker  |   2 +-
>  .../dockerfiles/debian-mips64el-cross.docker       |   2 +-
>  .../docker/dockerfiles/debian-mipsel-cross.docker  |   2 +-
>  .../docker/dockerfiles/debian-powerpc-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-ppc64-cross.docker |   2 +-
>  .../docker/dockerfiles/debian-ppc64el-cross.docker |   2 +-
>  .../docker/dockerfiles/debian-riscv64-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-s390x-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-sh4-cross.docker   |   2 +-
>  .../docker/dockerfiles/debian-sparc64-cross.docker |   2 +-
>  .../docker/dockerfiles/debian-tricore-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-win32-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian-win64-cross.docker |   2 +-
>  tests/docker/dockerfiles/debian9-mxe.docker        |   2 +-
>  tests/docker/dockerfiles/fedora.docker             |   7 +
>  tests/docker/dockerfiles/ubuntu2004.docker         |  10 +-
>  tests/tcg/Makefile.qemu                            |   4 +-
>  tests/tcg/configure.sh                             |  19 +-
>  tests/vm/Makefile.include                          |  22 ++
>  tests/vm/aarch64vm.py                              | 106 +++++++
>  tests/vm/basevm.py                                 | 344 +++++++++++++++------
>  tests/vm/centos-8-aarch64.ks                       |  51 +++
>  tests/vm/centos.aarch64                            | 227 ++++++++++++++
>  tests/vm/conf_example_aarch64.yml                  |  51 +++
>  tests/vm/conf_example_x86.yml                      |  50 +++
>  tests/vm/fedora                                    |  17 +-
>  tests/vm/freebsd                                   |  16 +-
>  tests/vm/netbsd                                    |  19 +-
>  tests/vm/openbsd                                   |  17 +-
>  tests/vm/ubuntu.aarch64                            |  68 ++++
>  tests/vm/ubuntu.i386                               |  46 +--
>  tests/vm/ubuntuvm.py                               |  60 ++++
>  65 files changed, 1839 insertions(+), 383 deletions(-)
>  create mode 100644 .gitlab-ci.d/containers.yml
>  create mode 100644 python/qemu/console_socket.py
>  create mode 100644 tests/docker/dockerfiles/debian-all-test-cross.docker
>  create mode 100644 tests/vm/aarch64vm.py
>  create mode 100644 tests/vm/centos-8-aarch64.ks
>  create mode 100755 tests/vm/centos.aarch64
>  create mode 100644 tests/vm/conf_example_aarch64.yml
>  create mode 100644 tests/vm/conf_example_x86.yml
>  create mode 100755 tests/vm/ubuntu.aarch64
>  create mode 100644 tests/vm/ubuntuvm.py


-- 
Alex Bennée

Re: [PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Peter Maydell 3 years, 9 months ago
On Tue, 7 Jul 2020 at 08:09, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> There will be some docker failures until the official repository has
> seeded but local builds should continue to work.
>
> ----
>
> The following changes since commit eb6490f544388dd24c0d054a96dd304bc7284450:
>
>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200703' into staging (2020-07-04 16:08:41 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-testing-and-misc-070720-1
>
> for you to fetch changes up to 6a726e8ca0286e3ed69945abd447099f6f6a903c:
>
>   tests/qht-bench: Adjust threshold computation (2020-07-07 07:57:41 +0100)
>
> ----------------------------------------------------------------
> Testing and build updates:
>
>   - tests/vm support for aarch64 VMs
>   - tests/tcg better cross-compiler detection
>   - update docker tooling to support registries
>   - gitlab build docker images and store in registry
>   - gitlab use docker images for builds
>   - a number of skipIf updates to support move
>   - linux-user MAP_FIXED_NOREPLACE fix
>   - qht-bench compiler tweaks
>   - configure fix for secret keyring
>   - tsan fiber annotation clean-up

freebsd failed:

perl: warning: Please check that your locale settings:
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
con recv: Loading /boot/defaults/loader.conf
con recv: Loading /boot/device.hints
con recv: Loading /boot/loader.conf
con recv: Loading /boot/loader.conf.local
con recv: \/  ```                        ` s` `.....---.......--.```
-/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/
            -/`   -o/  .-                  ::/sy+:.  /
    `--  / `:                          :` `:
:`  /                          /  .-                        -.   --
                  -.    `:`                  `:`      .--
`--.         .---.....----.  ______               ____   _____ _____
|  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_)
| (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |
 __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |
 | |_|   |_|  \___|\___||____/|_____/|_____/
..........................................................................................................................................................................................................................................................................................................................................Welcome
to FreeBSD1. Boot Multi user [Enter]2. Boot Single user3. Escape to
loader prompt4. RebootOptions:/\/\5. Kernel: default/kernel (1 of 1)6.
Boot OptionsAutoboot
con send: 3
con recv:  in 10 seconds, hit [Enter] to boot or any other key to stop
con recv:
con recv: Exiting menu!
con recv: Type '?' for a list of commands, 'help' for more detailed help.
con recv: OK
con send: set console=comconsole<enter>
console: *** read timeout ***
console: waiting for: 'OK'
console: line buffer:

con recv:  set console=comconso

Failed to prepare guest environment
Traceback (most recent call last):
  File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line 628, in main
    return vm.build_image(args.image)
  File "/home/peter.maydell/qemu-freebsd/tests/vm/freebsd", line 163,
in build_image
    self.console_boot_serial()
  File "/home/peter.maydell/qemu-freebsd/tests/vm/freebsd", line 76,
in console_boot_serial
    self.console_wait_send("OK", "boot\n")
  File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line
400, in console_wait_send
    self.console_wait(wait)
  File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line
340, in console_wait
    chars = vm.console_socket.recv(1)
  File "/home/peter.maydell/qemu-freebsd/tests/vm/../../python/qemu/console_socket.py",
line 96, in recv
    raise socket.timeout
socket.timeout


NetBSD failed:
con recv: postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
con recv: Starting inetd.
con recv: Starting cron.
con recv: Thu Jul  9 10:40:07 UTC 2020
con recv: NetBSD/amd64 (localhost) (constty)
con recv: login:
con send: qemu<enter>
con recv:  Jul  9 10:40:09 localhost getty[756]: /dev/ttyE2: Device
not configured
con recv: Jul  9 10:40:09 localhost getty[703]: /dev/ttyE3: Device not
configured
con recv: Jul  9 10:40:09 localhost getty[753]: /dev/ttyE1: Device not
configured
con recv: qemu
con recv: Password:
con send: qemupass<enter>
con recv: Login incorrect or refused on this terminal.
console: *** read timeout ***
console: waiting for: 'localhost$'
console: line buffer:

con recv: login:

Failed to prepare guest environment
Traceback (most recent call last):
  File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 628, in main
    return vm.build_image(args.image)
  File "/home/peter.maydell/qemu-netbsd/tests/vm/netbsd", line 174, in
build_image
    self._config["guest_pass"])
  File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 408,
in console_ssh_init
    self.console_wait_send(prompt,      "mkdir .ssh\n")
  File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 400,
in console_wait_send
    self.console_wait(wait)
  File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 340,
in console_wait
    chars = vm.console_socket.recv(1)
  File "/home/peter.maydell/qemu-netbsd/tests/vm/../../python/qemu/console_socket.py",
line 96, in recv
    raise socket.timeout
socket.timeout

arm-linux-static check-tcg failed:
  TEST    pauth-4 on aarch64
  TEST    semihosting on aarch64
  SKIPPED semiconsole on aarch64 because MANUAL ONLY
  TEST    basic gdbstub support
/tmp/tmp6ftb0v61qemu-gdbstub/gdbstub.socket: No such device or address.
SKIPPING (not connected)
  BUILD   TCG tests for aarch64_be-linux-user
  BUILD   aarch64_be-linux-user guest-tests SKIPPED
  RUN     TCG tests for aarch64_be-linux-user
  RUN     tests for aarch64_be-linux-user SKIPPED
make: Entering directory
'/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
  BUILD   debian10
Error response from daemon: manifest for
registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest not found
make: Leaving directory
'/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
make: Entering directory
'/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
  BUILD   debian-alpha-cross
Error response from daemon: manifest for
registry.gitlab.com/qemu-project/qemu/qemu/debian-alpha-cross:latest
not found
registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest not found
Traceback (most recent call last):
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 701, in <module>
    sys.exit(main())
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 697, in main
    return args.cmdobj.run(args, argv)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 494, in run
    extra_files_cksum=cksum)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 347, in build_image
    quiet=quiet)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 244, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'build', '-t',
'qemu/debian-alpha-cross', '-f',
'/tmp/docker_buildsstz1jcy/tmp_7c70xjh.docker', '--build-arg',
'BUILDKIT_INLINE_CACHE=1', '--cache-from',
'registry.gitlab.com/qemu-project/qemu/qemu/debian-alpha-cross',
'/tmp/docker_buildsstz1jcy']' returned non-zero exit status 1.
/home/petmay01/linaro/qemu-for-merges/tests/docker/Makefile.include:58:
recipe for target 'docker-image-debian-alpha-cross' failed
make: *** [docker-image-debian-alpha-cross] Error 1


Also a compile failure on s390x, but since this isn't related
to changes you made afaict I wonder if it's the result of
a change in the build environment:
/home/ubuntu/qemu/block/ssh.c: In function ‘check_host_key_knownhosts’:
/home/ubuntu/qemu/block/ssh.c:281:28: error: storage size of ‘state’ isn’t known
     enum ssh_known_hosts_e state;
                            ^~~~~
/home/ubuntu/qemu/block/ssh.c:289:13: error: implicit declaration of
function ‘ssh_session_is_known_server’ [-Werror=implicit-funct
ion-declaration]
     state = ssh_session_is_known_server(s->session);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[and other errors]


thanks
-- PMM

Re: [PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Philippe Mathieu-Daudé 3 years, 9 months ago
On 7/9/20 1:31 PM, Peter Maydell wrote:
> On Tue, 7 Jul 2020 at 08:09, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> There will be some docker failures until the official repository has
>> seeded but local builds should continue to work.
>>
>> ----
>>
>> The following changes since commit eb6490f544388dd24c0d054a96dd304bc7284450:
>>
>>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200703' into staging (2020-07-04 16:08:41 +0100)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/stsquad/qemu.git tags/pull-testing-and-misc-070720-1
>>
>> for you to fetch changes up to 6a726e8ca0286e3ed69945abd447099f6f6a903c:
>>
>>   tests/qht-bench: Adjust threshold computation (2020-07-07 07:57:41 +0100)
>>
>> ----------------------------------------------------------------
>> Testing and build updates:
>>
>>   - tests/vm support for aarch64 VMs
>>   - tests/tcg better cross-compiler detection
>>   - update docker tooling to support registries
>>   - gitlab build docker images and store in registry
>>   - gitlab use docker images for builds
>>   - a number of skipIf updates to support move
>>   - linux-user MAP_FIXED_NOREPLACE fix
>>   - qht-bench compiler tweaks
>>   - configure fix for secret keyring
>>   - tsan fiber annotation clean-up
[...]
> Also a compile failure on s390x, but since this isn't related
> to changes you made afaict I wonder if it's the result of
> a change in the build environment:
> /home/ubuntu/qemu/block/ssh.c: In function ‘check_host_key_knownhosts’:
> /home/ubuntu/qemu/block/ssh.c:281:28: error: storage size of ‘state’ isn’t known
>      enum ssh_known_hosts_e state;
>                             ^~~~~
> /home/ubuntu/qemu/block/ssh.c:289:13: error: implicit declaration of
> function ‘ssh_session_is_known_server’ [-Werror=implicit-funct
> ion-declaration]
>      state = ssh_session_is_known_server(s->session);
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> [and other errors]

libssh is bugged on Ubuntu 18.04.
https://bugs.launchpad.net/qemu/+bug/1838763

We need to use 'configure --disable-libssh' there.


Re: [PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Peter Maydell 3 years, 9 months ago
On Thu, 9 Jul 2020 at 13:24, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> libssh is bugged on Ubuntu 18.04.
> https://bugs.launchpad.net/qemu/+bug/1838763
>
> We need to use 'configure --disable-libssh' there.

Ah, thanks. I guess libssh recently got installed on that
box.

-- PMM

Re: [PULL 00/41] testing updates (vm, gitlab, misc build fixes)
Posted by Alex Bennée 3 years, 9 months ago
Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 7 Jul 2020 at 08:09, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> There will be some docker failures until the official repository has
>> seeded but local builds should continue to work.
>>
>> ----
>>
>> The following changes since commit eb6490f544388dd24c0d054a96dd304bc7284450:
>>
>>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200703' into staging (2020-07-04 16:08:41 +0100)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/stsquad/qemu.git tags/pull-testing-and-misc-070720-1
>>
>> for you to fetch changes up to 6a726e8ca0286e3ed69945abd447099f6f6a903c:
>>
>>   tests/qht-bench: Adjust threshold computation (2020-07-07 07:57:41 +0100)
>>
>> ----------------------------------------------------------------
>> Testing and build updates:
>>
>>   - tests/vm support for aarch64 VMs
>>   - tests/tcg better cross-compiler detection
>>   - update docker tooling to support registries
>>   - gitlab build docker images and store in registry
>>   - gitlab use docker images for builds
>>   - a number of skipIf updates to support move
>>   - linux-user MAP_FIXED_NOREPLACE fix
>>   - qht-bench compiler tweaks
>>   - configure fix for secret keyring
>>   - tsan fiber annotation clean-up
>
> freebsd failed:
>
<snip>
>
> con recv:  set console=comconso
>
> Failed to prepare guest environment
> Traceback (most recent call last):
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line 628, in main
>     return vm.build_image(args.image)
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/freebsd", line 163,
> in build_image
>     self.console_boot_serial()
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/freebsd", line 76,
> in console_boot_serial
>     self.console_wait_send("OK", "boot\n")
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line
> 400, in console_wait_send
>     self.console_wait(wait)
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/basevm.py", line
> 340, in console_wait
>     chars = vm.console_socket.recv(1)
>   File "/home/peter.maydell/qemu-freebsd/tests/vm/../../python/qemu/console_socket.py",
> line 96, in recv
>     raise socket.timeout
> socket.timeout

Hmm works for me, but I'm guessing you have V=1?

> NetBSD failed:
> con recv: postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
> con recv: Starting inetd.
> con recv: Starting cron.
> con recv: Thu Jul  9 10:40:07 UTC 2020
> con recv: NetBSD/amd64 (localhost) (constty)
> con recv: login:
> con send: qemu<enter>
> con recv:  Jul  9 10:40:09 localhost getty[756]: /dev/ttyE2: Device
> not configured
> con recv: Jul  9 10:40:09 localhost getty[703]: /dev/ttyE3: Device not
> configured
> con recv: Jul  9 10:40:09 localhost getty[753]: /dev/ttyE1: Device not
> configured
> con recv: qemu
> con recv: Password:
> con send: qemupass<enter>
> con recv: Login incorrect or refused on this terminal.
> console: *** read timeout ***
> console: waiting for: 'localhost$'
> console: line buffer:
>
> con recv: login:
>
> Failed to prepare guest environment
> Traceback (most recent call last):
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 628, in main
>     return vm.build_image(args.image)
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/netbsd", line 174, in
> build_image
>     self._config["guest_pass"])
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 408,
> in console_ssh_init
>     self.console_wait_send(prompt,      "mkdir .ssh\n")
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 400,
> in console_wait_send
>     self.console_wait(wait)
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 340,
> in console_wait
>     chars = vm.console_socket.recv(1)
>   File "/home/peter.maydell/qemu-netbsd/tests/vm/../../python/qemu/console_socket.py",
> line 96, in recv
>     raise socket.timeout
> socket.timeout

OK that I can replicate. So it looks like our console bypass has an
issue. I'll dig into it.

> arm-linux-static check-tcg failed:
>   TEST    pauth-4 on aarch64
>   TEST    semihosting on aarch64
>   SKIPPED semiconsole on aarch64 because MANUAL ONLY
>   TEST    basic gdbstub support
> /tmp/tmp6ftb0v61qemu-gdbstub/gdbstub.socket: No such device or address.
> SKIPPING (not connected)
>   BUILD   TCG tests for aarch64_be-linux-user
>   BUILD   aarch64_be-linux-user guest-tests SKIPPED
>   RUN     TCG tests for aarch64_be-linux-user
>   RUN     tests for aarch64_be-linux-user SKIPPED
> make: Entering directory
> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
>   BUILD   debian10
> Error response from daemon: manifest for
> registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest not found
> make: Leaving directory
> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
> make: Entering directory
> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
>   BUILD   debian-alpha-cross
> Error response from daemon: manifest for
> registry.gitlab.com/qemu-project/qemu/qemu/debian-alpha-cross:latest
> not found
> registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest not found
> Traceback (most recent call last):
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 701, in <module>
>     sys.exit(main())
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 697, in main
>     return args.cmdobj.run(args, argv)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 494, in run
>     extra_files_cksum=cksum)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 347, in build_image
>     quiet=quiet)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 244, in _do_check
>     return subprocess.check_call(self._command + cmd, **kwargs)
>   File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['docker', 'build', '-t',
> 'qemu/debian-alpha-cross', '-f',
> '/tmp/docker_buildsstz1jcy/tmp_7c70xjh.docker', '--build-arg',
> 'BUILDKIT_INLINE_CACHE=1', '--cache-from',
> 'registry.gitlab.com/qemu-project/qemu/qemu/debian-alpha-cross',
> '/tmp/docker_buildsstz1jcy']' returned non-zero exit status 1.
> /home/petmay01/linaro/qemu-for-merges/tests/docker/Makefile.include:58:
> recipe for target 'docker-image-debian-alpha-cross' failed
> make: *** [docker-image-debian-alpha-cross] Error 1

This is it tripping up on missing registry (as I switched the registry
from my previous patch posts to point to the "official" gitlab). You can
work around this for now by passing:

  make check-tcg REGISTRY=registry.gitlab.com/stsquad/qemu

I also just posted:

  Subject: [PATCH  v1 11/13] tests/docker: fall back more gracefully when pull fails
  Date: Thu,  9 Jul 2020 15:13:25 +0100
  Message-Id: <20200709141327.14631-12-alex.bennee@linaro.org>

Maybe I should just squash it into:

  tests/docker: add --registry support to tooling

?

> Also a compile failure on s390x, but since this isn't related
> to changes you made afaict I wonder if it's the result of
> a change in the build environment:
> /home/ubuntu/qemu/block/ssh.c: In function ‘check_host_key_knownhosts’:
> /home/ubuntu/qemu/block/ssh.c:281:28: error: storage size of ‘state’ isn’t known
>      enum ssh_known_hosts_e state;
>                             ^~~~~
> /home/ubuntu/qemu/block/ssh.c:289:13: error: implicit declaration of
> function ‘ssh_session_is_known_server’ [-Werror=implicit-funct
> ion-declaration]
>      state = ssh_session_is_known_server(s->session);
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> [and other errors]

As Philippe said I don't think this was me.

-- 
Alex Bennée

[PULL 01/41] crypto/linux_keyring: fix 'secret_keyring' configure test
Posted by Alex Bennée 3 years, 9 months ago
From: David Edmondson <david.edmondson@oracle.com>

The configure test for 'secret_keyring' incorrectly checked the
'have_keyring' variable.

Fixes: 54e7aac0562452e4fcab65ca5001d030eef2de15
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200618092636.71832-1-david.edmondson@oracle.com>
Message-Id: <20200701135652.1366-4-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 8a65240d4a8a..83e36c270cce 100755
--- a/configure
+++ b/configure
@@ -6461,7 +6461,7 @@ EOF
 fi
 if test "$secret_keyring" != "no"
 then
-    if test "$have_keyring" == "yes"
+    if test "$have_keyring" = "yes"
     then
 	secret_keyring=yes
     else
-- 
2.20.1


[PULL 02/41] util/coroutine: Cleanup start_switch_fiber_ for TSAN.
Posted by Alex Bennée 3 years, 9 months ago
From: Robert Foley <robert.foley@linaro.org>

This is a cleanup patch to follow-up the patch which introduced TSAN.
This patch makes separate start_switch_fiber_ functions for TSAN and ASAN.

This does two things:
1. Unrelated ASAN and TSAN code is separate and each function only
   has arguments that are actually needed.
2. The co->tsan_caller_fiber and co->tsan_co_fiber fields are only
   access from within #ifdef CONFIG_TSAN.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200626170001.27017-1-robert.foley@linaro.org>
Message-Id: <20200701135652.1366-5-alex.bennee@linaro.org>

diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c
index f0b66320e102..fff20aad80a4 100644
--- a/util/coroutine-ucontext.c
+++ b/util/coroutine-ucontext.c
@@ -52,8 +52,10 @@ typedef struct {
 #endif
     sigjmp_buf env;
 
+#ifdef CONFIG_TSAN
     void *tsan_co_fiber;
     void *tsan_caller_fiber;
+#endif
 
 #ifdef CONFIG_VALGRIND_H
     unsigned int valgrind_stack_id;
@@ -77,7 +79,10 @@ union cc_arg {
     int i[2];
 };
 
-/* QEMU_ALWAYS_INLINE only does so if __OPTIMIZE__, so we cannot use it. */
+/*
+ * QEMU_ALWAYS_INLINE only does so if __OPTIMIZE__, so we cannot use it.
+ * always_inline is required to avoid TSan runtime fatal errors.
+ */
 static inline __attribute__((always_inline))
 void on_new_fiber(CoroutineUContext *co)
 {
@@ -87,6 +92,7 @@ void on_new_fiber(CoroutineUContext *co)
 #endif
 }
 
+/* always_inline is required to avoid TSan runtime fatal errors. */
 static inline __attribute__((always_inline))
 void finish_switch_fiber(void *fake_stack_save)
 {
@@ -109,18 +115,29 @@ void finish_switch_fiber(void *fake_stack_save)
 #endif
 }
 
-static inline __attribute__((always_inline)) void start_switch_fiber(
-    CoroutineAction action, void **fake_stack_save,
-    const void *bottom, size_t size, void *new_fiber)
+/* always_inline is required to avoid TSan runtime fatal errors. */
+static inline __attribute__((always_inline))
+void start_switch_fiber_asan(CoroutineAction action, void **fake_stack_save,
+                             const void *bottom, size_t size)
 {
 #ifdef CONFIG_ASAN
     __sanitizer_start_switch_fiber(
             action == COROUTINE_TERMINATE ? NULL : fake_stack_save,
             bottom, size);
 #endif
+}
+
+/* always_inline is required to avoid TSan runtime fatal errors. */
+static inline __attribute__((always_inline))
+void start_switch_fiber_tsan(void **fake_stack_save,
+                             CoroutineUContext *co,
+                             bool caller)
+{
 #ifdef CONFIG_TSAN
-    void *curr_fiber =
-        __tsan_get_current_fiber();
+    void *new_fiber = caller ?
+                      co->tsan_caller_fiber :
+                      co->tsan_co_fiber;
+    void *curr_fiber = __tsan_get_current_fiber();
     __tsan_acquire(curr_fiber);
 
     *fake_stack_save = curr_fiber;
@@ -144,12 +161,9 @@ static void coroutine_trampoline(int i0, int i1)
 
     /* Initialize longjmp environment and switch back the caller */
     if (!sigsetjmp(self->env, 0)) {
-        start_switch_fiber(
-            COROUTINE_YIELD,
-            &fake_stack_save,
-            leader.stack,
-            leader.stack_size,
-            self->tsan_caller_fiber);
+        start_switch_fiber_asan(COROUTINE_YIELD, &fake_stack_save, leader.stack,
+                                leader.stack_size);
+        start_switch_fiber_tsan(&fake_stack_save, self, true); /* true=caller */
         siglongjmp(*(sigjmp_buf *)co->entry_arg, 1);
     }
 
@@ -208,10 +222,10 @@ Coroutine *qemu_coroutine_new(void)
 
     /* swapcontext() in, siglongjmp() back out */
     if (!sigsetjmp(old_env, 0)) {
-        start_switch_fiber(
-            COROUTINE_YIELD,
-            &fake_stack_save,
-            co->stack, co->stack_size, co->tsan_co_fiber);
+        start_switch_fiber_asan(COROUTINE_YIELD, &fake_stack_save, co->stack,
+                                co->stack_size);
+        start_switch_fiber_tsan(&fake_stack_save,
+                                co, false); /* false=not caller */
 
 #ifdef CONFIG_SAFESTACK
         /*
@@ -287,8 +301,10 @@ qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
 
     ret = sigsetjmp(from->env, 0);
     if (ret == 0) {
-        start_switch_fiber(action, &fake_stack_save,
-                           to->stack, to->stack_size, to->tsan_co_fiber);
+        start_switch_fiber_asan(action, &fake_stack_save, to->stack,
+                                to->stack_size);
+        start_switch_fiber_tsan(&fake_stack_save,
+                                to, false); /* false=not caller */
         siglongjmp(to->env, action);
     }
 
-- 
2.20.1


[PULL 03/41] tests/vm: pass args through to BaseVM's __init__
Posted by Alex Bennée 3 years, 9 months ago
From: Robert Foley <robert.foley@linaro.org>

Adding the args parameter to BaseVM's __init__.
We will shortly need to pass more parameters to the class
so let's just pass args rather than growing the parameter list.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200601211421.1277-2-robert.foley@linaro.org>
Message-Id: <20200701135652.1366-6-alex.bennee@linaro.org>

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index a80b616a08d3..5a58e6c39300 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -61,11 +61,10 @@ class BaseVM(object):
     # 4 is arbitrary, but greater than 2,
     # since we found we need to wait more than twice as long.
     tcg_ssh_timeout_multiplier = 4
-    def __init__(self, debug=False, vcpus=None, genisoimage=None,
-                 build_path=None):
+    def __init__(self, args):
         self._guest = None
-        self._genisoimage = genisoimage
-        self._build_path = build_path
+        self._genisoimage = args.genisoimage
+        self._build_path = args.build_path
         self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
                                                          suffix=".tmp",
                                                          dir="."))
@@ -78,7 +77,7 @@ class BaseVM(object):
         self._ssh_pub_key_file = os.path.join(self._tmpdir, "id_rsa.pub")
         open(self._ssh_pub_key_file, "w").write(SSH_PUB_KEY)
 
-        self.debug = debug
+        self.debug = args.debug
         self._stderr = sys.stderr
         self._devnull = open(os.devnull, "w")
         if self.debug:
@@ -92,8 +91,8 @@ class BaseVM(object):
                        (",ipv6=no" if not self.ipv6 else ""),
             "-device", "virtio-net-pci,netdev=vnet",
             "-vnc", "127.0.0.1:0,to=20"]
-        if vcpus and vcpus > 1:
-            self._args += ["-smp", "%d" % vcpus]
+        if args.jobs and args.jobs > 1:
+            self._args += ["-smp", "%d" % args.jobs]
         if kvm_available(self.arch):
             self._args += ["-enable-kvm"]
         else:
@@ -456,8 +455,7 @@ def main(vmcls):
             return 1
         logging.basicConfig(level=(logging.DEBUG if args.debug
                                    else logging.WARN))
-        vm = vmcls(debug=args.debug, vcpus=args.jobs,
-                   genisoimage=args.genisoimage, build_path=args.build_path)
+        vm = vmcls(args)
         if args.build_image:
             if os.path.exists(args.image) and not args.force:
                 sys.stderr.writelines(["Image file exists: %s\n" % args.image,
-- 
2.20.1


[PULL 04/41] tests/vm: Add configuration to basevm.py
Posted by Alex Bennée 3 years, 9 months ago
From: Robert Foley <robert.foley@linaro.org>

Added use of a configuration to tests/vm/basevm.py.
The configuration provides parameters used to configure a VM.
This allows for providing alternate configurations to the VM being
created/launched. cpu, machine, memory, and NUMA configuration are all
examples of configuration which we might want to vary on the VM being created
or launched.
This will for example allow for creating an aarch64 vm.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200601211421.1277-3-robert.foley@linaro.org>
Message-Id: <20200701135652.1366-7-alex.bennee@linaro.org>

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 5a58e6c39300..cfe20c58f7ef 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -29,16 +29,41 @@ import tempfile
 import shutil
 import multiprocessing
 import traceback
-
-SSH_KEY = open(os.path.join(os.path.dirname(__file__),
-               "..", "keys", "id_rsa")).read()
-SSH_PUB_KEY = open(os.path.join(os.path.dirname(__file__),
-                   "..", "keys", "id_rsa.pub")).read()
-
+import shlex
+
+SSH_KEY_FILE = os.path.join(os.path.dirname(__file__),
+               "..", "keys", "id_rsa")
+SSH_PUB_KEY_FILE = os.path.join(os.path.dirname(__file__),
+                   "..", "keys", "id_rsa.pub")
+
+# This is the standard configuration.
+# Any or all of these can be overridden by
+# passing in a config argument to the VM constructor.
+DEFAULT_CONFIG = {
+    'cpu'             : "max",
+    'machine'         : 'pc',
+    'guest_user'      : "qemu",
+    'guest_pass'      : "qemupass",
+    'root_pass'       : "qemupass",
+    'ssh_key_file'    : SSH_KEY_FILE,
+    'ssh_pub_key_file': SSH_PUB_KEY_FILE,
+    'memory'          : "4G",
+    'extra_args'      : [],
+    'qemu_args'       : "",
+    'dns'             : "",
+    'ssh_port'        : 0,
+    'install_cmds'    : "",
+    'boot_dev_type'   : "block",
+    'ssh_timeout'     : 1,
+}
+BOOT_DEVICE = {
+    'block' :  "-drive file={},if=none,id=drive0,cache=writeback "\
+               "-device virtio-blk,drive=drive0,bootindex=0",
+    'scsi'  :  "-device virtio-scsi-device,id=scsi "\
+               "-drive file={},format=raw,if=none,id=hd0 "\
+               "-device scsi-hd,drive=hd0,bootindex=0",
+}
 class BaseVM(object):
-    GUEST_USER = "qemu"
-    GUEST_PASS = "qemupass"
-    ROOT_PASS = "qemupass"
 
     envvars = [
         "https_proxy",
@@ -57,25 +82,38 @@ class BaseVM(object):
     poweroff = "poweroff"
     # enable IPv6 networking
     ipv6 = True
+    # This is the timeout on the wait for console bytes.
+    socket_timeout = 120
     # Scale up some timeouts under TCG.
     # 4 is arbitrary, but greater than 2,
     # since we found we need to wait more than twice as long.
     tcg_ssh_timeout_multiplier = 4
-    def __init__(self, args):
+    def __init__(self, args, config=None):
         self._guest = None
         self._genisoimage = args.genisoimage
         self._build_path = args.build_path
+        # Allow input config to override defaults.
+        self._config = DEFAULT_CONFIG.copy()
+        if config != None:
+            self._config.update(config)
+        self.validate_ssh_keys()
         self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
                                                          suffix=".tmp",
                                                          dir="."))
         atexit.register(shutil.rmtree, self._tmpdir)
-
-        self._ssh_key_file = os.path.join(self._tmpdir, "id_rsa")
-        open(self._ssh_key_file, "w").write(SSH_KEY)
-        subprocess.check_call(["chmod", "600", self._ssh_key_file])
-
-        self._ssh_pub_key_file = os.path.join(self._tmpdir, "id_rsa.pub")
-        open(self._ssh_pub_key_file, "w").write(SSH_PUB_KEY)
+        # Copy the key files to a temporary directory.
+        # Also chmod the key file to agree with ssh requirements.
+        self._config['ssh_key'] = \
+            open(self._config['ssh_key_file']).read().rstrip()
+        self._config['ssh_pub_key'] = \
+            open(self._config['ssh_pub_key_file']).read().rstrip()
+        self._ssh_tmp_key_file = os.path.join(self._tmpdir, "id_rsa")
+        open(self._ssh_tmp_key_file, "w").write(self._config['ssh_key'])
+        subprocess.check_call(["chmod", "600", self._ssh_tmp_key_file])
+
+        self._ssh_tmp_pub_key_file = os.path.join(self._tmpdir, "id_rsa.pub")
+        open(self._ssh_tmp_pub_key_file,
+             "w").write(self._config['ssh_pub_key'])
 
         self.debug = args.debug
         self._stderr = sys.stderr
@@ -84,11 +122,14 @@ class BaseVM(object):
             self._stdout = sys.stdout
         else:
             self._stdout = self._devnull
+        netdev = "user,id=vnet,hostfwd=:127.0.0.1:{}-:22"
         self._args = [ \
-            "-nodefaults", "-m", "4G",
-            "-cpu", "max",
-            "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22" +
-                       (",ipv6=no" if not self.ipv6 else ""),
+            "-nodefaults", "-m", self._config['memory'],
+            "-cpu", self._config['cpu'],
+            "-netdev",
+            netdev.format(self._config['ssh_port']) +
+            (",ipv6=no" if not self.ipv6 else "") +
+            (",dns=" + self._config['dns'] if self._config['dns'] else ""),
             "-device", "virtio-net-pci,netdev=vnet",
             "-vnc", "127.0.0.1:0,to=20"]
         if args.jobs and args.jobs > 1:
@@ -99,6 +140,55 @@ class BaseVM(object):
             logging.info("KVM not available, not using -enable-kvm")
         self._data_args = []
 
+        if self._config['qemu_args'] != None:
+            qemu_args = self._config['qemu_args']
+            qemu_args = qemu_args.replace('\n',' ').replace('\r','')
+            # shlex groups quoted arguments together
+            # we need this to keep the quoted args together for when
+            # the QEMU command is issued later.
+            args = shlex.split(qemu_args)
+            self._config['extra_args'] = []
+            for arg in args:
+                if arg:
+                    # Preserve quotes around arguments.
+                    # shlex above takes them out, so add them in.
+                    if " " in arg:
+                        arg = '"{}"'.format(arg)
+                    self._config['extra_args'].append(arg)
+
+    def validate_ssh_keys(self):
+        """Check to see if the ssh key files exist."""
+        if 'ssh_key_file' not in self._config or\
+           not os.path.exists(self._config['ssh_key_file']):
+            raise Exception("ssh key file not found.")
+        if 'ssh_pub_key_file' not in self._config or\
+           not os.path.exists(self._config['ssh_pub_key_file']):
+               raise Exception("ssh pub key file not found.")
+
+    def wait_boot(self, wait_string=None):
+        """Wait for the standard string we expect
+           on completion of a normal boot.
+           The user can also choose to override with an
+           alternate string to wait for."""
+        if wait_string is None:
+            if self.login_prompt is None:
+                raise Exception("self.login_prompt not defined")
+            wait_string = self.login_prompt
+        # Intentionally bump up the default timeout under TCG,
+        # since the console wait below takes longer.
+        timeout = self.socket_timeout
+        if not kvm_available(self.arch):
+            timeout *= 8
+        self.console_init(timeout=timeout)
+        self.console_wait(wait_string)
+
+    def __getattr__(self, name):
+        # Support direct access to config by key.
+        # for example, access self._config['cpu'] by self.cpu
+        if name.lower() in self._config.keys():
+            return self._config[name.lower()]
+        return object.__getattribute__(self, name)
+
     def _download_with_cache(self, url, sha256sum=None, sha512sum=None):
         def check_sha256sum(fname):
             if not sha256sum:
@@ -130,8 +220,9 @@ class BaseVM(object):
                    "-t",
                    "-o", "StrictHostKeyChecking=no",
                    "-o", "UserKnownHostsFile=" + os.devnull,
-                   "-o", "ConnectTimeout=1",
-                   "-p", self.ssh_port, "-i", self._ssh_key_file]
+                   "-o",
+                   "ConnectTimeout={}".format(self._config["ssh_timeout"]),
+                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
         # If not in debug mode, set ssh to quiet mode to
         # avoid printing the results of commands.
         if not self.debug:
@@ -180,14 +271,14 @@ class BaseVM(object):
                             "virtio-blk,drive=%s,serial=%s,bootindex=1" % (name, name)]
 
     def boot(self, img, extra_args=[]):
-        args = self._args + [
-            "-drive", "file=%s,if=none,id=drive0,cache=writeback" % img,
-            "-device", "virtio-blk,drive=drive0,bootindex=0"]
-        args += self._data_args + extra_args
+        boot_dev = BOOT_DEVICE[self._config['boot_dev_type']]
+        boot_params = boot_dev.format(img)
+        args = self._args + boot_params.split(' ')
+        args += self._data_args + extra_args + self._config['extra_args']
         logging.debug("QEMU args: %s", " ".join(args))
         qemu_path = get_qemu_path(self.arch, self._build_path)
         guest = QEMUMachine(binary=qemu_path, args=args)
-        guest.set_machine('pc')
+        guest.set_machine(self._config['machine'])
         guest.set_console()
         try:
             guest.launch()
@@ -301,7 +392,8 @@ class BaseVM(object):
         self.console_send(command)
 
     def console_ssh_init(self, prompt, user, pw):
-        sshkey_cmd = "echo '%s' > .ssh/authorized_keys\n" % SSH_PUB_KEY.rstrip()
+        sshkey_cmd = "echo '%s' > .ssh/authorized_keys\n" \
+                     % self._config['ssh_pub_key'].rstrip()
         self.console_wait_send("login:",    "%s\n" % user)
         self.console_wait_send("Password:", "%s\n" % pw)
         self.console_wait_send(prompt,      "mkdir .ssh\n")
@@ -360,23 +452,23 @@ class BaseVM(object):
                           "local-hostname: {}-guest\n".format(name)])
         mdata.close()
         udata = open(os.path.join(cidir, "user-data"), "w")
-        print("guest user:pw {}:{}".format(self.GUEST_USER,
-                                           self.GUEST_PASS))
+        print("guest user:pw {}:{}".format(self._config['guest_user'],
+                                           self._config['guest_pass']))
         udata.writelines(["#cloud-config\n",
                           "chpasswd:\n",
                           "  list: |\n",
-                          "    root:%s\n" % self.ROOT_PASS,
-                          "    %s:%s\n" % (self.GUEST_USER,
-                                           self.GUEST_PASS),
+                          "    root:%s\n" % self._config['root_pass'],
+                          "    %s:%s\n" % (self._config['guest_user'],
+                                           self._config['guest_pass']),
                           "  expire: False\n",
                           "users:\n",
-                          "  - name: %s\n" % self.GUEST_USER,
+                          "  - name: %s\n" % self._config['guest_user'],
                           "    sudo: ALL=(ALL) NOPASSWD:ALL\n",
                           "    ssh-authorized-keys:\n",
-                          "    - %s\n" % SSH_PUB_KEY,
+                          "    - %s\n" % self._config['ssh_pub_key'],
                           "  - name: root\n",
                           "    ssh-authorized-keys:\n",
-                          "    - %s\n" % SSH_PUB_KEY,
+                          "    - %s\n" % self._config['ssh_pub_key'],
                           "locale: en_US.UTF-8\n"])
         proxy = os.environ.get("http_proxy")
         if not proxy is None:
@@ -447,15 +539,17 @@ def parse_args(vmcls):
     parser.disable_interspersed_args()
     return parser.parse_args()
 
-def main(vmcls):
+def main(vmcls, config=None):
     try:
+        if config == None:
+            config = {}
         args, argv = parse_args(vmcls)
         if not argv and not args.build_qemu and not args.build_image:
             print("Nothing to do?")
             return 1
         logging.basicConfig(level=(logging.DEBUG if args.debug
                                    else logging.WARN))
-        vm = vmcls(args)
+        vm = vmcls(args, config=config)
         if args.build_image:
             if os.path.exists(args.image) and not args.force:
                 sys.stderr.writelines(["Image file exists: %s\n" % args.image,
-- 
2.20.1


Re: [PULL 04/41] tests/vm: Add configuration to basevm.py
Posted by Alex Bennée 3 years, 9 months ago
Alex Bennée <alex.bennee@linaro.org> writes:

> From: Robert Foley <robert.foley@linaro.org>
>
> Added use of a configuration to tests/vm/basevm.py.
> The configuration provides parameters used to configure a VM.
> This allows for providing alternate configurations to the VM being
> created/launched. cpu, machine, memory, and NUMA configuration are all
> examples of configuration which we might want to vary on the VM being created
> or launched.
> This will for example allow for creating an aarch64 vm.
>
> Signed-off-by: Robert Foley <robert.foley@linaro.org>
> Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20200601211421.1277-3-robert.foley@linaro.org>
> Message-Id: <20200701135652.1366-7-alex.bennee@linaro.org>
>
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 5a58e6c39300..cfe20c58f7ef 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -29,16 +29,41 @@ import tempfile
>  import shutil
>  import multiprocessing
>  import traceback
> -
> -SSH_KEY = open(os.path.join(os.path.dirname(__file__),
> -               "..", "keys", "id_rsa")).read()
> -SSH_PUB_KEY = open(os.path.join(os.path.dirname(__file__),
> -                   "..", "keys", "id_rsa.pub")).read()
> -
> +import shlex
> +
> +SSH_KEY_FILE = os.path.join(os.path.dirname(__file__),
> +               "..", "keys", "id_rsa")
> +SSH_PUB_KEY_FILE = os.path.join(os.path.dirname(__file__),
> +                   "..", "keys", "id_rsa.pub")
> +
> +# This is the standard configuration.
> +# Any or all of these can be overridden by
> +# passing in a config argument to the VM constructor.
> +DEFAULT_CONFIG = {
> +    'cpu'             : "max",
> +    'machine'         : 'pc',
> +    'guest_user'      : "qemu",
> +    'guest_pass'      : "qemupass",
> +    'root_pass'       : "qemupass",
> +    'ssh_key_file'    : SSH_KEY_FILE,
> +    'ssh_pub_key_file': SSH_PUB_KEY_FILE,
> +    'memory'          : "4G",
> +    'extra_args'      : [],
> +    'qemu_args'       : "",
> +    'dns'             : "",
> +    'ssh_port'        : 0,
> +    'install_cmds'    : "",
> +    'boot_dev_type'   : "block",
> +    'ssh_timeout'     : 1,
> +}
<snip>
>  
> -def main(vmcls):
> +def main(vmcls, config=None):
>      try:
> +        if config == None:
> +            config = {}

Ahh I think this is where is went wrong - should be config = DEFAULT_CONFIG

Just re-running the rest of the vm builds now.

-- 
Alex Bennée

[PULL 13/41] tests/vm: allow us to take advantage of MTTCG
Posted by Alex Bennée 3 years, 9 months ago
We currently limit TCG guests to -smp 1 but now we have added some
aarch64 guests we can do better when running on x86_64 hardware.
Raise the limit for TCG guests when it is safe to do so.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20200701135652.1366-16-alex.bennee@linaro.org>

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 890bbc5549a6..21f46d1957d9 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -551,8 +551,15 @@ def parse_config(config, args):
 def parse_args(vmcls):
 
     def get_default_jobs():
-        if kvm_available(vmcls.arch):
-            return multiprocessing.cpu_count() // 2
+        if multiprocessing.cpu_count() > 1:
+            if kvm_available(vmcls.arch):
+                return multiprocessing.cpu_count() // 2
+            elif os.uname().machine == "x86_64" and \
+                 vmcls.arch in ["aarch64", "x86_64", "i386"]:
+                # MTTCG is available on these arches and we can allow
+                # more cores. but only up to a reasonable limit. User
+                # can always override these limits with --jobs.
+                return min(multiprocessing.cpu_count() // 2, 8)
         else:
             return 1
 
-- 
2.20.1


[PULL 14/41] tests/docker: check for an parameters not empty string
Posted by Alex Bennée 3 years, 9 months ago
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20200701135652.1366-17-alex.bennee@linaro.org>

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index 02cd67a8c5e8..ebc5b97ecf91 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -47,7 +47,7 @@ build_qemu()
 check_qemu()
 {
     # default to make check unless the caller specifies
-    if test -z "$@"; then
+    if [ $# = 0 ]; then
         INVOCATION="check"
     else
         INVOCATION="$@"
-- 
2.20.1


[PULL 16/41] .gitignore: un-ignore .gitlab-ci.d
Posted by Alex Bennée 3 years, 9 months ago
The sooner we deprecate in-tree builds the sooner this mess of regexes
can be thrown away.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20200701135652.1366-19-alex.bennee@linaro.org>

diff --git a/.gitignore b/.gitignore
index 90acb4347d46..2992d15931ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,6 +93,7 @@
 *.tp
 *.vr
 *.d
+!/.gitlab-ci.d
 !/scripts/qemu-guest-agent/fsfreeze-hook.d
 *.o
 .sdk
-- 
2.20.1


[PULL 20/41] gitlab: convert jobs to use custom built containers
Posted by Alex Bennée 3 years, 9 months ago
From: Daniel P. Berrangé <berrange@redhat.com>

Now that we're building standard container images from
dockerfiles in tests/docker/dockerfiles, we can convert
the build jobs to use them. The key benefit of this is
that a contributor can now more easily replicate the CI
environment on their local machine. The container images
are cached too, so we are not spending time waiting for
the apt-get/dnf package installs to complete.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200622153318.751107-4-berrange@redhat.com>
[AJB: tweak naming convention]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200701135652.1366-23-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72d688875fd7..a7abc55a5c6a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,133 +9,108 @@ include:
   - local: '/.gitlab-ci.d/opensbi.yml'
   - local: '/.gitlab-ci.d/containers.yml'
 
-.update_apt_template: &before_script_apt
- before_script:
-  - apt-get update -qq
-  - apt-get install -y -qq git gcc libglib2.0-dev libpixman-1-dev make
-        genisoimage
-  - JOBS=$(expr $(nproc) + 1)
-
-.update_dnf_template: &before_script_dnf
- before_script:
-  - dnf update -y
-  - dnf install -y bzip2 diffutils gcc git genisoimage findutils glib2-devel
-        make python3 perl-podlators perl-Test-Harness pixman-devel zlib-devel
-  - JOBS=$(expr $(nproc) + 1)
+.native_build_job_template: &native_build_job_definition
+  stage: build
+  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
+  before_script:
+    - JOBS=$(expr $(nproc) + 1)
+  script:
+    - mkdir build
+    - cd build
+    - if test -n "$TARGETS";
+      then
+        ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
+      else
+        ../configure --enable-werror $CONFIGURE_ARGS ;
+      fi
+    - make -j"$JOBS"
+    - make -j"$JOBS" $MAKE_CHECK_ARGS
 
 build-system1:
- stage: build
- image: ubuntu:19.10
- <<: *before_script_apt
- script:
- - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev
-      libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev
- - mkdir build
- - cd build
- - ../configure --enable-werror --target-list="aarch64-softmmu alpha-softmmu
-      cris-softmmu hppa-softmmu lm32-softmmu moxie-softmmu microblazeel-softmmu
-      mips64el-softmmu m68k-softmmu ppc-softmmu riscv64-softmmu sparc-softmmu"
- - make -j"$JOBS"
- - make -j"$JOBS" check
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: ubuntu2004
+    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu lm32-softmmu
+      moxie-softmmu microblazeel-softmmu mips64el-softmmu m68k-softmmu ppc-softmmu
+      riscv64-softmmu sparc-softmmu
+    MAKE_CHECK_ARGS: check
 
 build-system2:
- stage: build
- image: fedora:latest
- <<: *before_script_dnf
- script:
- - yum install -y SDL2-devel libgcrypt-devel brlapi-devel libaio-devel
-       libfdt-devel lzo-devel librdmacm-devel libibverbs-devel libibumad-devel
-       libzstd-devel
- - mkdir build
- - cd build
- - ../configure --enable-werror --target-list="tricore-softmmu unicore32-softmmu
-      microblaze-softmmu mips-softmmu riscv32-softmmu s390x-softmmu sh4-softmmu
-      sparc64-softmmu x86_64-softmmu xtensa-softmmu nios2-softmmu or1k-softmmu"
- - make -j"$JOBS"
- - make -j"$JOBS" check
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: fedora
+    TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
+      riscv32-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu x86_64-softmmu
+      xtensa-softmmu nios2-softmmu or1k-softmmu
+    MAKE_CHECK_ARGS: check
 
 build-disabled:
- stage: build
- image: fedora:latest
- <<: *before_script_dnf
- script:
- - mkdir build
- - cd build
- - ../configure --enable-werror --disable-rdma --disable-slirp --disable-curl
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: fedora
+    CONFIGURE_ARGS: --disable-rdma --disable-slirp --disable-curl
       --disable-capstone --disable-live-block-migration --disable-glusterfs
       --disable-replication --disable-coroutine-pool --disable-smartcard
       --disable-guest-agent --disable-curses --disable-libxml2 --disable-tpm
       --disable-qom-cast-debug --disable-spice --disable-vhost-vsock
       --disable-vhost-net --disable-vhost-crypto --disable-vhost-user
-      --target-list="i386-softmmu ppc64-softmmu mips64-softmmu i386-linux-user"
- - make -j"$JOBS"
- - make -j"$JOBS" check-qtest SPEED=slow
+    TARGETS: i386-softmmu ppc64-softmmu mips64-softmmu i386-linux-user
+    MAKE_CHECK_ARGS: check-qtest SPEED=slow
 
 build-tcg-disabled:
- stage: build
- image: centos:8
- <<: *before_script_dnf
- script:
- - dnf install -y clang gtk3-devel libusbx-devel libgcrypt-devel
- - mkdir build
- - cd build
- - ../configure --cc=clang --enable-werror --disable-tcg --audio-drv-list=""
- - make -j"$JOBS"
- - make check-unit
- - make check-qapi-schema
- - cd tests/qemu-iotests/
- - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: centos8
+  script:
+    - mkdir build
+    - cd build
+    - ../configure --disable-tcg --audio-drv-list=""
+    - make -j"$JOBS"
+    - make check-unit
+    - make check-qapi-schema
+    - cd tests/qemu-iotests/
+    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
             052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
             170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
- - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
+    - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
             124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
             208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
             260 261 262 263 264 270 272 273 277 279
 
 build-user:
- stage: build
- <<: *before_script_apt
- script:
- - mkdir build
- - cd build
- - ../configure --enable-werror --disable-system --disable-guest-agent
-               --disable-capstone --disable-slirp --disable-fdt
- - make -j"$JOBS"
- - make run-tcg-tests-i386-linux-user run-tcg-tests-x86_64-linux-user
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: ubuntu2004
+    CONFIGURE_ARGS: --disable-system --disable-guest-agent
+      --disable-capstone --disable-slirp --disable-fdt
+    MAKE_CHECK_ARGS:  run-tcg-tests-i386-linux-user run-tcg-tests-x86_64-linux-user
 
 build-clang:
- stage: build
- image: fedora:latest
- <<: *before_script_dnf
- script:
- - yum install -y clang SDL2-devel libattr-devel libcap-ng-devel xfsprogs-devel
-       libiscsi-devel libnfs-devel libseccomp-devel gnutls-devel librbd-devel
- - mkdir build
- - cd build
- - ../configure --cc=clang --cxx=clang++ --enable-werror
-      --target-list="alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
-                     ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user"
- - make -j"$JOBS"
- - make -j"$JOBS" check
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++
+    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
+      ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user
+    MAKE_CHECK_ARGS: check
 
 build-tci:
- stage: build
- image: centos:8
- <<: *before_script_dnf
- script:
- - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
- - mkdir build
- - cd build
- - ../configure --enable-tcg-interpreter
-      --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
- - make -j"$JOBS"
- - make run-tcg-tests-x86_64-softmmu
- - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
- - for tg in $TARGETS ; do
-     export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
-     ./tests/qtest/boot-serial-test || exit 1 ;
-     ./tests/qtest/cdrom-test || exit 1 ;
-   done
- - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/qtest/pxe-test
- - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x"
-   ./tests/qtest/pxe-test -m slow
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: fedora
+  script:
+    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
+    - mkdir build
+    - cd build
+    - ../configure --enable-tcg-interpreter
+        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
+    - make -j"$JOBS"
+    - make run-tcg-tests-x86_64-softmmu
+    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
+    - for tg in $TARGETS ; do
+        export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
+        ./tests/qtest/boot-serial-test || exit 1 ;
+        ./tests/qtest/cdrom-test || exit 1 ;
+      done
+    - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/qtest/pxe-test
+    - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/qtest/pxe-test -m slow
-- 
2.20.1


[PULL 21/41] gitlab: build containers with buildkit and metadata
Posted by Alex Bennée 3 years, 9 months ago
According to the documentation to be able to use --cache-from for
remote registries you need to enable both buildkit and inline the
metadata. We want to do this to support pulling from gitlab when users
build their local docker images.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200701135652.1366-24-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index 2afd01f1d179..f353359fd8ba 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -11,7 +11,9 @@
   script:
     - docker pull "$TAG" || docker pull "$COMMON_TAG" || true
     - sed -i -e "s,FROM qemu/,FROM $CI_REGISTRY_IMAGE/qemu/," tests/docker/dockerfiles/$NAME.docker
-    - docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" -f "tests/docker/dockerfiles/$NAME.docker" tests/docker/dockerfiles
+    - DOCKER_BUILDKIT=1 docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG"
+                                     --build-arg BUILDKIT_INLINE_CACHE=1
+                                     -f "tests/docker/dockerfiles/$NAME.docker" tests/docker/dockerfiles
     - docker push "$TAG"
   after_script:
     - docker logout
-- 
2.20.1


[PULL 24/41] tests/acceptance: skip s390x_ccw_vrtio_tcg on GitLab
Posted by Alex Bennée 3 years, 9 months ago
Currently the test takes more the 900 seconds on GitLab and then times
out. Running on Travis seems to be OK.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200701135652.1366-27-alex.bennee@linaro.org>

diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py
index 3aa57e88b0bf..0055dc7cee77 100644
--- a/tests/acceptance/boot_linux.py
+++ b/tests/acceptance/boot_linux.py
@@ -20,6 +20,7 @@ from avocado.utils import network
 from avocado.utils import vmimage
 from avocado.utils import datadrainer
 from avocado.utils.path import find_command
+from avocado import skipIf
 
 ACCEL_NOT_AVAILABLE_FMT = "%s accelerator does not seem to be available"
 KVM_NOT_AVAILABLE = ACCEL_NOT_AVAILABLE_FMT % "KVM"
@@ -220,6 +221,7 @@ class BootLinuxS390X(BootLinux):
 
     chksum = '4caaab5a434fd4d1079149a072fdc7891e354f834d355069ca982fdcaf5a122d'
 
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_s390_ccw_virtio_tcg(self):
         """
         :avocado: tags=machine:s390-ccw-virtio
-- 
2.20.1


[PULL 25/41] tests/acceptance: fix dtb path for machine_rx_gdbsim
Posted by Alex Bennée 3 years, 9 months ago
The old path doesn't exist but the rx-virt.dtb file has the same
checksum so lets use that.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200701135652.1366-28-alex.bennee@linaro.org>

diff --git a/tests/acceptance/machine_rx_gdbsim.py b/tests/acceptance/machine_rx_gdbsim.py
index a44f2c87da0c..bff63e421d54 100644
--- a/tests/acceptance/machine_rx_gdbsim.py
+++ b/tests/acceptance/machine_rx_gdbsim.py
@@ -50,7 +50,7 @@ class RxGdbSimMachine(Test):
         :avocado: tags=machine:gdbsim-r5f562n7
         :avocado: tags=endian:little
         """
-        dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb')
+        dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb')
         dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18'
         dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
         kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage')
-- 
2.20.1


[PULL 26/41] tests/acceptance: skip multicore mips_malta tests on GitLab
Posted by Alex Bennée 3 years, 9 months ago
For some reason these tests fail all the time on GitLab. I can
re-create the hang around 3% of the time locally but it doesn't seem
to be MTTCG related. For now skipIf on GITLAB_CI.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200701135652.1366-29-alex.bennee@linaro.org>

diff --git a/tests/acceptance/machine_mips_malta.py b/tests/acceptance/machine_mips_malta.py
index 92b4f28a1123..7c9a4ee4d2d6 100644
--- a/tests/acceptance/machine_mips_malta.py
+++ b/tests/acceptance/machine_mips_malta.py
@@ -15,6 +15,7 @@ from avocado import skipUnless
 from avocado_qemu import Test
 from avocado_qemu import wait_for_console_pattern
 from avocado.utils import archive
+from avocado import skipIf
 
 
 NUMPY_AVAILABLE = True
@@ -99,6 +100,7 @@ class MaltaMachineFramebuffer(Test):
         """
         self.do_test_i6400_framebuffer_logo(1)
 
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_mips_malta_i6400_framebuffer_logo_7cores(self):
         """
         :avocado: tags=arch:mips64el
@@ -108,6 +110,7 @@ class MaltaMachineFramebuffer(Test):
         """
         self.do_test_i6400_framebuffer_logo(7)
 
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_mips_malta_i6400_framebuffer_logo_8cores(self):
         """
         :avocado: tags=arch:mips64el
-- 
2.20.1


[PULL 27/41] tests/acceptance: skip LinuxInitrd 2gib with v4.16 on GitLab
Posted by Alex Bennée 3 years, 9 months ago
This fails on GitLab but not when run locally on the same container
image. It's very confusing.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200701135652.1366-30-alex.bennee@linaro.org>

diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
index a3e54d3fc915..a249e2f14a24 100644
--- a/tests/acceptance/linux_initrd.py
+++ b/tests/acceptance/linux_initrd.py
@@ -8,10 +8,12 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
+import os
 import logging
 import tempfile
 
 from avocado_qemu import Test
+from avocado import skipIf
 
 
 class LinuxInitrd(Test):
@@ -51,6 +53,7 @@ class LinuxInitrd(Test):
                 max_size + 1)
             self.assertRegex(self.vm.get_log(), expected_msg)
 
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_with_2gib_file_should_work_with_linux_v4_16(self):
         """
         QEMU has supported up to 4 GiB initrd for recent kernel
-- 
2.20.1


[PULL 29/41] tests/tcg: add more default compilers to configure.sh
Posted by Alex Bennée 3 years, 9 months ago
We were missing a bunch of compilers which we could use if they were
locally installed. The defaults are based on Debian as they seem to be
the best distro for well distributed cross-build compilers.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200701135652.1366-32-alex.bennee@linaro.org>

diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index 2326f978562f..37e49736ca40 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -46,20 +46,29 @@ fi
 : ${cross_cc_aarch64="aarch64-linux-gnu-gcc"}
 : ${cross_cc_aarch64_be="$cross_cc_aarch64"}
 : ${cross_cc_cflags_aarch64_be="-mbig-endian"}
+: $(cross_cc_alpha="alpha-linux-gnu-gcc")
 : ${cross_cc_arm="arm-linux-gnueabihf-gcc"}
 : ${cross_cc_cflags_armeb="-mbig-endian"}
+: ${cross_cc_hppa="hppa-linux-gnu-gcc"}
 : ${cross_cc_i386="i386-pc-linux-gnu-gcc"}
 : ${cross_cc_cflags_i386="-m32"}
-: ${cross_cc_x86_64="x86_64-pc-linux-gnu-gcc"}
-: ${cross_cc_cflags_x86_64="-m64"}
+: ${cross_cc_m68k="m68k-linux-gnu-gcc"}
+: $(cross_cc_mips64el="mips64el-linux-gnuabi64-gcc")
+: $(cross_cc_mips64="mips64-linux-gnuabi64-gcc")
+: $(cross_cc_mipsel="mipsel-linux-gnu-gcc")
+: $(cross_cc_mips="mips-linux-gnu-gcc")
 : ${cross_cc_ppc="powerpc-linux-gnu-gcc"}
 : ${cross_cc_cflags_ppc="-m32"}
-: ${cross_cc_ppc64="powerpc-linux-gnu-gcc"}
-: ${cross_cc_cflags_ppc64="-m64"}
+: ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"}
 : ${cross_cc_ppc64le="powerpc64le-linux-gnu-gcc"}
-: ${cross_cc_cflags_s390x="-m64"}
+: $(cross_cc_riscv64="riscv64-linux-gnu-gcc")
+: ${cross_cc_s390x="s390x-linux-gnu-gcc"}
+: $(cross_cc_sh4="sh4-linux-gnu-gcc")
 : ${cross_cc_cflags_sparc="-m32 -mv8plus -mcpu=ultrasparc"}
+: ${cross_cc_sparc64="sparc64-linux-gnu-gcc"}
 : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
+: ${cross_cc_x86_64="x86_64-pc-linux-gnu-gcc"}
+: ${cross_cc_cflags_x86_64="-m64"}
 
 for target in $target_list; do
   arch=${target%%-*}
-- 
2.20.1


[PULL 31/41] linux-user/elfload: use MAP_FIXED_NOREPLACE in pgb_reserved_va
Posted by Alex Bennée 3 years, 9 months ago
Given we assert the requested address matches what we asked we should
also make that clear in the mmap flags. Otherwise we see failures in
the GitLab environment for some currently unknown but allowable
reason. We use MAP_FIXED_NOREPLACE if we can so we don't just clobber
an existing mapping. Also include the strerror string for a bit more
info on failure.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20200701135652.1366-34-alex.bennee@linaro.org>

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index b5cb21384a1c..7e7f642332dc 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2294,7 +2294,7 @@ static void pgb_dynamic(const char *image_name, long align)
 static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
                             abi_ulong guest_hiaddr, long align)
 {
-    const int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE;
+    int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE;
     void *addr, *test;
 
     if (guest_hiaddr > reserved_va) {
@@ -2307,15 +2307,19 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     /* Widen the "image" to the entire reserved address space. */
     pgb_static(image_name, 0, reserved_va, align);
 
+#ifdef MAP_FIXED_NOREPLACE
+    flags |= MAP_FIXED_NOREPLACE;
+#endif
+
     /* Reserve the memory on the host. */
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
     if (addr == MAP_FAILED) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space for use as guest address space (check your "
+                     "space (%s) for use as guest address space (check your "
                      "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va);
+                     "using -R option)", reserved_va, strerror(errno));
         exit(EXIT_FAILURE);
     }
     assert(addr == test);
-- 
2.20.1


[PULL 32/41] gitlab: enable check-tcg for linux-user tests
Posted by Alex Bennée 3 years, 9 months ago
Switch to building in the new debian-all-test-cross image which has
most of the cross compilers inline.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200701135652.1366-35-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 93baf98232d7..257947853b72 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -143,10 +143,9 @@ build-tcg-disabled:
 build-user:
   <<: *native_build_job_definition
   variables:
-    IMAGE: ubuntu2004
-    CONFIGURE_ARGS: --disable-system --disable-guest-agent
-      --disable-capstone --disable-slirp --disable-fdt
-    MAKE_CHECK_ARGS:  run-tcg-tests-i386-linux-user run-tcg-tests-x86_64-linux-user
+    IMAGE: debian-all-test-cross
+    CONFIGURE_ARGS: --disable-tools --disable-system
+    MAKE_CHECK_ARGS: check-tcg
 
 build-clang:
   <<: *native_build_job_definition
-- 
2.20.1


[PULL 33/41] gitlab: add avocado asset caching
Posted by Alex Bennée 3 years, 9 months ago
These can be quite big so lets cache them. I couldn't find any nots on
ccache in the gitlab docs so I've just ignored it for now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200701135652.1366-36-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 257947853b72..13e9531724d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,12 @@ stages:
   - build
   - test
 
+# We assume GitLab has it's own caching set up for RPM/APT repositories so we
+# just take care of avocado assets here.
+cache:
+  paths:
+    - $HOME/avocado/data/cache
+
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
   - local: '/.gitlab-ci.d/opensbi.yml'
-- 
2.20.1


[PULL 34/41] gitlab: split build-disabled into two phases
Posted by Alex Bennée 3 years, 9 months ago
As we run check-qtest in "SLOW" mode this can timeout so split into
two jobs.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>

Message-Id: <20200701135652.1366-37-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 13e9531724d2..83e38ea19f3d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -113,7 +113,7 @@ acceptance-system-fedora-alt:
     MAKE_CHECK_ARGS: check-acceptance
   <<: *post_acceptance
 
-build-disabled:
+build-system-fedora-disabled:
   <<: *native_build_job_definition
   variables:
     IMAGE: fedora
@@ -124,6 +124,17 @@ build-disabled:
       --disable-qom-cast-debug --disable-spice --disable-vhost-vsock
       --disable-vhost-net --disable-vhost-crypto --disable-vhost-user
     TARGETS: i386-softmmu ppc64-softmmu mips64-softmmu i386-linux-user
+  artifacts:
+    paths:
+      - build
+
+qtest-system-fedora-disabled:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-system-fedora-disabled
+      artifacts: true
+  variables:
+    IMAGE: fedora
     MAKE_CHECK_ARGS: check-qtest SPEED=slow
 
 build-tcg-disabled:
-- 
2.20.1


[PULL 35/41] gitlab: limit re-builds of the containers
Posted by Alex Bennée 3 years, 9 months ago
Most of the time we are just rebuilding the same things. We can skip
this although currently there is no mechanism for picking up new
distro releases.

Rather than try to be too fine grained allow any change to trigger all
the images being rebuilt.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20200701135652.1366-38-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index a7621c4204c7..ea350eacff70 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -17,6 +17,12 @@
     - docker push "$TAG"
   after_script:
     - docker logout
+  rules:
+    - changes:
+      - .gitlab-ci.d/containers.yml
+      - tests/docker/*
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+    - if: '$CI_COMMIT_REF_NAME == "testing/next"'
 
 amd64-centos7-container:
   <<: *container_job_definition
-- 
2.20.1


[PULL 36/41] containers.yml: build with docker.py tooling
Posted by Alex Bennée 3 years, 9 months ago
Instead of building the docker files directly use the same docker.py
scripting as we do for building locally. This should help ensure we
use the exact same steps and allow us to cache properly when building
locally.

To get this working you have to have a fairly recent docker binary
otherwise you will see the error message:

 => ERROR importing cache manifest from registry.gitlab....

So far docker 19.03.12 works (from the docker apt repos) but 18.09.1,
build 4c52b90 which is packaged in Debian Buster fails.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200701135652.1366-39-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index ea350eacff70..b1e39cfd9ac1 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -6,14 +6,17 @@
   before_script:
     - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
     - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/$NAME:latest"
+    - apk add python3
     - docker info
     - docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
   script:
+    - echo "TAG:$TAG"
+    - echo "COMMON_TAG:$COMMON_TAG"
     - docker pull "$TAG" || docker pull "$COMMON_TAG" || true
-    - sed -i -e "s,FROM qemu/,FROM $CI_REGISTRY_IMAGE/qemu/," tests/docker/dockerfiles/$NAME.docker
-    - DOCKER_BUILDKIT=1 docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG"
-                                     --build-arg BUILDKIT_INLINE_CACHE=1
-                                     -f "tests/docker/dockerfiles/$NAME.docker" tests/docker/dockerfiles
+    - ./tests/docker/docker.py --engine docker build
+          -t "qemu:$NAME" -f "tests/docker/dockerfiles/$NAME.docker"
+          -r $CI_REGISTRY_IMAGE
+    - docker tag "qemu:$NAME" "$TAG"
     - docker push "$TAG"
   after_script:
     - docker logout
-- 
2.20.1


[PULL 38/41] shippable: pull images from registry instead of building
Posted by Alex Bennée 3 years, 9 months ago
Now we have a source for registry images pull from there rather than
re-building every time on shippable.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200701135652.1366-41-alex.bennee@linaro.org>

diff --git a/.shippable.yml b/.shippable.yml
index 81905727d14c..f6b742432e5f 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -26,12 +26,10 @@ env:
     - IMAGE=debian-ppc64el-cross
       TARGET_LIST=ppc64-softmmu,ppc64-linux-user,ppc64abi32-linux-user
 build:
-  pre_ci:
-    - make docker-image-${IMAGE} V=1
   pre_ci_boot:
-    image_name: qemu/${IMAGE}
+    image_name: registry.gitlab.com/qemu-project/qemu/${IMAGE}
     image_tag: latest
-    pull: false
+    pull: true
     options: "-e HOME=/root"
   ci:
     - unset CC
-- 
2.20.1


[PULL 39/41] travis.yml: Test also the other targets on s390x
Posted by Alex Bennée 3 years, 9 months ago
From: Thomas Huth <thuth@redhat.com>

s390x is our only big endian host in our CI, so building and testing QEMU
there is quite valuable. Thus let's also test the other targets with
additional jobs (also using different sets of pre-installed libraries to
get a better coverage of the things that we test).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200608114049.4693-1-thuth@redhat.com>

diff --git a/.travis.yml b/.travis.yml
index c24dfbe377f3..ab429500fc3c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -482,6 +482,45 @@ jobs:
               $(exit $BUILD_RC);
           fi
 
+    - name: "[s390x] GCC (other-softmmu)"
+      arch: s390x
+      dist: bionic
+      addons:
+        apt_packages:
+          - libaio-dev
+          - libattr1-dev
+          - libcap-ng-dev
+          - libgnutls28-dev
+          - libiscsi-dev
+          - liblttng-ust-dev
+          - liblzo2-dev
+          - libncurses-dev
+          - libnfs-dev
+          - libnss3-dev
+          - libpixman-1-dev
+          - libsdl2-dev
+          - libsdl2-image-dev
+          - libseccomp-dev
+          - libsnappy-dev
+          - libzstd-dev
+          - nettle-dev
+          - xfslibs-dev
+          # Tests dependencies
+          - genisoimage
+      env:
+        - CONFIG="--disable-containers --audio-drv-list=sdl --disable-user
+                  --target-list-exclude=${MAIN_SOFTMMU_TARGETS}"
+
+    - name: "[s390x] GCC (user)"
+      arch: s390x
+      dist: bionic
+      addons:
+        apt_packages:
+          - libgcrypt20-dev
+          - libgnutls28-dev
+      env:
+        - CONFIG="--disable-containers --disable-system"
+
     - name: "[s390x] Clang (disable-tcg)"
       arch: s390x
       dist: bionic
-- 
2.20.1


[PULL 40/41] tests/qht-bench: Adjust testing rate by -1
Posted by Alex Bennée 3 years, 9 months ago
From: Richard Henderson <richard.henderson@linaro.org>

Since the seed must be non-zero, subtracting 1 means puts the
rate in 0..UINT64_MAX-1, which allows the 0 and UINT64_MAX
thresholds to corrspond to 0% (never) and 100% (always).

Suggested-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200626200950.1015121-2-richard.henderson@linaro.org>

diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index eb88a9013761..ad885d89d054 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -25,7 +25,13 @@ struct thread_stats {
 struct thread_info {
     void (*func)(struct thread_info *);
     struct thread_stats stats;
-    uint64_t r;
+    /*
+     * Seed is in the range [1..UINT64_MAX], because the RNG requires
+     * a non-zero seed.  To use, subtract 1 and compare against the
+     * threshold with </>=.  This lets threshold = 0 never match (0% hit),
+     * and threshold = UINT64_MAX always match (100% hit).
+     */
+    uint64_t seed;
     bool write_op; /* writes alternate between insertions and removals */
     bool resize_down;
 } QEMU_ALIGNED(64); /* avoid false sharing among threads */
@@ -131,8 +137,9 @@ static uint64_t xorshift64star(uint64_t x)
 static void do_rz(struct thread_info *info)
 {
     struct thread_stats *stats = &info->stats;
+    uint64_t r = info->seed - 1;
 
-    if (info->r < resize_threshold) {
+    if (r < resize_threshold) {
         size_t size = info->resize_down ? resize_min : resize_max;
         bool resized;
 
@@ -151,13 +158,14 @@ static void do_rz(struct thread_info *info)
 static void do_rw(struct thread_info *info)
 {
     struct thread_stats *stats = &info->stats;
+    uint64_t r = info->seed - 1;
     uint32_t hash;
     long *p;
 
-    if (info->r >= update_threshold) {
+    if (r >= update_threshold) {
         bool read;
 
-        p = &keys[info->r & (lookup_range - 1)];
+        p = &keys[r & (lookup_range - 1)];
         hash = hfunc(*p);
         read = qht_lookup(&ht, p, hash);
         if (read) {
@@ -166,7 +174,7 @@ static void do_rw(struct thread_info *info)
             stats->not_rd++;
         }
     } else {
-        p = &keys[info->r & (update_range - 1)];
+        p = &keys[r & (update_range - 1)];
         hash = hfunc(*p);
         if (info->write_op) {
             bool written = false;
@@ -208,7 +216,7 @@ static void *thread_func(void *p)
 
     rcu_read_lock();
     while (!atomic_read(&test_stop)) {
-        info->r = xorshift64star(info->r);
+        info->seed = xorshift64star(info->seed);
         info->func(info);
     }
     rcu_read_unlock();
@@ -221,7 +229,7 @@ static void *thread_func(void *p)
 static void prepare_thread_info(struct thread_info *info, int i)
 {
     /* seed for the RNG; each thread should have a different one */
-    info->r = (i + 1) ^ time(NULL);
+    info->seed = (i + 1) ^ time(NULL);
     /* the first update will be a write */
     info->write_op = true;
     /* the first resize will be down */
-- 
2.20.1


[PULL 41/41] tests/qht-bench: Adjust threshold computation
Posted by Alex Bennée 3 years, 9 months ago
From: Richard Henderson <richard.henderson@linaro.org>

In 06c4cc3660b3, we split the multiplication in two parts to avoid
a clang warning.  But because double still rounds to 53 bits, this
does not provide additional precision beyond multiplication by
nextafter(0x1p64, 0), the largest representable value smaller
than 2**64.

However, since we have eliminated 1.0, mutiplying by 2**64 produces
a better distribution of input values to the output values.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200626200950.1015121-3-richard.henderson@linaro.org>

diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index ad885d89d054..362f03cb0370 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -289,11 +289,25 @@ static void pr_params(void)
 
 static void do_threshold(double rate, uint64_t *threshold)
 {
+    /*
+     * For 0 <= rate <= 1, scale to fit in a uint64_t.
+     *
+     * Scale by 2**64, with a special case for 1.0.
+     * The remainder of the possible values are scattered between 0
+     * and 0xfffffffffffff800 (nextafter(0x1p64, 0)).
+     *
+     * Note that we cannot simply scale by UINT64_MAX, because that
+     * value is not representable as an IEEE double value.
+     *
+     * If we scale by the next largest value, nextafter(0x1p64, 0),
+     * then the remainder of the possible values are scattered between
+     * 0 and 0xfffffffffffff000.  Which leaves us with a gap between
+     * the final two inputs that is twice as large as any other.
+     */
     if (rate == 1.0) {
         *threshold = UINT64_MAX;
     } else {
-        *threshold = (rate * 0xffff000000000000ull)
-                   + (rate * 0x0000ffffffffffffull);
+        *threshold = rate * 0x1p64;
     }
 }
 
-- 
2.20.1