btrfs-progs: tests: unify mktemp file name pattern

The file names are build from roughly these components:

- btrfs-progs as prefix
- category (mkfs, convert) or what's the type of the file like 'image'
- the substitution template, XXXXXX

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-10-11 15:50:09 +02:00
parent ded1e50cd3
commit d96d143ef2
16 changed files with 25 additions and 25 deletions

View File

@ -473,7 +473,7 @@ test-clean:
$(Q)bash tests/clean-tests.sh
test-inst: all
@tmpdest=`mktemp --tmpdir -d btrfs-inst.XXXXXX` && \
@tmpdest=`mktemp --tmpdir -d btrfs-progs-inst.XXXXXX` && \
echo "Test installation to $$tmpdest" && \
$(MAKE) $(MAKEOPTS) DESTDIR=$$tmpdest install && \
$(RM) -rf -- $$tmpdest

View File

@ -271,7 +271,7 @@ run_mayfail()
# store the output to a variable for further processing.
run_mayfail_stdout()
{
tmp_output=$(mktemp --tmpdir btrfs-progs-test--mayfail-stdtout.XXXXXX)
tmp_output=$(mktemp --tmpdir btrfs-progs-mayfail-stdout.XXXXXX)
expand_command "$@"
echo "====== RUN MAYFAIL ${cmd_array[@]}" >> "$RESULTS" 2>&1
@ -339,7 +339,7 @@ run_mustfail_stdout()
local ret
local tmp_output
tmp_output=$(mktemp --tmpdir btrfs-progs-test--mustfail-stdtout.XXXXXX)
tmp_output=$(mktemp --tmpdir btrfs-progs-mustfail-stdout.XXXXXX)
msg="$1"
shift
@ -437,7 +437,7 @@ check_image()
local image
local tmp_output
tmp_output=$(mktemp --tmpdir btrfs-progs-test-check-image.XXXXXX)
tmp_output=$(mktemp --tmpdir btrfs-progs-check-image.XXXXXX)
image=$1
echo "testing image $(basename $image)" >> "$RESULTS"

View File

@ -113,7 +113,7 @@ convert_test_perm() {
_assert_path "$1"
PERMTMP="$1"
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert.fileslistXXXXXX)
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/test" "bs=$nodesize" \
count=1 status=noxfer >/dev/null 2>&1
@ -130,7 +130,7 @@ convert_test_perm() {
convert_test_acl() {
local ACLSTMP
ACLTMP="$1"
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert.fileslistXXXXXX)
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
run_check_stdout $SUDO_HELPER find "$TEST_MNT/acls" -type f -fprint "$FILES_LIST"
# Fix directory entries order
@ -158,7 +158,7 @@ convert_test_post_check_permissions() {
_assert_path "$1"
EXT_PERMTMP="$1"
BTRFS_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX)
BTRFS_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert-perms.XXXXXX)
convert_test_perm "$BTRFS_PERMTMP"
btrfs_perm=`md5sum "$BTRFS_PERMTMP" | cut -f1 -d' '`
@ -181,7 +181,7 @@ convert_test_post_check_acl() {
_assert_path "$1"
EXT_ACLTMP="$1"
BTRFS_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert.aclsXXXXXXX)
BTRFS_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert-acls.XXXXXXX)
convert_test_acl "$BTRFS_ACLTMP"
btrfs_acl=`md5sum "$BTRFS_ACLTMP" | cut -f1 -d' '`
@ -264,9 +264,9 @@ convert_test() {
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
convert_test_prep_fs "$fstype" "$@"
populate_fs
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
EXT_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX)
EXT_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert.aclsXXXXXXX)
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert-csums.XXXXXX)
EXT_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert-perms.XXXXXX)
EXT_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert-acls.XXXXXX)
convert_test_gen_checksums "$CHECKSUMTMP"
convert_test_perm "$EXT_PERMTMP"
convert_test_acl "$EXT_ACLTMP"

View File

@ -29,7 +29,7 @@ do_test() {
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
convert_test_prep_fs ext4 "$@"
populate_fs
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXX)
convert_test_gen_checksums "$CHECKSUMTMP"
run_check_umount_test_dev

View File

@ -32,7 +32,7 @@ do_test() {
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
convert_test_prep_fs reiserfs "$@"
populate_fs
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXX)
convert_test_gen_checksums "$CHECKSUMTMP"
run_check_umount_test_dev

View File

@ -29,7 +29,7 @@ run_check_stdout "$TOP/btrfs" inspect-internal dump-super -f "$image" \
|| _fail "btrfs inspect-internal dump-super no incompat COMPRESS_ZSTD"
# Create a temporary directory and restore the filesystem
restore_tmp=$(mktemp --tmpdir -d btrfs-progs-022-zstd-compression.XXXXXXXXXX)
restore_tmp=$(mktemp --tmpdir -d btrfs-progs-restore.XXXXXX)
run_check "$TOP/btrfs" restore "$image" "$restore_tmp"
# Expect 3 files

View File

@ -6,7 +6,7 @@ source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs
IMAGE=$(mktemp -u btrfs-XXXXXX.img)
IMAGE=$(mktemp -u btrfs-progs-image.XXXXXX)
run_check truncate -s3g "$IMAGE"
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$IMAGE"

View File

@ -10,7 +10,7 @@ check_prereq btrfs
prepare_test_dev
tmp=$(mktemp -d --tmpdir btrfs-progs-image.XXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-image.XXXXXX)
run_check_mkfs_test_dev
run_check "$TOP/btrfs-image" "$TEST_DEV" "$tmp/dump"

View File

@ -13,7 +13,7 @@ test_get_info()
{
local tmp_out
tmp_out=$(mktemp --tmpdir btrfs-progs-mkfs-tests-get-info.XXXXXX)
tmp_out=$(mktemp --tmpdir btrfs-progs-mkfs-get-info.XXXXXX)
run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dev1"
run_check $SUDO_HELPER "$TOP/btrfs" check "$dev1"

View File

@ -20,7 +20,7 @@ prepare_test_dev
check_global_prereq mknod
check_global_prereq dd
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
run_check mkdir "$tmp/dir"
run_check mkdir -p "$tmp/dir/in/dir"

View File

@ -7,9 +7,9 @@ source "$TEST_TOP/common"
check_prereq mkfs.btrfs
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
# we can't use TEST_DEV, a file is needed
img=$(mktemp btrfs-progs-mkfs.rootdirXXXXXXX)
img=$(mktemp btrfs-progs-mkfs-rootdir.XXXXXXX)
run_check "$TOP/mkfs.btrfs" -f --rootdir "$INTERNAL_BIN/Documentation/" "$img"
rm -rf -- "$img"

View File

@ -9,7 +9,7 @@ setup_root_helper
fs_size=$((512 * 1024 * 1024))
bs=$((1024 * 1024))
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
prepare_test_dev "$fs_size"

View File

@ -8,7 +8,7 @@ check_prereq mkfs.btrfs
prepare_test_dev
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
pagesize=$(getconf PAGESIZE)
create_file()

View File

@ -10,7 +10,7 @@ source "$TEST_TOP/common"
check_prereq mkfs.btrfs
prepare_test_dev
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
non_existing="/no/such/file$RANDOM$RANDOM"

View File

@ -15,7 +15,7 @@ prepare_test_dev
check_global_prereq mknod
check_global_prereq dd
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
run_check mkdir "$tmp/dir"
run_check mkdir -p "$tmp/dir/in/dir"

View File

@ -10,7 +10,7 @@ source "$TEST_TOP/common"
check_prereq mkfs.btrfs
prepare_test_dev
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs-rootdir.XXXXXX)
fallocate -l 128M $tmp/large_file