[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by th
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell |
Date: |
Fri, 14 Jul 2017 07:03:58 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/14/2017 05:45 AM, Peter Maydell wrote:
> In various places in our test makefiles and scripts we use the
> shell $RANDOM to create a random number. This is a bash
> specific extension, and doesn't work on other shells.
As mentioned elsewhere, you could reword this to "this is an extension
in bash and some other shells, but not universal". But I'm also okay
leaving it untouched.
> Switch to using "${RANDOM:-0}" instead of $RANDOM,
> which will portably either give us a random number or zero.
> This means that on non-bash shells we don't get such
> good test coverage via the MALLOC_PERTURB_ setting, but
> we were already in that situation for non-bash shells.
>
> Our only other uses of $RANDOM (in tests/qemu-iotests/check
> and tests/qemu-iotests/162) are in shell scripts which use
> a #!/bin/bash line so they are always run under bash.
>
> Suggested-by: Eric Blake <address@hidden>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> tests/Makefile.include | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Peter Maydell, 2017/07/14
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Kamil Rytarowski, 2017/07/14
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Fam Zheng, 2017/07/14
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell,
Eric Blake <=
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Stefan Hajnoczi, 2017/07/17
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Markus Armbruster, 2017/07/20
- Re: [Qemu-devel] [PATCH] tests: Handle $RANDOM not being supported by the shell, Peter Maydell, 2017/07/20