btrfs-progs: tests: drop keyword function
The shell keyword function is not necessary and not used in many tests, remove it from the few places that use it right now. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0528d89454
commit
a66d9aa2e3
|
@ -16,12 +16,12 @@ opts="-j16 $@"
|
||||||
conf=
|
conf=
|
||||||
target=
|
target=
|
||||||
|
|
||||||
function die() {
|
die() {
|
||||||
echo "ERROR: $@"
|
echo "ERROR: $@"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_result() {
|
check_result() {
|
||||||
local ret
|
local ret
|
||||||
local str
|
local str
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ function check_result() {
|
||||||
$str"
|
$str"
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildme() {
|
buildme() {
|
||||||
make clean-all
|
make clean-all
|
||||||
|
|
||||||
./autogen.sh && configure "$conf" || die "configure not working with: $@"
|
./autogen.sh && configure "$conf" || die "configure not working with: $@"
|
||||||
|
@ -47,7 +47,7 @@ function buildme() {
|
||||||
echo "VERDICT: $verdict"
|
echo "VERDICT: $verdict"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_make_targets() {
|
build_make_targets() {
|
||||||
# defaults
|
# defaults
|
||||||
target=
|
target=
|
||||||
buildme
|
buildme
|
||||||
|
|
|
@ -21,7 +21,7 @@ setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
|
||||||
# override common function
|
# override common function
|
||||||
function check_image() {
|
check_image() {
|
||||||
TEST_DEV="$1"
|
TEST_DEV="$1"
|
||||||
run_check e2fsck -n -f "$TEST_DEV"
|
run_check e2fsck -n -f "$TEST_DEV"
|
||||||
run_check "$TOP/btrfs-convert" "$TEST_DEV"
|
run_check "$TOP/btrfs-convert" "$TEST_DEV"
|
||||||
|
|
|
@ -12,7 +12,7 @@ prepare_test_dev 260G
|
||||||
|
|
||||||
run_check_mkfs_test_dev
|
run_check_mkfs_test_dev
|
||||||
|
|
||||||
function check_corruption {
|
check_corruption() {
|
||||||
local sb_offset=$1
|
local sb_offset=$1
|
||||||
local source_sb=$2
|
local source_sb=$2
|
||||||
|
|
||||||
|
|
|
@ -10,21 +10,21 @@ check_prereq btrfs-image
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
|
||||||
function read_fsid {
|
read_fsid() {
|
||||||
local dev="$1"
|
local dev="$1"
|
||||||
|
|
||||||
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
|
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
|
||||||
dump-super "$dev" | awk '/fsid/ {print $2}' | head -n 1)
|
dump-super "$dev" | awk '/fsid/ {print $2}' | head -n 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_metadata_uuid {
|
read_metadata_uuid() {
|
||||||
local dev="$1"
|
local dev="$1"
|
||||||
|
|
||||||
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
|
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
|
||||||
dump-super "$dev" | awk '/metadata_uuid/ {print $2}')
|
dump-super "$dev" | awk '/metadata_uuid/ {print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_btrfstune {
|
check_btrfstune() {
|
||||||
local fsid
|
local fsid
|
||||||
|
|
||||||
_log "Checking btrfstune logic"
|
_log "Checking btrfstune logic"
|
||||||
|
@ -56,7 +56,7 @@ function check_btrfstune {
|
||||||
$SUDO_HELPER "$TOP/btrfstune" -u "$TEST_DEV"
|
$SUDO_HELPER "$TOP/btrfstune" -u "$TEST_DEV"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_dump_super_output {
|
check_dump_super_output() {
|
||||||
local fsid
|
local fsid
|
||||||
local metadata_uuid
|
local metadata_uuid
|
||||||
local dev_item_match
|
local dev_item_match
|
||||||
|
@ -106,7 +106,7 @@ function check_dump_super_output {
|
||||||
[ $? -eq 1 ] || _fail "METADATA_UUID feature still shown as enabled"
|
[ $? -eq 1 ] || _fail "METADATA_UUID feature still shown as enabled"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_image_restore {
|
check_image_restore() {
|
||||||
local metadata_uuid
|
local metadata_uuid
|
||||||
local fsid
|
local fsid
|
||||||
local fsid_restored
|
local fsid_restored
|
||||||
|
@ -129,7 +129,7 @@ function check_image_restore {
|
||||||
[ "$metadata_uuid" = "$metadata_uuid_restored" ] || _fail "metadata_uuids don't match after restore"
|
[ "$metadata_uuid" = "$metadata_uuid_restored" ] || _fail "metadata_uuids don't match after restore"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_inprogress_flag {
|
check_inprogress_flag() {
|
||||||
# check the flag is indeed cleared
|
# check the flag is indeed cleared
|
||||||
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
|
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
|
||||||
"$1" | grep -q 0x1000000001
|
"$1" | grep -q 0x1000000001
|
||||||
|
@ -140,7 +140,7 @@ function check_inprogress_flag {
|
||||||
[ $? -eq 1 ] || _fail "Found BTRFS_SUPER_FLAG_CHANGING_FSID_V2 set for $2"
|
[ $? -eq 1 ] || _fail "Found BTRFS_SUPER_FLAG_CHANGING_FSID_V2 set for $2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_completed {
|
check_completed() {
|
||||||
# check that metadata uuid is indeed completed
|
# check that metadata uuid is indeed completed
|
||||||
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
|
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
|
||||||
"$1" | grep -q METADATA_UUID
|
"$1" | grep -q METADATA_UUID
|
||||||
|
@ -151,12 +151,12 @@ function check_completed {
|
||||||
[ $? -eq 0 ] || _fail "metadata_uuid not set on $2"
|
[ $? -eq 0 ] || _fail "metadata_uuid not set on $2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_multi_fsid_change {
|
check_multi_fsid_change() {
|
||||||
check_inprogress_flag "$1" "$2"
|
check_inprogress_flag "$1" "$2"
|
||||||
check_completed "$1" "$2"
|
check_completed "$1" "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function failure_recovery {
|
failure_recovery() {
|
||||||
local image1
|
local image1
|
||||||
local image2
|
local image2
|
||||||
local loop1
|
local loop1
|
||||||
|
@ -181,7 +181,7 @@ function failure_recovery {
|
||||||
rm -f -- "$image1" "$image2"
|
rm -f -- "$image1" "$image2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload_btrfs {
|
reload_btrfs() {
|
||||||
run_check $SUDO_HELPER rmmod btrfs
|
run_check $SUDO_HELPER rmmod btrfs
|
||||||
run_check $SUDO_HELPER modprobe btrfs
|
run_check $SUDO_HELPER modprobe btrfs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue