aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-14 11:13:09 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-07-14 11:13:09 +0100
commitf289129acf23994b9d1b12e13f28ad98fb8a6e5c (patch)
treed8bc2f1efb18b3a78a31f3da6703cfc1d514a873 /hmp.c
parentb299e79dfea559dc2e7dba8eaf8ba16bfa1d3253 (diff)
tests: Handle $RANDOM not being supported by the shellivshmem
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. With dash the shell doesn't complain, it just effectively always evaluates $RANDOM to 0: echo $((RANDOM + 32768)) => 32768 However, on NetBSD the shell will complain: "-sh: arith: syntax error: "RANDOM + 32768" which means that "make check" fails. 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. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hmp.c')
0 files changed, 0 insertions, 0 deletions