From a66d9aa2e3dd398498f32b5269463ef960b51bac Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 3 Jul 2019 22:35:22 +0200 Subject: [PATCH] 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 --- tests/build-tests.sh | 8 ++++---- .../004-ext2-backup-superblock-ranges/test.sh | 2 +- .../misc-tests/028-superblock-recover/test.sh | 2 +- tests/misc-tests/034-metadata-uuid/test.sh | 20 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/build-tests.sh b/tests/build-tests.sh index cb718a42..2b9d0bb3 100755 --- a/tests/build-tests.sh +++ b/tests/build-tests.sh @@ -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 diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh index dcb9772b..857e2408 100755 --- a/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh +++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh @@ -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" diff --git a/tests/misc-tests/028-superblock-recover/test.sh b/tests/misc-tests/028-superblock-recover/test.sh index 26e4dcbf..36072ec6 100755 --- a/tests/misc-tests/028-superblock-recover/test.sh +++ b/tests/misc-tests/028-superblock-recover/test.sh @@ -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 diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh index 9c82e446..a99c14ff 100755 --- a/tests/misc-tests/034-metadata-uuid/test.sh +++ b/tests/misc-tests/034-metadata-uuid/test.sh @@ -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 }