[Libguestfs] [libnbd PATCH 07/20] tests: Fix port randomisation

Martin Kletzander
Tue, 08 Jun 2021 07:53:48 -0000

The shell/environment variable `$RANDOM` is not defined POSIX, so let bash
evaluate the whole expression by changing double quotes to single quotes.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 tests/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a3a1f092572..c65bf8be399e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -608,7 +608,7 @@ TESTS += \
 	connect-uri-nbd-unix \
 	$(NULL)

-RANDOM1 := $(shell bash -c "echo $$(( 32768 + (RANDOM & 16383)
))")
+RANDOM1 := $(shell bash -c 'echo $$(( 32768 + (RANDOM & 16383) ))')
 connect_uri_nbd_SOURCES = connect-uri.c
 connect_uri_nbd_CPPFLAGS = \
 	-I$(top_srcdir)/include \
@@ -640,7 +640,7 @@ TESTS += \
 	connect-uri-nbds-unix \
 	$(NULL)

-RANDOM2 := $(shell bash -c "echo $$(( 32768 + (RANDOM & 16383)
))")
+RANDOM2 := $(shell bash -c 'echo $$(( 32768 + (RANDOM & 16383) ))')
 connect_uri_nbds_SOURCES = connect-uri.c
 connect_uri_nbds_CPPFLAGS = \
 	-I$(top_srcdir)/include \
@@ -671,7 +671,7 @@ TESTS += \
 	connect-uri-nbds-psk \
 	$(NULL)

-RANDOM3 := $(shell bash -c "echo $$(( 32768 + (RANDOM & 16383)
))")
+RANDOM3 := $(shell bash -c 'echo $$(( 32768 + (RANDOM & 16383) ))')
 connect_uri_nbds_psk_SOURCES = connect-uri.c
 connect_uri_nbds_psk_CPPFLAGS = \
 	-I$(top_srcdir)/include \
--
2.31.1