File: test.sh

package info (click to toggle)
btrfs-progs 6.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 20,596 kB
  • sloc: ansic: 127,198; sh: 7,836; python: 1,385; makefile: 900; asm: 296
file content (27 lines) | stat: -rwxr-xr-x 661 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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" || exit

check_prereq mkfs.btrfs

prepare_test_dev

tmp=$(_mktemp_dir mkfs-rootdir)

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"