2015-11-13 17:43:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# recognize partitioned loop devices
|
|
|
|
|
|
|
|
source $TOP/tests/common
|
|
|
|
|
2016-11-30 15:49:18 +00:00
|
|
|
if ! losetup --help | grep -q 'partscan'; then
|
|
|
|
_not_run "losetup --partscan not available"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2015-11-13 17:43:04 +00:00
|
|
|
check_prereq mkfs.btrfs
|
2016-01-12 14:16:11 +00:00
|
|
|
|
2015-11-13 17:43:04 +00:00
|
|
|
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
|
2016-11-18 14:02:50 +00:00
|
|
|
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $looppart
|
2015-11-13 17:43:04 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
run_check $SUDO_HELPER losetup -d $loopdev
|
|
|
|
run_check truncate -s0 img
|
2017-09-12 16:22:24 +00:00
|
|
|
rm img
|