diff options
author | Qu Wenruo <wqu@suse.com> | 2018-03-29 09:26:44 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-30 22:15:55 +0200 |
commit | 3f42d56fcbc6420cf47bed601542a776b1bc7ca2 (patch) | |
tree | d09eabdfd8b483098e07d153573de8b8d8dedd42 /tests/mkfs-tests | |
parent | 50417091a076a84ed06ea8d7158b749ece0d0914 (diff) |
btrfs-progs: tests: Test if mkfs.btrfs --rootdir can handle ng symlink
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/mkfs-tests')
-rwxr-xr-x | tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh b/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh new file mode 100755 index 00000000..39387ec7 --- /dev/null +++ b/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Regression test for mkfs.btrfs --rootdir with dangling symlink (points to +# non-existing location) +# +# Since mkfs.btrfs --rootdir will just create symbolic link rather than +# follow it, we shouldn't hit any problem + +source "$TEST_TOP/common" + +check_prereq mkfs.btrfs +prepare_test_dev + +tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX) + +non_existing="/no/such/file$RANDOM$RANDOM" + +if [ -f "$non_existing" ]; then + _not_run "Some one created $non_existing, which is not expect to exist" +fi + +run_check ln -sf "$non_existing" "$tmp/foobar" + +run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" "$TEST_DEV" +run_check "$TOP/btrfs" check "$TEST_DEV" + +rm -rf -- "$tmp" |