Skip to contentSkip to conversation

Fix NetBSD build (don't build ivshmem tools)

PATCH In review Peter Maydell 3 participants 4 messages Jul 13, 2017 – Jul 14, 2017

lore
Share & tools
lore
#0 lore raw

cover Fix NetBSD build (don't build ivshmem tools)

This patchset fixes the build on NetBSD by making sure we only build the ivshmem-client and ivshmem-server tools if the host OS actually supports ivshmem. (Previously we were only gating building of the within-QEMU ivshmem PCI device.)

Most of this patchset is the work of Kamil Rytarowski; I just split it up into easily-reviewable patches and fixed a few bugs.

Tested on Linux, on NetBSD, and on Linux with a '--disable-linux-user --disable-system' config (which was the one that was failing with our previous attempt to fix this bug).

NB: we still have some things we need to fix to be able to put NetBSD into the build-test set. The next issue is that 'make check' fails with

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM % 255 + 1))} gtester -k --verbose -m=quick tests/check-qdict
sh: arith: syntax error: "RANDOM % 255 + 1"

likely because we're using a bashism there.

thanks
-- PMM

Kamil Rytarowski (2):
configure: Use an explicit CONFIG_IVSHMEM rather than CONFIG_EVENTFD
configure: Don't build ivshmem tools unless CONFIG_IVSHMEM is set

Peter Maydell (1):
configure: Rename CONFIG_IVSHMEM to CONFIG_IVSHMEM_DEVICE

 configure               | 11 +++++++++++
 Makefile                |  2 ++
 Makefile.objs           |  4 ++--
 hw/misc/Makefile.objs   |  2 +-
 tests/Makefile.include  |  4 ++--
 default-configs/pci.mak |  2 +-
 6 files changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Peter Maydell

This patchset fixes the build on NetBSD by making sure we only build the ivshmem-client and ivshmem-server tools if the host OS actually supports ivshmem. (Previously we were only gating building of the within-QEMU ivshmem PCI device.)

Most of this patchset is the work of Kamil Rytarowski; I just split it up into easily-reviewable patches and fixed a few bugs.

Thank you for improving the patches!

Quoted 4 lines

Tested on Linux, on NetBSD, and on Linux with a '--disable-linux-user --disable-system' config (which was the one that was failing with our previous attempt to fix this bug).

Quoted 9 lines

NB: we still have some things we need to fix to be able to put NetBSD into the build-test set. The next issue is that 'make check' fails with

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM % 255 + 1))} gtester -k --verbose -m=quick tests/check-qdict
sh: arith: syntax error: "RANDOM % 255 + 1"

likely because we're using a bashism there.

This is an extension to a POSIX shell. We were lately adding it as an extension to our sh(1) in the distribution. Were also thinking about prompting POSIX to standarize it.

$ echo $((RANDOM % 255))
52

As of now, one portable solution is to parse /dev/urandom, or use a 3rd party tool like awk(1).

To make the life easier we can try to request bash to run tests. A portable shebang is "/usr/bin/env bash".

From the NetBSD point of view I see nothing wrong with using bash for tests.

We can also request NetBSD 8.0 for running tests, busy wait till getting this compatibility issue gone. As of now NetBSD 8.0 is in beta. Personally I don't intend to invest to much time into pre-8.0 releases.

Quoted 18 lines

thanks
-- PMM

Kamil Rytarowski (2):
configure: Use an explicit CONFIG_IVSHMEM rather than CONFIG_EVENTFD
configure: Don't build ivshmem tools unless CONFIG_IVSHMEM is set

Peter Maydell (1):
configure: Rename CONFIG_IVSHMEM to CONFIG_IVSHMEM_DEVICE

 configure               | 11 +++++++++++
 Makefile                |  2 ++
 Makefile.objs           |  4 ++--
 hw/misc/Makefile.objs   |  2 +-
 tests/Makefile.include  |  4 ++--
 default-configs/pci.mak |  2 +-
 6 files changed, 19 insertions(+), 6 deletions(-)
#2 lore raw
Quoted 4 lines · Kamil Rytarowski
Quoted 4 lines

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM % 255 + 1))} gtester -k --verbose -m=quick tests/check-qdict
sh: arith: syntax error: "RANDOM % 255 + 1"

likely because we're using a bashism there.

Yes, assuming that $RANDOM exists is a bashism.

Quoted 11 lines
Quoted 1 line

This is an extension to a POSIX shell. We were lately adding it as an extension to our sh(1) in the distribution. Were also thinking about prompting POSIX to standarize it.

$ echo $((RANDOM % 255))
52

As of now, one portable solution is to parse /dev/urandom, or use a 3rd party tool like awk(1).

It's also portable (although less random) to do:

$(( ${RANDOM:-0} + 1))

(the whole idea of MALLOC_PERTURB_ only works on glibc anyways, so it really doesn't matter what you set it to on other systems).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw
In reply to Peter Maydell
Quoted 4 lines · Peter Maydell

This patchset fixes the build on NetBSD by making sure we only build the ivshmem-client and ivshmem-server tools if the host OS actually supports ivshmem. (Previously we were only gating building of the within-QEMU ivshmem PCI device.)

Markus pointed out that I'd accidentally only sent out the cover letter -- I've just resent the whole set.

thanks
-- PMM