summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/sets
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-09-13 10:20:24 +0200
committerFlorian Westphal <fw@strlen.de>2023-09-15 15:52:06 +0200
commitd40fb2197b6335432c59cb6819098fa4d7981385 (patch)
tree0f11e5be50bf73c01bfaa7b5783514485e4146db /tests/shell/testcases/sets
parentf6431b0a0c40772ea2bb745c11ee17e480182c8d (diff)
tests/shell: add "random-source.sh" helper for random-source for sort/shuf
Commands `sort` and `shuf` have a "--random-source" argument. That's useful for generating stable, reproducible "random" output. However, we want to do this based on a fixed seed, while the "--random-source" expects a stream of randomness. Add a helper script for that. Also, use the stable randomness for shuf in the test "tests/shell/testcases/sets/automerge_0". See-also: https://www.gnu.org/software/coreutils/manual/html_node/Random-sources.html#Random-sources Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/testcases/sets')
-rwxr-xr-xtests/shell/testcases/sets/automerge_02
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/shell/testcases/sets/automerge_0 b/tests/shell/testcases/sets/automerge_0
index 170c3865..1dbac0b7 100755
--- a/tests/shell/testcases/sets/automerge_0
+++ b/tests/shell/testcases/sets/automerge_0
@@ -44,7 +44,7 @@ do
done
tmpfile3=$(mktemp)
-shuf $tmpfile2 > $tmpfile3
+shuf "$tmpfile2" --random-source=<("$NFT_TEST_BASEDIR/helpers/random-source.sh" "automerge-shuf-tmpfile2" "$NFT_TEST_RANDOM_SEED") > "$tmpfile3"
i=0
cat $tmpfile3 | while read line && [ $i -lt 10 ]
do