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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-02-05 16:19:24 +01:00
parent 01c1bf8d8e
commit a3aa4c0717
1 changed files with 5 additions and 1 deletions

View File

@ -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