2017-09-05 01:24:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Check if --rootdir can handle special files (socket/fifo/char/block) correctly
|
|
|
|
#
|
|
|
|
# --rootdir had a problem of filling dir items/indexes with wrong type
|
|
|
|
# and caused btrfs check to report such error
|
|
|
|
#
|
|
|
|
# Note: sock type is skipped in this test
|
|
|
|
|
2023-04-19 15:08:41 +00:00
|
|
|
source "$TEST_TOP/common" || exit
|
2017-09-05 01:24:15 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
|
|
|
|
|
|
|
setup_root_helper # For mknod
|
|
|
|
prepare_test_dev
|
|
|
|
|
|
|
|
# mknod can create FIFO/CHAR/BLOCK file but not SOCK.
|
|
|
|
# No neat tool to create socket file, unless using python or similar.
|
|
|
|
# So no SOCK is tested here
|
|
|
|
check_global_prereq mknod
|
|
|
|
check_global_prereq dd
|
|
|
|
|
2021-10-11 13:56:58 +00:00
|
|
|
tmp=$(_mktemp_dir mkfs-rootdir)
|
2017-09-05 01:24:15 +00:00
|
|
|
|
|
|
|
run_check mkdir "$tmp/dir"
|
|
|
|
run_check mkdir -p "$tmp/dir/in/dir"
|
|
|
|
run_check mknod "$tmp/fifo" p
|
|
|
|
run_check $SUDO_HELPER mknod "$tmp/char" c 1 1
|
|
|
|
run_check $SUDO_HELPER mknod "$tmp/block" b 1 1
|
|
|
|
run_check dd if=/dev/zero bs=1M count=1 of="$tmp/regular"
|
|
|
|
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev -r "$tmp"
|
2017-09-05 01:24:15 +00:00
|
|
|
|
|
|
|
rm -rf -- "$tmp"
|
|
|
|
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
|