From a3aa4c071713cac2070ca695c50698773e5a4987 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 5 Feb 2021 16:19:24 +0100 Subject: [PATCH] btrfs-progs: tests: randomize device name in mkfs/005-long-device-name-for-ssd Add some randomization to the long device name in case the testsuite runs multiple times on the same host. Signed-off-by: David Sterba --- tests/mkfs-tests/005-long-device-name-for-ssd/test.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh index 2df88db4..79efaeec 100755 --- a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh +++ b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh @@ -9,9 +9,13 @@ check_dm_target_support linear setup_root_helper prepare_test_dev +# Randomize last 4 characters to prevent clashes of device name on the same system +chars=( {0..9} {a..z} {A..Z} ) +rand=${chars[$RANDOM % 62]}${chars[$RANDOM % 62]}${chars[$RANDOM % 62]}${chars[$RANDOM % 62]} + # prep device dmname=\ -btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA$rand dmdev="/dev/mapper/$dmname" run_check truncate -s0 img