2 # Regression test for mkfs.btrfs --rootdir with dangling symlink (points to
3 # non-existing location)
5 # Since mkfs.btrfs --rootdir will just create symbolic link rather than
6 # follow it, we shouldn't hit any problem
8 source "$TEST_TOP/common"
10 check_prereq mkfs.btrfs
13 tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
15 non_existing="/no/such/file$RANDOM$RANDOM"
17 if [ -f "$non_existing" ]; then
18 _not_run "Some one created $non_existing, which is not expect to exist"
21 run_check ln -sf "$non_existing" "$tmp/foobar"
23 run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" "$TEST_DEV"
24 run_check "$TOP/btrfs" check "$TEST_DEV"