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>
master
David Sterba 2019-07-03 22:35:22 +02:00
parent 0528d89454
commit a66d9aa2e3
4 changed files with 16 additions and 16 deletions

View File

@ -16,12 +16,12 @@ opts="-j16 $@"
conf=
target=
function die() {
die() {
echo "ERROR: $@"
exit 1
}
function check_result() {
check_result() {
local ret
local str
@ -37,7 +37,7 @@ function check_result() {
$str"
}
function buildme() {
buildme() {
make clean-all
./autogen.sh && configure "$conf" || die "configure not working with: $@"
@ -47,7 +47,7 @@ function buildme() {
echo "VERDICT: $verdict"
}
function build_make_targets() {
build_make_targets() {
# defaults
target=
buildme

View File

@ -21,7 +21,7 @@ setup_root_helper
prepare_test_dev
# override common function
function check_image() {
check_image() {
TEST_DEV="$1"
run_check e2fsck -n -f "$TEST_DEV"
run_check "$TOP/btrfs-convert" "$TEST_DEV"

View File

@ -12,7 +12,7 @@ prepare_test_dev 260G
run_check_mkfs_test_dev
function check_corruption {
check_corruption() {
local sb_offset=$1
local source_sb=$2

View File

@ -10,21 +10,21 @@ check_prereq btrfs-image
setup_root_helper
prepare_test_dev
function read_fsid {
read_fsid() {
local dev="$1"
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
dump-super "$dev" | awk '/fsid/ {print $2}' | head -n 1)
}
function read_metadata_uuid {
read_metadata_uuid() {
local dev="$1"
echo $(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
dump-super "$dev" | awk '/metadata_uuid/ {print $2}')
}
function check_btrfstune {
check_btrfstune() {
local fsid
_log "Checking btrfstune logic"
@ -56,7 +56,7 @@ function check_btrfstune {
$SUDO_HELPER "$TOP/btrfstune" -u "$TEST_DEV"
}
function check_dump_super_output {
check_dump_super_output() {
local fsid
local metadata_uuid
local dev_item_match
@ -106,7 +106,7 @@ function check_dump_super_output {
[ $? -eq 1 ] || _fail "METADATA_UUID feature still shown as enabled"
}
function check_image_restore {
check_image_restore() {
local metadata_uuid
local fsid
local fsid_restored
@ -129,7 +129,7 @@ function check_image_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
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
"$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"
}
function check_completed {
check_completed() {
# check that metadata uuid is indeed completed
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super \
"$1" | grep -q METADATA_UUID
@ -151,12 +151,12 @@ function check_completed {
[ $? -eq 0 ] || _fail "metadata_uuid not set on $2"
}
function check_multi_fsid_change {
check_multi_fsid_change() {
check_inprogress_flag "$1" "$2"
check_completed "$1" "$2"
}
function failure_recovery {
failure_recovery() {
local image1
local image2
local loop1
@ -181,7 +181,7 @@ function failure_recovery {
rm -f -- "$image1" "$image2"
}
function reload_btrfs {
reload_btrfs() {
run_check $SUDO_HELPER rmmod btrfs
run_check $SUDO_HELPER modprobe btrfs
}