]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: workaround lack of $SRANDOM before bash 5.1
authorThomas Haller <thaller@redhat.com>
Mon, 27 Nov 2023 19:15:36 +0000 (20:15 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 28 Nov 2023 01:06:52 +0000 (02:06 +0100)
$SRANDOM is only supported since bash 5.1. Add a fallback to $RANDOM.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/run-tests.sh

index f1345bb14e7ce5e9862012d3666b1ab0df719787..e54f8bf3e3eed0416748b92bf1c56ed6737923ad 100755 (executable)
@@ -314,6 +314,7 @@ DO_LIST_TESTS=
 if [ -z "$NFT_TEST_RANDOM_SEED" ] ; then
        # Choose a random value.
        n="$SRANDOM"
+       [ -z "$n" ] && n="$RANDOM"
 else
        # Parse as number.
        n="$(strtonum "$NFT_TEST_RANDOM_SEED")"