btrfs-progs: tests: add path assertions to post-checks

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-11-11 08:40:21 +01:00
parent 8a44fd062a
commit 747146e237

View File

@ -130,17 +130,18 @@ convert_test_prep_fs() {
# generate md5 checksums of files on $TEST_MNT # generate md5 checksums of files on $TEST_MNT
# $1: path where the checksums will be stored # $1: path where the checksums will be stored
convert_test_gen_checksums() { convert_test_gen_checksums() {
local CHECKSUMTMP _assert_path "$1"
CHECKSUMTMP="$1"
run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/test bs=$nodesize \ run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/test bs=$nodesize \
count=1 >/dev/null 2>&1 count=1 >/dev/null 2>&1
run_check_stdout $SUDO_HELPER find $TEST_MNT -type f ! -name 'image' -exec md5sum {} \+ > "$CHECKSUMTMP" run_check_stdout $SUDO_HELPER find $TEST_MNT -type f ! -name 'image' -exec md5sum {} \+ > "$1"
} }
# list $TEST_MNT data set file permissions. # list $TEST_MNT data set file permissions.
# $1: path where the permissions will be stored # $1: path where the permissions will be stored
convert_test_perm() { convert_test_perm() {
local PERMTMP local PERMTMP
_assert_path "$1"
PERMTMP="$1" PERMTMP="$1"
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert.fileslistXXXXXX) FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert.fileslistXXXXXX)
@ -185,6 +186,7 @@ convert_test_post_check_permissions() {
local EXT_PERMTMP local EXT_PERMTMP
local BTRFS_PERMTMP local BTRFS_PERMTMP
_assert_path "$1"
EXT_PERMTMP="$1" EXT_PERMTMP="$1"
BTRFS_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX) BTRFS_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX)
convert_test_perm "$BTRFS_PERMTMP" convert_test_perm "$BTRFS_PERMTMP"
@ -207,6 +209,7 @@ convert_test_post_check_acl() {
local EXT_ACLTMP local EXT_ACLTMP
local BTRFS_ACLTMP local BTRFS_ACLTMP
_assert_path "$1"
EXT_ACLTMP="$1" EXT_ACLTMP="$1"
BTRFS_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert.aclsXXXXXXX) BTRFS_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert.aclsXXXXXXX)
convert_test_acl "$BTRFS_ACLTMP" convert_test_acl "$BTRFS_ACLTMP"
@ -226,10 +229,8 @@ convert_test_post_check_acl() {
# post conversion checks, verify md5sums # post conversion checks, verify md5sums
convert_test_post_check_checksums() { convert_test_post_check_checksums() {
local CHECKSUMTMP _assert_path "$1"
run_check_stdout $SUDO_HELPER md5sum -c "$1" |
CHECKSUMTMP="$1"
run_check_stdout $SUDO_HELPER md5sum -c "$CHECKSUMTMP" |
grep -q 'FAILED' && _fail "file validation failed" grep -q 'FAILED' && _fail "file validation failed"
} }
@ -238,17 +239,14 @@ convert_test_post_check_checksums() {
# $2: file with permissions. # $2: file with permissions.
# $3: file with acl entries. # $3: file with acl entries.
convert_test_post_checks_all() { convert_test_post_checks_all() {
local CHECKSUMTMP _assert_path "$1"
local EXT_PERMTMP _assert_path "$2"
local EXT_ACLTMP _assert_path "$3"
CHECKSUMTMP="$1"
EXT_PERMTMP="$2"
EXT_ACLTMP="$3"
run_check_mount_test_dev run_check_mount_test_dev
convert_test_post_check_checksums "$CHECKSUMTMP" convert_test_post_check_checksums "$1"
convert_test_post_check_permissions "$EXT_PERMTMP" convert_test_post_check_permissions "$2"
convert_test_post_check_acl "$EXT_ACLTMP" convert_test_post_check_acl "$3"
run_check_umount_test_dev run_check_umount_test_dev
} }