mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-14 17:50:58 +00:00
cebf3b3722
Use TEST_TOP as base for tests to reference any files, this will be used for git and external testsuite. INTERNAL_BIN is needed for referencing binaries that could reside in different paths in git vs external testsuite. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ add quotes around sourced files, update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
33 lines
724 B
Bash
Executable File
33 lines
724 B
Bash
Executable File
#!/bin/bash
|
|
# recognize partitioned loop devices
|
|
|
|
source "$TEST_TOP/common"
|
|
|
|
if ! losetup --help | grep -q 'partscan'; then
|
|
_not_run "losetup --partscan not available"
|
|
exit 0
|
|
fi
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
setup_root_helper
|
|
|
|
run_check truncate -s0 img
|
|
chmod a+w img
|
|
cp partition-1g-1g img
|
|
run_check truncate -s2g img
|
|
|
|
loopdev=$(run_check_stdout $SUDO_HELPER losetup --partscan --find --show img)
|
|
base=$(basename $loopdev)
|
|
|
|
# expect partitions named like loop0p1 etc
|
|
for looppart in $(ls /dev/$base?*); do
|
|
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $looppart
|
|
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $looppart
|
|
done
|
|
|
|
# cleanup
|
|
run_check $SUDO_HELPER losetup -d $loopdev
|
|
run_check truncate -s0 img
|
|
rm img
|