2016-03-22 18:01:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# test label settings
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2016-03-22 18:01:39 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
|
|
|
|
|
|
|
setup_root_helper
|
|
|
|
|
2017-03-13 17:07:28 +00:00
|
|
|
prepare_test_dev
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev -L BTRFS-TEST-LABEL
|
2017-03-13 17:07:28 +00:00
|
|
|
run_check_mount_test_dev
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER chmod a+rw "$TEST_MNT"
|
2016-03-22 18:01:39 +00:00
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
cd "$TEST_MNT"
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT"
|
2016-03-22 18:01:39 +00:00
|
|
|
# shortest label
|
2018-03-23 15:34:30 +00:00
|
|
|
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" ''
|
2016-03-22 18:01:39 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT" "$longlabel"
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT"
|
2016-03-22 18:01:39 +00:00
|
|
|
# 256, must fail
|
|
|
|
run_mustfail "label 256 bytes long succeeded" \
|
2018-03-23 15:34:30 +00:00
|
|
|
$SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT" "$longlabel"5
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT"
|
2016-03-22 18:01:39 +00:00
|
|
|
run_mustfail "label 2 * 255 bytes long succeeded" \
|
2018-03-23 15:34:30 +00:00
|
|
|
$SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT" "$longlabel$longlabel"
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" filesystem label "$TEST_MNT"
|
2016-03-22 18:01:39 +00:00
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2017-03-13 17:07:28 +00:00
|
|
|
run_check_umount_test_dev
|