From d7477bcd0b714a984f83b78aa19a9785bf3c8039 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 22 Mar 2016 19:01:39 +0100 Subject: [PATCH] btrfs-progs: tests: add misc 014-filesystem-label Test various label lengths on a mounted filesystem. Signed-off-by: David Sterba --- tests/misc-tests/014-filesystem-label/test.sh | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 tests/misc-tests/014-filesystem-label/test.sh diff --git a/tests/misc-tests/014-filesystem-label/test.sh b/tests/misc-tests/014-filesystem-label/test.sh new file mode 100755 index 00000000..a5e08ccc --- /dev/null +++ b/tests/misc-tests/014-filesystem-label/test.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# test label settings + +source $TOP/tests/common + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper + +run_check truncate -s 2G $IMAGE +run_check $TOP/mkfs.btrfs -L BTRFS-TEST-LABEL -f $IMAGE +run_check $SUDO_HELPER mount $IMAGE $TEST_MNT +run_check $SUDO_HELPER chmod a+rw $TEST_MNT + +cd $TEST_MNT +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT +# shortest label +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT a +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT '' + +longlabel=\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +01234 + +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel" +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT +# 256, must fail +run_mustfail "label 256 bytes long succeeded" \ + $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel"5 +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT +run_mustfail "label 2 * 255 bytes long succeeded" \ + $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel$longlabel" +run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT + +cd .. + +run_check $SUDO_HELPER umount $TEST_MNT