Skip to contentSkip to conversation

some testing and CI updates (re-greening)

PATCH Superseded Alex Bennée 7 participants 25 messages Sep 3, 2020 – Sep 7, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover some testing and CI updates (re-greening)

Hi,

My first series after a holiday is a bunch of clean-ups for testing. Currently they all apply on top of Thomas' pull-request-2020-09-02 tag which is currently in flight. The fixes to shippable won't become apparent until the main registry has been updates with the new images but I have tested them locally.

The migration and mips fixes where just quick band-aids so I would appreciate the appropriate maintainers having a closer look.

With these we get back to a mostly green state although there seem to be some acceptance tests that need updating.

Alex Bennée (5):
CODING_STYLE.rst: flesh out our naming conventions. tests/docker: add python3-setuptools the docker images tests/meson.build: fp tests don't need CONFIG_TCG target/mips: simplify gen_compute_imm_branch logic
migration: use pstrcpy to copy run state

Daniel P. Berrangé (1):
crypto: fix build with gcrypt enabled

Gerd Hoffmann (1):
usb-host: restrict workaround to new libusb versions

Paolo Bonzini (1):
qemu-iotests: move check-block back to Makefiles

 CODING_STYLE.rst                         | 31 +++++++++++++++--
 configure                                |  2 ++
 hw/usb/host-libusb.c                     |  2 +-
 migration/global_state.c                 |  4 +--
 target/mips/translate.c                  | 12 ++-----
 .travis.yml                              |  2 +-
 crypto/meson.build                       | 42 +++++++++++++++++-------
 meson.build                              |  7 ++--
 tests/Makefile.include                   | 15 +++++++--
 tests/docker/dockerfiles/debian10.docker |  1 +
 tests/docker/dockerfiles/debian9.docker  |  1 +
 tests/meson.build                        |  3 +-
 tests/qemu-iotests/meson.build           |  4 ---
 13 files changed, 89 insertions(+), 37 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/8 CODING_STYLE.rst: flesh out our naming conventions.

Mention a few of the more common naming conventions we follow in the code base including common variable names and function prefix and suffix examples.

---
v2
- punctuation fixes suggested by Cornelia
- re-worded section on qemu_ prefix
- expanded on _locked suffix
v3
- re-order phrasing around qemu_ prefix
- drop "while actual..." shortname examples

squash! CODING_STYLE.rst: flesh out our naming conventions.

---
 CODING_STYLE.rst | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
CODING_STYLE.rst +29 -2
index 427699e0e42..fd8ce9ceaba 100644
@@ -109,8 +109,35 @@ names are lower_case_with_underscores_ending_with_a_t, like the POSIX
 uint64_t and family.  Note that this last convention contradicts POSIX
 and is therefore likely to be changed.
 
-When wrapping standard library functions, use the prefix ``qemu_`` to alert
-readers that they are seeing a wrapped version; otherwise avoid this prefix.
+Variable Naming Conventions
+---------------------------
+
+A number of short naming conventions exist for variables that use
+common QEMU types. For example, the architecture independent CPUState
+is often held as a ``cs`` pointer variable, whereas the concrete
+CPUArchState is usually held in a pointer called ``env``.
+
+Likewise, in device emulation code the common DeviceState is usually
+called ``dev``.
+
+Function Naming Conventions
+---------------------------
+
+The ``qemu_`` prefix is used for utility functions that are widely
+called from across the code-base. This includes wrapped versions of
+standard library functions (e.g. ``qemu_strtol``) where the prefix is
+added to the library function name to alert readers that they are
+seeing a wrapped version.
+
+Public functions from a file or subsystem (declared in headers) tend
+to have a consistent prefix to show where they came from. For example,
+``tlb_`` for functions from ``cputlb.c`` or ``cpu_`` for functions
+from cpus.c.
+
+If there are two versions of a function to be called with or without a
+lock held, the function that expects the lock to be already held
+usually uses the suffix ``_locked``.
+
 
 Block structure
 ===============
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v1 1/8] CODING_STYLE.rst: flesh out our naming conventions.

Quoted 39 lines · Alex Bennée

Mention a few of the more common naming conventions we follow in the code base including common variable names and function prefix and suffix examples.

---
v2
- punctuation fixes suggested by Cornelia
- re-worded section on qemu_ prefix
- expanded on _locked suffix
v3
- re-order phrasing around qemu_ prefix
- drop "while actual..." shortname examples

squash! CODING_STYLE.rst: flesh out our naming conventions.

---
 CODING_STYLE.rst | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
CODING_STYLE.rst +9 -2
index 427699e0e42..fd8ce9ceaba 100644
@@ -109,8 +109,35 @@ names are lower_case_with_underscores_ending_with_a_t, like the POSIX
 uint64_t and family.  Note that this last convention contradicts POSIX
 and is therefore likely to be changed.
 
-When wrapping standard library functions, use the prefix ``qemu_`` to alert
-readers that they are seeing a wrapped version; otherwise avoid this prefix.
+Variable Naming Conventions
+---------------------------
+
+A number of short naming conventions exist for variables that use
+common QEMU types. For example, the architecture independent CPUState
+is often held as a ``cs`` pointer variable, whereas the concrete
+CPUArchState is usually held in a pointer called ``env``.
+
+Likewise, in device emulation code the common DeviceState is usually

CODING_STYLE.rst names are lower_case_with_underscores_ending_with_a_t, like the POSIX · line 130

Quoted 10 lines
CODING_STYLE.rst +10 -0
+called ``dev``.
+
+Function Naming Conventions
+---------------------------
+
+The ``qemu_`` prefix is used for utility functions that are widely
+called from across the code-base. This includes wrapped versions of
+standard library functions (e.g. ``qemu_strtol``) where the prefix is
+added to the library function name to alert readers that they are
+seeing a wrapped version.

I think we're slowly moving away from "qemu_" except for wrappers, so I would move this paragraph last, wording it like this:

---
Wrapped version of standard library or GLib functions use a ``qemu_`` prefix to alert readers that they are seeing a wrapped version, for example ``qemu_strtol`` or ``qemu_mutex_lock``. Other utility functions that are widely called from across the codebase should not have any prefix, for example ``pstrcpy`` or bit manipulation functions such as ``find_first_bit``.

The ``qemu_`` prefix is also used for functions that modify global emulator state, for example ``qemu_add_vm_change_state_handler``. However, if there is an obvious subsystem-specific prefix it should be used instead.
---

Paolo

Quoted 13 lines
CODING_STYLE.rst +9 -0
+Public functions from a file or subsystem (declared in headers) tend
+to have a consistent prefix to show where they came from. For example,
+``tlb_`` for functions from ``cputlb.c`` or ``cpu_`` for functions
+from cpus.c.
+
+If there are two versions of a function to be called with or without a
+lock held, the function that expects the lock to be already held
+usually uses the suffix ``_locked``.
+
 
 Block structure
 ===============
#3 lore raw

PATCH 2/8 crypto: fix build with gcrypt enabled

In reply to Alex Bennée

From: Daniel P. Berrangé <[email protected]>

If nettle is disabled and gcrypt enabled, the compiler and linker flags needed for gcrypt are not passed.

Gnutls was also not added as a dependancy when gcrypt is enabled.

Attempting to add the library dependencies at the same time as the source dependencies is error prone, as there are alot of different rules for picking which sources to use, and some of the source files use code level conditionals intead. It is thus clearer to add the library dependencies separately.

Message-Id: <[email protected]>

---
 configure          |  2 ++
 crypto/meson.build | 42 +++++++++++++++++++++++++++++++-----------
 meson.build        |  5 +++++
 3 files changed, 38 insertions(+), 11 deletions(-)
configure +2 -0
index cc9af723580..1f61e363a18 100755
@@ -6953,6 +6953,8 @@ if test "$gcrypt" = "yes" ; then
   if test "$gcrypt_hmac" = "yes" ; then
     echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
   fi
+  echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak
+  echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak
 fi
 if test "$nettle" = "yes" ; then
   echo "CONFIG_NETTLE=y" >> $config_host_mak
crypto/meson.build +31 -11

67 lines not on this page · raw message

meson.build +5 -0
index 55c7d2318cd..9b5076452b2 100644
@@ -116,6 +116,11 @@ urcubp = not_found
 if 'CONFIG_TRACE_UST' in config_host
   urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
 endif
+gcrypt = not_found
+if 'CONFIG_GCRYPT' in config_host
+  gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
+                              link_args: config_host['GCRYPT_LIBS'].split())
+endif
 nettle = not_found
 if 'CONFIG_NETTLE' in config_host
   nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
Signature · 1 line
2.20.1
Tested-by Reviewed-by on v1 2/8
#4 lore raw

Re: [PATCH v1 2/8] crypto: fix build with gcrypt enabled

Quoted 13 lines · Alex Bennée

From: Daniel P. Berrangé <[email protected]>

If nettle is disabled and gcrypt enabled, the compiler and linker flags needed for gcrypt are not passed.

Gnutls was also not added as a dependancy when gcrypt is enabled.

Attempting to add the library dependencies at the same time as the source dependencies is error prone, as there are alot of different rules for picking which sources to use, and some of the source files use code level conditionals intead. It is thus clearer to add the library dependencies separately.

Quoted 8 lines

Message-Id: <[email protected]>

---
 configure          |  2 ++
 crypto/meson.build | 42 +++++++++++++++++++++++++++++++-----------
 meson.build        |  5 +++++
 3 files changed, 38 insertions(+), 11 deletions(-)

r~

#5 lore raw

PATCH 3/8 tests/docker: add python3-setuptools the docker images

In reply to Alex Bennée

We need these now for builds to work.

---
 tests/docker/dockerfiles/debian10.docker | 1 +
 tests/docker/dockerfiles/debian9.docker  | 1 +
 2 files changed, 2 insertions(+)
tests/docker/dockerfiles/debian10.docker +1 -0
index bcdff04ddfe..e3c11a454ee 100644
@@ -29,6 +29,7 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         python3-sphinx \
         texinfo \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
tests/docker/dockerfiles/debian9.docker +1 -0
index 0f0ebe530af..3edb5147ef3 100644
@@ -28,4 +28,5 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
Signature · 1 line
2.20.1
Reviewed-by on v1 3/8
#6 lore raw

Re: [PATCH v1 3/8] tests/docker: add python3-setuptools the docker images

Quoted 26 lines · Alex Bennée

We need these now for builds to work.

---
 tests/docker/dockerfiles/debian10.docker | 1 +
 tests/docker/dockerfiles/debian9.docker  | 1 +
 2 files changed, 2 insertions(+)
tests/docker/dockerfiles/debian10.docker +1 -0
index bcdff04ddfe..e3c11a454ee 100644
@@ -29,6 +29,7 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         python3-sphinx \
         texinfo \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
tests/docker/dockerfiles/debian9.docker +0 -0
index 0f0ebe530af..3edb5147ef3 100644

tests/docker/dockerfiles/debian9.docker RUN apt update && \ · line 32

Quoted 5 lines
tests/docker/dockerfiles/debian9.docker +1 -0
@@ -28,4 +28,5 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
Reviewed-by on v1 3/8
#7 lore raw

Re: [PATCH v1 3/8] tests/docker: add python3-setuptools the docker images

In reply to Alex Bennée
Quoted 3 lines · Alex Bennée

We need these now for builds to work.

Quoted 28 lines
---
 tests/docker/dockerfiles/debian10.docker | 1 +
 tests/docker/dockerfiles/debian9.docker  | 1 +
 2 files changed, 2 insertions(+)
tests/docker/dockerfiles/debian10.docker +1 -0
index bcdff04ddfe..e3c11a454ee 100644
@@ -29,6 +29,7 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         python3-sphinx \
         texinfo \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
tests/docker/dockerfiles/debian9.docker +1 -0
index 0f0ebe530af..3edb5147ef3 100644
@@ -28,4 +28,5 @@ RUN apt update && \
         pkg-config \
         psmisc \
         python3 \
+        python3-setuptools \
         $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
#8 lore raw

PATCH 4/8 usb-host: restrict workaround to new libusb versions

In reply to Alex Bennée

From: Gerd Hoffmann <[email protected]>

Fixes build failures with old kernels (USBDEVFS_GET_SPEED missing), on the assumtion that distros with old kernels also have old libusb.

Message-Id: <[email protected]>

---
 hw/usb/host-libusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/host-libusb.c +1 -1
index 08604f787fd..c5d38cb09c0 100644
@@ -942,7 +942,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
     usb_host_ep_update(s);
 
     libusb_speed = libusb_get_device_speed(dev);
-#ifdef CONFIG_LINUX
+#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX)
     if (hostfd && libusb_speed == 0) {
         /*
          * Workaround libusb bug: libusb_get_device_speed() does not
Signature · 1 line
2.20.1
#9 lore raw

PATCH 5/8 qemu-iotests: move check-block back to Makefiles

In reply to Alex Bennée

From: Paolo Bonzini <[email protected]>

check-block has its own test harness, unlike every other test. If we capture its output, as is in general nicer to do without V=1, there will be no sign of progress. So for lack of a better option just move the invocation of the test back to Makefile rules.

As a side effect, this will also fix "make check" in --disable-tools builds, as they were trying to run qemu-iotests without having made qemu-img before.

Message-Id: <[email protected]>

---
 meson.build                    |  2 --
 tests/Makefile.include         | 15 ++++++++++++---
 tests/qemu-iotests/meson.build |  4 ----
 3 files changed, 12 insertions(+), 9 deletions(-)
meson.build +0 -2
index 9b5076452b2..599306f59ad 100644
@@ -1100,11 +1100,9 @@ if have_tools
              dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
   qemu_io = executable('qemu-io', files('qemu-io.c'),
              dependencies: [block, qemuutil], install: true)
-  qemu_block_tools += [qemu_img, qemu_io]
   if targetos != 'windows'
     qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
                dependencies: [block, qemuutil], install: true)
-    qemu_block_tools += [qemu_nbd]
   endif
 
   subdir('storage-daemon')
tests/Makefile.include +12 -3
index 9ac8f5b86a6..08301f5bc9b 100644
@@ -468,7 +468,6 @@ check-tcg: $(RUN_TCG_TARGET_RULES)
 .PHONY: clean-tcg
 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 
-
 # Python venv for running tests
 
 .PHONY: check-venv check-acceptance
@@ -523,8 +522,18 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
 # Consolidated targets
 
 .PHONY: check-block check-unit check check-clean get-vm-images
-check-block:
-check-build: build-unit
+check:
+
+ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
+QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
+check: check-block
+check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
+		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
+		$(patsubst %-softmmu,qemu-system-%,$(filter %-softmmu,$(TARGET_DIRS)))
+	@$<
+endif
+
+check-build: build-unit $(QEMU_IOTESTS_HELPERS-y)
 
 check-clean:
 	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
tests/qemu-iotests/meson.build +0 -4
index 3de09fb8fab..60470936b45 100644
@@ -4,7 +4,3 @@ if 'CONFIG_LINUX' in config_host
 else
     socket_scm_helper = []
 endif
-test('qemu-iotests', sh, args: [files('../check-block.sh')],
-     depends: [qemu_block_tools, emulators, socket_scm_helper],
-     suite: 'block', timeout: 10000)
-
Signature · 1 line
2.20.1
#10 lore raw

PATCH 6/8 tests/meson.build: fp tests don't need CONFIG_TCG

In reply to Alex Bennée

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

---
 .travis.yml       | 2 +-
 tests/meson.build | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
.travis.yml +1 -1
index 1d0ade0a133..65341634d02 100644
@@ -138,7 +138,7 @@ jobs:
 
 
     # Just build tools and run minimal unit and softfloat checks
-    - name: "GCC check-softfloat (user)"
+    - name: "GCC check-unit and check-softfloat"
       env:
         - BASE_CONFIG="--enable-tools"
         - CONFIG="--disable-user --disable-system"
tests/meson.build +2 -1
index fe2c6d8e6b6..bdcc5d75293 100644
@@ -7,8 +7,9 @@ test('decodetree', sh,
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
+subdir('fp')
+
 if 'CONFIG_TCG' in config_host
-  subdir('fp')
   if 'CONFIG_PLUGIN' in config_host
     subdir('plugin')
   endif
Signature · 1 line
2.20.1
#11 lore raw

Re: [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 4 lines

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

The reason is that softfloat is not built at all into QEMU if !CONFIG_TCG. We similarly skip block layer tests if !CONFIG_SOFTMMU && !CONFIG_TOOLS.

Paolo

Quoted 38 lines
---
 .travis.yml       | 2 +-
 tests/meson.build | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
.travis.yml +1 -1
index 1d0ade0a133..65341634d02 100644
@@ -138,7 +138,7 @@ jobs:
 
 
     # Just build tools and run minimal unit and softfloat checks
-    - name: "GCC check-softfloat (user)"
+    - name: "GCC check-unit and check-softfloat"
       env:
         - BASE_CONFIG="--enable-tools"
         - CONFIG="--disable-user --disable-system"
tests/meson.build +2 -2
index fe2c6d8e6b6..bdcc5d75293 100644
@@ -7,8 +7,9 @@ test('decodetree', sh,
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
+subdir('fp')
+
 if 'CONFIG_TCG' in config_host
-  subdir('fp')
   if 'CONFIG_PLUGIN' in config_host
     subdir('plugin')
   endif
--

2.20.1

#12 lore raw

Re: [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG

Quoted 10 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 4 lines

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

The reason is that softfloat is not built at all into QEMU if !CONFIG_TCG. We similarly skip block layer tests if !CONFIG_SOFTMMU && !CONFIG_TOOLS.

It's not built anyway if you don't call the test. Are you saying a --disable-system and --disable-user build is invalid for running unit tests? That is what check-softfloat is doing as it doesn't involve softfloat built into any qemu binary.

Quoted 42 lines

Paolo

Quoted 38 lines
---
 .travis.yml       | 2 +-
 tests/meson.build | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
.travis.yml +1 -1
index 1d0ade0a133..65341634d02 100644
@@ -138,7 +138,7 @@ jobs:
 
 
     # Just build tools and run minimal unit and softfloat checks
-    - name: "GCC check-softfloat (user)"
+    - name: "GCC check-unit and check-softfloat"
       env:
         - BASE_CONFIG="--enable-tools"
         - CONFIG="--disable-user --disable-system"
tests/meson.build +2 -2
index fe2c6d8e6b6..bdcc5d75293 100644
@@ -7,8 +7,9 @@ test('decodetree', sh,
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
+subdir('fp')
+
 if 'CONFIG_TCG' in config_host
-  subdir('fp')
   if 'CONFIG_PLUGIN' in config_host
     subdir('plugin')
   endif
--

2.20.1

Signature · 1 line
Alex Bennée
#13 lore raw

Re: [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG

Quoted 10 lines · Alex Bennée
Quoted 7 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 4 lines

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

Quoted 8 lines
Quoted 3 lines

The reason is that softfloat is not built at all into QEMU if !CONFIG_TCG. We similarly skip block layer tests if !CONFIG_SOFTMMU && !CONFIG_TOOLS.

It's not built anyway if you don't call the test. Are you saying a --disable-system and --disable-user build is invalid for running unit tests? That is what check-softfloat is doing as it doesn't involve softfloat built into any qemu binary.

FYI my tools build dir is configured as:

'--enable-trace-backends=log' '--disable-docs' '--enable-debug' '--disable-system' '--disable-user' '--enable-tools'

and it still works after the Meson conversion.

Quoted 45 lines
Quoted 43 lines

Paolo

Quoted 38 lines
---
 .travis.yml       | 2 +-
 tests/meson.build | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
.travis.yml +1 -1
index 1d0ade0a133..65341634d02 100644
@@ -138,7 +138,7 @@ jobs:
 
 
     # Just build tools and run minimal unit and softfloat checks
-    - name: "GCC check-softfloat (user)"
+    - name: "GCC check-unit and check-softfloat"
       env:
         - BASE_CONFIG="--enable-tools"
         - CONFIG="--disable-user --disable-system"
tests/meson.build +2 -2
index fe2c6d8e6b6..bdcc5d75293 100644
@@ -7,8 +7,9 @@ test('decodetree', sh,
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
+subdir('fp')
+
 if 'CONFIG_TCG' in config_host
-  subdir('fp')
   if 'CONFIG_PLUGIN' in config_host
     subdir('plugin')
   endif
--

2.20.1

#14 lore raw

Re: [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG

Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Alex Bennée
Quoted 7 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 4 lines

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

Quoted 8 lines
Quoted 3 lines

The reason is that softfloat is not built at all into QEMU if !CONFIG_TCG. We similarly skip block layer tests if !CONFIG_SOFTMMU && !CONFIG_TOOLS.

It's not built anyway if you don't call the test. Are you saying a --disable-system and --disable-user build is invalid for running unit tests? That is what check-softfloat is doing as it doesn't involve softfloat built into any qemu binary.

Quoted 6 lines

FYI my tools build dir is configured as:

'--enable-trace-backends=log' '--disable-docs' '--enable-debug' '--disable-system' '--disable-user' '--enable-tools'

and it still works after the Meson conversion.

But check-softfloat doesn't work with that right?

Signature · 1 line
Alex Bennée
#15 lore raw

Re: [PATCH v1 6/8] tests/meson.build: fp tests don't need CONFIG_TCG

Quoted 23 lines · Alex Bennée
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Alex Bennée
Quoted 10 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 4 lines

As the tests build only softfloat.c no actual TCG machinary is neede to test them (as is evidenced by GCC check-softfloat). Might as well fix the wording on Travis while at it.

The reason is that softfloat is not built at all into QEMU if !CONFIG_TCG. We similarly skip block layer tests if !CONFIG_SOFTMMU && !CONFIG_TOOLS.

It's not built anyway if you don't call the test. Are you saying a --disable-system and --disable-user build is invalid for running unit tests? That is what check-softfloat is doing as it doesn't involve softfloat built into any qemu binary.

Quoted 8 lines
Quoted 6 lines

FYI my tools build dir is configured as:

'--enable-trace-backends=log' '--disable-docs' '--enable-debug' '--disable-system' '--disable-user' '--enable-tools'

and it still works after the Meson conversion.

But check-softfloat doesn't work with that right?

Sorry I can't say, I don't test it :/

#16 lore raw

PATCH 7/8 target/mips: simplify gen_compute_imm_branch logic

In reply to Alex Bennée

One of the Travis builds was complaining about:

qemu/include/tcg/tcg.h:437:12: error: ‘cond’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

       return (TCGCond)(c ^ 1);
  ../target/mips/translate.c:20031:13: note: ‘cond’ was declared here
       TCGCond cond;

Rather than figure out exactly which one was causing the complaint I just defaulted to TCG_COND_ALWAYS and allowed that state to double up for the now defunct bcond_compute variable.

---
 target/mips/translate.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
target/mips/translate.c +2 -10
index 899b90ae0ff..398edf72898 100644
@@ -20028,8 +20028,7 @@ static void gen_pool32axf_nanomips_insn(CPUMIPSState *env, DisasContext *ctx)
 static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
                                    int rt, int32_t imm, int32_t offset)
 {
-    TCGCond cond;
-    int bcond_compute = 0;
+    TCGCond cond = TCG_COND_ALWAYS;
     TCGv t0 = tcg_temp_new();
     TCGv t1 = tcg_temp_new();
 
@@ -20046,7 +20045,6 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
             /* Treat as NOP */
             goto out;
         } else {
-            bcond_compute = 1;
             cond = TCG_COND_EQ;
         }
         break;
@@ -20065,7 +20063,6 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
             tcg_gen_shri_tl(t0, t0, imm);
             tcg_gen_andi_tl(t0, t0, 1);
             tcg_gen_movi_tl(t1, 0);
-            bcond_compute = 1;
             if (opc == NM_BBEQZC) {
                 cond = TCG_COND_EQ;
             } else {
@@ -20080,7 +20077,6 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
         } else if (rt == 0 && imm != 0) {
             /* Unconditional branch */
         } else {
-            bcond_compute = 1;
             cond = TCG_COND_NE;
         }
         break;
@@ -20088,24 +20084,20 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
         if (rt == 0 && imm == 0) {
             /* Unconditional branch */
         } else  {
-            bcond_compute = 1;
             cond = TCG_COND_GE;
         }
         break;
     case NM_BLTIC:
-        bcond_compute = 1;
         cond = TCG_COND_LT;
         break;
     case NM_BGEIUC:
         if (rt == 0 && imm == 0) {
             /* Unconditional branch */
         } else  {
-            bcond_compute = 1;
             cond = TCG_COND_GEU;
         }
         break;
     case NM_BLTIUC:
-        bcond_compute = 1;
         cond = TCG_COND_LTU;
         break;
     default:
@@ -20118,7 +20110,7 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc,
     clear_branch_hflags(ctx);
     ctx->base.is_jmp = DISAS_NORETURN;
 
-    if (bcond_compute == 0) {
+    if (cond == TCG_COND_ALWAYS) {
         /* Uncoditional compact branch */
         gen_goto_tb(ctx, 0, ctx->btarget);
     } else {
Signature · 1 line
2.20.1
Reviewed-by on v1 7/8
#17 lore raw

Re: [PATCH v1 7/8] target/mips: simplify gen_compute_imm_branch logic

Quoted 7 lines · Alex Bennée

One of the Travis builds was complaining about:

qemu/include/tcg/tcg.h:437:12: error: ‘cond’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

       return (TCGCond)(c ^ 1);
  ../target/mips/translate.c:20031:13: note: ‘cond’ was declared here
       TCGCond cond;
Quoted 8 lines

Rather than figure out exactly which one was causing the complaint I just defaulted to TCG_COND_ALWAYS and allowed that state to double up for the now defunct bcond_compute variable.

---
 target/mips/translate.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

This looks like a good cleanup.

r~

#18 lore raw

PATCH 8/8 migration: use pstrcpy to copy run state

In reply to Alex Bennée

The gcov build triggered:

../../migration/global_state.c:47:5: error: ‘strncpy’ specified
bound 100 equals destination size [-Werror=stringop-truncation] strncpy((char *)global_state.runstate

As we shouldn't be using strncpy anyway lets use the suggested pstrcpy.

---
 migration/global_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
migration/global_state.c +2 -2
index 25311479a4b..5fbe6d1ff07 100644
@@ -44,8 +44,8 @@ void global_state_store_running(void)
 {
     const char *state = RunState_str(RUN_STATE_RUNNING);
     assert(strlen(state) < sizeof(global_state.runstate));
-    strncpy((char *)global_state.runstate,
-           state, sizeof(global_state.runstate));
+    pstrcpy((char *)global_state.runstate, sizeof(global_state.runstate),
+            state);
 }
 
 bool global_state_received(void)
Signature · 1 line
2.20.1
#19 lore raw

Re: [PATCH v1 8/8] migration: use pstrcpy to copy run state

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected]> ha scritto:

Quoted 9 lines

The gcov build triggered:

../../migration/global_state.c:47:5: error: ‘strncpy’ specified
bound 100 equals destination size [-Werror=stringop-truncation] strncpy((char *)global_state.runstate

As we shouldn't be using strncpy anyway lets use the suggested pstrcpy.

This is wrong, we want the all-zeros behavior of strncpy that pstrcpy lacks.

Paolo

Quoted 25 lines
---
 migration/global_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
migration/global_state.c +2 -3
index 25311479a4b..5fbe6d1ff07 100644
@@ -44,8 +44,8 @@ void global_state_store_running(void)
 {
     const char *state = RunState_str(RUN_STATE_RUNNING);
     assert(strlen(state) < sizeof(global_state.runstate));
-    strncpy((char *)global_state.runstate,
-           state, sizeof(global_state.runstate));
+    pstrcpy((char *)global_state.runstate, sizeof(global_state.runstate),
+            state);
 }
 
 bool global_state_received(void)
--

2.20.1

#20 lore raw

Re: [PATCH v1 8/8] migration: use pstrcpy to copy run state

Quoted 9 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected] <mailto:[email protected]>> ha scritto:

The gcov build triggered:

  ../../migration/global_state.c:47:5: error: ‘strncpy’ specified bound 100 equals destination size [-Werror=stringop-truncation] strncpy((char *)global_state.runstate

Quoted 5 lines

As we shouldn't be using strncpy anyway lets use the suggested pstrcpy.

This is wrong, we want the all-zeros behavior of strncpy that pstrcpy lacks.

FWIW links to previous discussions:
https://www.mail-archive.com/[email protected]/msg584216.html

Quoted 2 lines

Paolo

#21 lore raw

Re: [PATCH v1 8/8] migration: use pstrcpy to copy run state

Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Paolo Bonzini

Il gio 3 set 2020, 13:21 Alex Bennée <[email protected] <mailto:[email protected]>> ha scritto:

The gcov build triggered:

../../migration/global_state.c:47:5: error: ‘strncpy’ specified
bound 100 equals destination size [-Werror=stringop-truncation] strncpy((char *)global_state.runstate

Quoted 8 lines
Quoted 5 lines

As we shouldn't be using strncpy anyway lets use the suggested pstrcpy.

This is wrong, we want the all-zeros behavior of strncpy that pstrcpy lacks.

FWIW links to previous discussions:
https://www.mail-archive.com/[email protected]/msg584216.html

Hmm I wonder why gprof interfered with the assert. Either way I'll drop the patch.

Quoted 3 lines
Quoted 3 lines

Paolo

Signature · 1 line
Alex Bennée
#22 lore raw
In reply to Alex Bennée
Quoted 21 lines · Alex Bennée

Hi,

My first series after a holiday is a bunch of clean-ups for testing. Currently they all apply on top of Thomas' pull-request-2020-09-02 tag which is currently in flight. The fixes to shippable won't become apparent until the main registry has been updates with the new images but I have tested them locally.

The migration and mips fixes where just quick band-aids so I would appreciate the appropriate maintainers having a closer look.

With these we get back to a mostly green state although there seem to be some acceptance tests that need updating.

Alex Bennée (5):
CODING_STYLE.rst: flesh out our naming conventions. tests/docker: add python3-setuptools the docker images tests/meson.build: fp tests don't need CONFIG_TCG target/mips: simplify gen_compute_imm_branch logic
migration: use pstrcpy to copy run state

Quoted 2 lines

Daniel P. Berrangé (1):
crypto: fix build with gcrypt enabled

Any reason you only picked 1 of the two pathces in that series. The second patch adds CI to validate that the first patch is actually correct

https://lists.gnu.org/archive/html/qemu-devel/2020-09/msg00279.html

Quoted 7 lines

Gerd Hoffmann (1):
usb-host: restrict workaround to new libusb versions

Paolo Bonzini (1):
qemu-iotests: move check-block back to Makefiles

Quoted 18 lines
 CODING_STYLE.rst                         | 31 +++++++++++++++--
 configure                                |  2 ++
 hw/usb/host-libusb.c                     |  2 +-
 migration/global_state.c                 |  4 +--
 target/mips/translate.c                  | 12 ++-----
 .travis.yml                              |  2 +-
 crypto/meson.build                       | 42 +++++++++++++++++-------
 meson.build                              |  7 ++--
 tests/Makefile.include                   | 15 +++++++--
 tests/docker/dockerfiles/debian10.docker |  1 +
 tests/docker/dockerfiles/debian9.docker  |  1 +
 tests/meson.build                        |  3 +-
 tests/qemu-iotests/meson.build           |  4 ---
 13 files changed, 89 insertions(+), 37 deletions(-)
Signature · 1 line
2.20.1

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#23 lore raw
Quoted 22 lines · Daniel P. Berrangé
Quoted 21 lines · Alex Bennée

Hi,

My first series after a holiday is a bunch of clean-ups for testing. Currently they all apply on top of Thomas' pull-request-2020-09-02 tag which is currently in flight. The fixes to shippable won't become apparent until the main registry has been updates with the new images but I have tested them locally.

The migration and mips fixes where just quick band-aids so I would appreciate the appropriate maintainers having a closer look.

With these we get back to a mostly green state although there seem to be some acceptance tests that need updating.

Alex Bennée (5):
CODING_STYLE.rst: flesh out our naming conventions. tests/docker: add python3-setuptools the docker images tests/meson.build: fp tests don't need CONFIG_TCG target/mips: simplify gen_compute_imm_branch logic
migration: use pstrcpy to copy run state

Quoted 6 lines
Quoted 2 lines

Daniel P. Berrangé (1):
crypto: fix build with gcrypt enabled

Any reason you only picked 1 of the two pathces in that series. The second patch adds CI to validate that the first patch is actually correct

I guess Alex dropped it because there is a (simple) conflict with one
of my patches ("gitlab/travis: Rework the disabled features tests") ... should be easy to fix, though.

I'm also preparing yet another patch series for improving the gitlab-CI (with the cross-compiler patches), so I can also put your crypto gitlab patch in there if you like.

Thomas

#24 lore raw
In reply to Daniel P. Berrangé
Quoted 22 lines · Daniel P. Berrangé
Quoted 21 lines · Alex Bennée

Hi,

My first series after a holiday is a bunch of clean-ups for testing. Currently they all apply on top of Thomas' pull-request-2020-09-02 tag which is currently in flight. The fixes to shippable won't become apparent until the main registry has been updates with the new images but I have tested them locally.

The migration and mips fixes where just quick band-aids so I would appreciate the appropriate maintainers having a closer look.

With these we get back to a mostly green state although there seem to be some acceptance tests that need updating.

Alex Bennée (5):
CODING_STYLE.rst: flesh out our naming conventions. tests/docker: add python3-setuptools the docker images tests/meson.build: fp tests don't need CONFIG_TCG target/mips: simplify gen_compute_imm_branch logic
migration: use pstrcpy to copy run state

Quoted 8 lines
Quoted 2 lines

Daniel P. Berrangé (1):
crypto: fix build with gcrypt enabled

Any reason you only picked 1 of the two pathces in that series. The second patch adds CI to validate that the first patch is actually correct

https://lists.gnu.org/archive/html/qemu-devel/2020-09/msg00279.html

Oops, i got dropped when I re-based on Thomas' tree and I erroneously thought it was because it conflicted with itself rather than another change. I'll include it in v2.

Quoted 29 lines
Quoted 8 lines

Gerd Hoffmann (1):
usb-host: restrict workaround to new libusb versions

Paolo Bonzini (1):
qemu-iotests: move check-block back to Makefiles

Quoted 18 lines
 CODING_STYLE.rst                         | 31 +++++++++++++++--
 configure                                |  2 ++
 hw/usb/host-libusb.c                     |  2 +-
 migration/global_state.c                 |  4 +--
 target/mips/translate.c                  | 12 ++-----
 .travis.yml                              |  2 +-
 crypto/meson.build                       | 42 +++++++++++++++++-------
 meson.build                              |  7 ++--
 tests/Makefile.include                   | 15 +++++++--
 tests/docker/dockerfiles/debian10.docker |  1 +
 tests/docker/dockerfiles/debian9.docker  |  1 +
 tests/meson.build                        |  3 +-
 tests/qemu-iotests/meson.build           |  4 ---
 13 files changed, 89 insertions(+), 37 deletions(-)
Signature · 1 line
2.20.1

Regards,
Daniel

Signature · 1 line
Alex Bennée