From: David Sterba Date: Mon, 25 Sep 2017 13:09:21 +0000 (+0200) Subject: btrfs-progs: tests: check there are no unprintable characters in btrfs-image -ss... X-Git-Tag: upstream/4.16.1~392 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5faec9843985b9e9324a2c562d22e111bcdd668a;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: tests: check there are no unprintable characters in btrfs-image -ss output Signed-off-by: David Sterba --- diff --git a/tests/misc-tests/026-image-non-printable-chars/test.sh b/tests/misc-tests/026-image-non-printable-chars/test.sh new file mode 100755 index 0000000..8018586 --- /dev/null +++ b/tests/misc-tests/026-image-non-printable-chars/test.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# check that sanitized names with matching crc do not contain unprintable +# characters, namely 0x7f + +source "$TOP/tests/common" + +check_prereq mkfs.btrfs +check_prereq btrfs + +prepare_test_dev + +run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV" +run_check_mount_test_dev +run_check $SUDO_HELPER chmod a+rw "$TEST_MNT" + +# known to produce char 0x7f == 127 +touch "$TEST_MNT/|5gp!" + +run_check_umount_test_dev + +run_check $SUDO_HELPER "$TOP/btrfs-image" -ss "$TEST_DEV" img +run_check $SUDO_HELPER "$TOP/btrfs-image" -r img img.restored +run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-tree img.restored > img.dump + +ch7f=$(echo -en '\x7f') +if grep -q "$ch7f" img.dump; then + _fail "found char 0x7f in the sanitized names" +fi + +rm -f -- img img.restored img.dump