summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-11-11 08:40:21 +0100
committerDavid Sterba <dsterba@suse.com>2016-11-11 16:25:19 +0100
commit747146e23748095e46e2f3f023afc6310fb91c83 (patch)
tree7dedee60d99347940a116a052ee331d33d8f0ca7
parent8a44fd062ab24155e9438f72de75cd5eb2e3af58 (diff)
btrfs-progs: tests: add path assertions to post-checks
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--tests/common.convert30
1 files changed, 14 insertions, 16 deletions
diff --git a/tests/common.convert b/tests/common.convert
index 1b5217c3..0d22949c 100644
--- a/tests/common.convert
+++ b/tests/common.convert
@@ -130,17 +130,18 @@ convert_test_prep_fs() {
# generate md5 checksums of files on $TEST_MNT
# $1: path where the checksums will be stored
convert_test_gen_checksums() {
- local CHECKSUMTMP
- CHECKSUMTMP="$1"
+ _assert_path "$1"
run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/test bs=$nodesize \
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.
# $1: path where the permissions will be stored
convert_test_perm() {
local PERMTMP
+
+ _assert_path "$1"
PERMTMP="$1"
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert.fileslistXXXXXX)
@@ -185,6 +186,7 @@ convert_test_post_check_permissions() {
local EXT_PERMTMP
local BTRFS_PERMTMP
+ _assert_path "$1"
EXT_PERMTMP="$1"
BTRFS_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX)
convert_test_perm "$BTRFS_PERMTMP"
@@ -207,6 +209,7 @@ convert_test_post_check_acl() {
local EXT_ACLTMP
local BTRFS_ACLTMP
+ _assert_path "$1"
EXT_ACLTMP="$1"
BTRFS_ACLTMP=$(mktemp --tmpdir btrfs-progs-convert.aclsXXXXXXX)
convert_test_acl "$BTRFS_ACLTMP"
@@ -226,10 +229,8 @@ convert_test_post_check_acl() {
# post conversion checks, verify md5sums
convert_test_post_check_checksums() {
- local CHECKSUMTMP
-
- CHECKSUMTMP="$1"
- run_check_stdout $SUDO_HELPER md5sum -c "$CHECKSUMTMP" |
+ _assert_path "$1"
+ run_check_stdout $SUDO_HELPER md5sum -c "$1" |
grep -q 'FAILED' && _fail "file validation failed"
}
@@ -238,17 +239,14 @@ convert_test_post_check_checksums() {
# $2: file with permissions.
# $3: file with acl entries.
convert_test_post_checks_all() {
- local CHECKSUMTMP
- local EXT_PERMTMP
- local EXT_ACLTMP
+ _assert_path "$1"
+ _assert_path "$2"
+ _assert_path "$3"
- CHECKSUMTMP="$1"
- EXT_PERMTMP="$2"
- EXT_ACLTMP="$3"
run_check_mount_test_dev
- convert_test_post_check_checksums "$CHECKSUMTMP"
- convert_test_post_check_permissions "$EXT_PERMTMP"
- convert_test_post_check_acl "$EXT_ACLTMP"
+ convert_test_post_check_checksums "$1"
+ convert_test_post_check_permissions "$2"
+ convert_test_post_check_acl "$3"
run_check_umount_test_dev
}