iotests: Drop use of bash keyword 'function'
authorEric Blake <eblake@redhat.com>
Fri, 16 Nov 2018 21:50:02 +0000 (15:50 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 19 Nov 2018 17:16:46 +0000 (11:16 -0600)
Bash allows functions to be declared with or without the leading
keyword 'function'; but including the keyword does not comply with
POSIX syntax, and is confusing to ksh users where the use of the
keyword changes the scoping rules for functions.  Stick to the
POSIX form through iotests.

Done mechanically with:
  sed -i 's/^function //' $(git ls-files tests/qemu-iotests)

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181116215002.2124581-1-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
35 files changed:
tests/qemu-iotests/035
tests/qemu-iotests/037
tests/qemu-iotests/038
tests/qemu-iotests/046
tests/qemu-iotests/047
tests/qemu-iotests/049
tests/qemu-iotests/051
tests/qemu-iotests/067
tests/qemu-iotests/071
tests/qemu-iotests/077
tests/qemu-iotests/081
tests/qemu-iotests/082
tests/qemu-iotests/085
tests/qemu-iotests/086
tests/qemu-iotests/087
tests/qemu-iotests/099
tests/qemu-iotests/109
tests/qemu-iotests/112
tests/qemu-iotests/142
tests/qemu-iotests/153
tests/qemu-iotests/157
tests/qemu-iotests/172
tests/qemu-iotests/176
tests/qemu-iotests/177
tests/qemu-iotests/184
tests/qemu-iotests/186
tests/qemu-iotests/195
tests/qemu-iotests/204
tests/qemu-iotests/223
tests/qemu-iotests/227
tests/qemu-iotests/232
tests/qemu-iotests/common.nbd
tests/qemu-iotests/common.pattern
tests/qemu-iotests/common.qemu
tests/qemu-iotests/common.tls

index a5716caf327461fa5c306427c08df80c08780fb5..85d9ef7f8e197f679ed386315c4643a6b2437dd1 100755 (executable)
@@ -49,7 +49,7 @@ echo
 echo "creating image"
 _make_test_img $size
 
-function generate_requests() {
+generate_requests() {
     for i in $(seq 0 63); do
         echo "aio_write ${i}M 512"
         echo "aio_write ${i}M 512"
index 2e43b19ed04a65d1c834148abee395a065012c0e..a11992dad20d3e8b555f536e744015cb0fffbc6f 100755 (executable)
@@ -54,7 +54,7 @@ TEST_IMG="$TEST_IMG.base"
 
 _make_test_img $size
 
-function backing_io()
+backing_io()
 {
     local offset=$1
     local sectors=$2
index 4e03976023df0f7fc9583ebcac8f138fc9fe4bce..575093e8cfd35a6e8500b23cb949890eeb3c329e 100755 (executable)
@@ -51,7 +51,7 @@ TEST_IMG="$TEST_IMG.base"
 
 _make_test_img $size
 
-function backing_io()
+backing_io()
 {
     local offset=$1
     local sectors=$2
@@ -76,7 +76,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
 echo
 echo "== Some concurrent requests touching the same cluster =="
 
-function overlay_io()
+overlay_io()
 {
     # Start with a request touching two clusters
     echo aio_write -P 0x80 2020k 80k
@@ -102,7 +102,7 @@ overlay_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io |\
 echo
 echo "== Verify image content =="
 
-function verify_io()
+verify_io()
 {
     echo read -P 31 2016k 4k
     echo read -P 0x80 2020k 80k
index 01c0de62d822c0f395e1e5df697614d087d0923d..5e41d96daa10056be287ec3a59317ac5dea664e1 100755 (executable)
@@ -48,7 +48,7 @@ echo "== creating backing file for COW tests =="
 
 _make_test_img $size
 
-function backing_io()
+backing_io()
 {
     local offset=$1
     local sectors=$2
@@ -73,7 +73,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
 echo
 echo "== Some concurrent requests touching the same cluster =="
 
-function overlay_io()
+overlay_io()
 {
 # Allocate middle of cluster 1, then write to somewhere before and after it
 cat  <<EOF
@@ -189,7 +189,7 @@ overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
 echo
 echo "== Verify image content =="
 
-function verify_io()
+verify_io()
 {
     if ($QEMU_IMG info -U -f "$IMGFMT" "$TEST_IMG" | grep "compat: 0.10" > /dev/null); then
         # For v2 images, discarded clusters are read from the backing file
index c168373cf0ff200b5687f72bcce66bd033f2a7ea..6e776d2ce5c7927cae3bf0396e0a454f9877d6d8 100755 (executable)
@@ -45,7 +45,7 @@ size=128M
 
 _make_test_img $size
 
-function qemu_io_cmds()
+qemu_io_cmds()
 {
 cat <<EOF
 write -P 0x66 0 320k
index 4d0ad5cd50c632f8c8c279808ede6b8aacc26c38..97d8a64697a6fdf0bf0ebd2458b6a6a81d19ec2b 100755 (executable)
@@ -40,13 +40,13 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 
-function filter_test_dir()
+filter_test_dir()
 {
     sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g"
 }
 
-function test_qemu_img()
+test_qemu_img()
 {
     echo qemu-img "$@" | filter_test_dir
     $QEMU_IMG "$@" 2>&1 | filter_test_dir
index a676da827349dc4579de3982100965a765b5ef0f..32741d7efdf21603786ff616ed3ee48eb4fc3fd2 100755 (executable)
@@ -43,7 +43,7 @@ _supported_os Linux
 # other than refcount_bits=16
 _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     (
@@ -57,7 +57,7 @@ function do_run_qemu()
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu |
         _filter_generated_node_ids | _filter_hmp
index f8d584f4873d669860cded720d3dfa2bac722ed9..342b2b0a309e0b68fe0da673f37cea1fadbfa3c3 100755 (executable)
@@ -36,7 +36,7 @@ _supported_os Linux
 # Because anything other than 16 would change the output of query-block
 _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     $QEMU -nographic -qmp-pretty stdio -serial none "$@"
@@ -52,7 +52,7 @@ _filter_qmp_events()
        | tr '\t' '\n'
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
                           | _filter_actual_image_size \
index 6448e9e75bcc17bf00faa14c3540b9598d0eb2f0..6e467dc1da1aac7fad94ccc7ca05eb1d11678bf4 100755 (executable)
@@ -40,14 +40,14 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@" | _filter_imgfmt
     $QEMU -nographic -qmp stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | _filter_qemu_io
 }
index a40f319d371fb262fd7a1fc4f52d63c66a09ceda..58fe8932b3047cfe81b199d11cb7d9c820147254 100755 (executable)
@@ -48,7 +48,7 @@ _make_test_img $size
 echo
 echo "== Some concurrent requests involving RMW =="
 
-function test_io()
+test_io()
 {
 echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
 # A simple RMW request
@@ -193,7 +193,7 @@ test_io | $QEMU_IO  | _filter_qemu_io | \
 echo
 echo "== Verify image content =="
 
-function verify_io()
+verify_io()
 {
     # A simple RMW request
     echo read -P 0       0 0x200
index ccb6becaef0a79954ccfd0ed1599ce954bee19ef..edf6e6172aa412a54c1fa067b25e031d7de07053 100755 (executable)
@@ -42,14 +42,14 @@ _supported_fmt raw
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@" | _filter_imgfmt
     $QEMU -nographic -qmp stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
                           | _filter_qemu_io | _filter_generated_node_ids
index 14f6631071d8dadc48dc751dbb5f937b049e9feb..61eec63797c39573c9056e37a3c8a088ec843247 100755 (executable)
@@ -40,7 +40,7 @@ _supported_fmt qcow2
 _supported_proto file nfs
 _supported_os Linux
 
-function run_qemu_img()
+run_qemu_img()
 {
     echo
     echo Testing: "$@" | _filter_testdir
index 2ef84077b8f8c2d0f3b1128b897b3ef8035b3718..ade68ef853b4424fa321317cf79e426710f69b56 100755 (executable)
@@ -60,7 +60,7 @@ _supported_os Linux
 
 
 # ${1}: unique identifier for the snapshot filename
-function create_single_snapshot()
+create_single_snapshot()
 {
     cmd="{ 'execute': 'blockdev-snapshot-sync',
                       'arguments': { 'device': 'virtio0',
@@ -70,7 +70,7 @@ function create_single_snapshot()
 }
 
 # ${1}: unique identifier for the snapshot filename
-function create_group_snapshot()
+create_group_snapshot()
 {
     cmd="{ 'execute': 'transaction', 'arguments':
            {'actions': [
@@ -88,7 +88,7 @@ function create_group_snapshot()
 # ${1}: unique identifier for the snapshot filename
 # ${2}: extra_params to the blockdev-add command
 # ${3}: filename
-function do_blockdev_add()
+do_blockdev_add()
 {
     cmd="{ 'execute': 'blockdev-add', 'arguments':
            { 'driver': 'qcow2', 'node-name': 'snap_${1}', ${2}
@@ -99,7 +99,7 @@ function do_blockdev_add()
 }
 
 # ${1}: unique identifier for the snapshot filename
-function add_snapshot_image()
+add_snapshot_image()
 {
     base_image="${TEST_DIR}/$((${1}-1))-${snapshot_virt0}"
     snapshot_file="${TEST_DIR}/${1}-${snapshot_virt0}"
@@ -110,7 +110,7 @@ function add_snapshot_image()
 
 # ${1}: unique identifier for the snapshot filename
 # ${2}: expected response, defaults to 'return'
-function blockdev_snapshot()
+blockdev_snapshot()
 {
     cmd="{ 'execute': 'blockdev-snapshot',
                       'arguments': { 'node': 'virtio0',
index 971de7dc35531b8528f97a94f521995735549f31..3cca3687ea8ca9771afc999a43a847031194a36b 100755 (executable)
@@ -40,7 +40,7 @@ _supported_fmt qcow2 raw
 _supported_proto file
 _supported_os Linux
 
-function run_qemu_img()
+run_qemu_img()
 {
     echo
     echo Testing: "$@" | _filter_testdir
index 109cdf5ea43d35d5b01156e15ef569c4a5504134..f625887082220e5b32584940c02677463467d4f6 100755 (executable)
@@ -34,14 +34,14 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     $QEMU -nographic -qmp stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
                           | _filter_qemu | _filter_imgfmt \
@@ -102,7 +102,7 @@ echo === aio=native without O_DIRECT ===
 echo
 
 # Skip this test if AIO is not enabled in this build
-function run_qemu_filter_aio()
+run_qemu_filter_aio()
 {
     run_qemu "$@" | \
         sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
index 4a6275d4bca8b3d2a76377920aaf2a30226bf8ab..578808b747495b80ca25118c503ea76557816d9a 100755 (executable)
@@ -45,12 +45,12 @@ _supported_os Linux
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
     "subformat=twoGbMaxExtentSparse"
 
-function do_run_qemu()
+do_run_qemu()
 {
     $QEMU -nographic -qmp stdio -serial none "$@"
 }
 
-function run_qemu()
+run_qemu()
 {
     # Get the "file": "foo" entry ($foo may only contain escaped double quotes,
     # which is how we can extract it)
@@ -59,7 +59,7 @@ function run_qemu()
         | sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
 }
 
-function test_qemu()
+test_qemu()
 {
     run_qemu -drive "if=none,id=drv0,$1" <<EOF
         { 'execute': 'qmp_capabilities' }
index 90bdae459b8a9156d93c31d0ad7b88d4e30dc709..b51e4616c674653ecccae1165d8e468b6c8e4d28 100755 (executable)
@@ -45,7 +45,7 @@ _supported_os Linux
 
 qemu_comm_method=qmp
 
-function run_qemu()
+run_qemu()
 {
     local raw_img="$1"
     local source_img="$2"
index fba2965322d9983b6b75fc2f4dfdff7a74411a30..d67e6ebe9cfafc92d5b1f781fc4a63a1beb3f81f 100755 (executable)
@@ -44,7 +44,7 @@ _supported_os Linux
 # manual setting; compat will be overridden as well
 _unsupported_imgopts refcount_bits 'compat=0.10'
 
-function print_refcount_bits()
+print_refcount_bits()
 {
     $QEMU_IMG info "$TEST_IMG" | sed -n '/refcount bits:/ s/^ *//p'
 }
index c7c360d11b5d32689775a3ba9c0efe3b2bb9b05b..5fc488f5d23f54948e35d950ddfdbe6f3e16b921 100755 (executable)
@@ -45,7 +45,7 @@ _supported_os Linux
 _default_cache_mode none
 _supported_cache_modes none directsync
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     (
@@ -59,7 +59,7 @@ function do_run_qemu()
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
 }
@@ -88,7 +88,7 @@ echo
 files="if=none,file=$TEST_IMG,backing.file.filename=$TEST_IMG.base"
 ids="node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file"
 
-function check_cache_all()
+check_cache_all()
 {
     # cache.direct is supposed to be inherited by both bs->file and
     # bs->backing
@@ -231,7 +231,7 @@ drv_bk="if=none,file=json:{'driver':'$IMGFMT',,'file':'backing-file',,'node-name
 drv_file="if=none,driver=file,filename=$TEST_IMG,node-name=file"
 drv_img="if=none,id=blk,file=json:{'driver':'$IMGFMT',,'file':'file',,'backing':'backing',,'node-name':'image'}"
 
-function check_cache_all_separate()
+check_cache_all_separate()
 {
     # Check cache.direct
 
index 00092b84b9f4d39cce7e50829d5ba8830956dd77..3120a61da472b9ebc56157762e0d7e45d904ba7f 100755 (executable)
@@ -70,7 +70,7 @@ _run_cmd()
     (echo "$@"; "$@" 2>&1 1>/dev/null) | _filter_testdir
 }
 
-function _do_run_qemu()
+_do_run_qemu()
 {
     (
         if ! test -t 0; then
@@ -82,7 +82,7 @@ function _do_run_qemu()
     ) | $QEMU -nographic -monitor stdio -serial none "$@" 1>/dev/null
 }
 
-function _run_qemu_with_images()
+_run_qemu_with_images()
 {
     _do_run_qemu \
         $(for i in $@; do echo "-drive if=none,file=$i"; done) 2>&1 \
index c3231b787a1359cbc4430301b15d53f98a33d55d..6fb26596ada093c3ed8072a767350d0b786ac53e 100755 (executable)
@@ -40,7 +40,7 @@ _supported_fmt generic
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     (
         if ! test -t 0; then
@@ -53,7 +53,7 @@ function do_run_qemu()
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt \
                           | _filter_qemu | _filter_generated_node_ids
index c5ee33ee81b69edefbe8c6ec6ad4e3a765d2b5ca..1e60a7e3d68192cefd8c2b921a20e5bff2a4f329 100755 (executable)
@@ -46,7 +46,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
     _notrun "Requires a PC machine"
 fi
 
-function do_run_qemu()
+do_run_qemu()
 {
     (
         if ! test -t 0; then
@@ -59,7 +59,7 @@ function do_run_qemu()
     echo
 }
 
-function check_floppy_qtree()
+check_floppy_qtree()
 {
     echo
     echo Testing: "$@" | _filter_testdir
@@ -75,7 +75,7 @@ function check_floppy_qtree()
     _filter_win32 | _filter_qemu
 }
 
-function check_cache_mode()
+check_cache_mode()
 {
     echo "info block none0" |
     QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
index c091d0bd1e03f6808d3e7437c65f63e2f370317a..4ecd5894a392fe97ba48007fb7487a7d14ea03b6 100755 (executable)
@@ -50,7 +50,7 @@ _supported_os Linux
 # Persistent dirty bitmaps require compat=1.1
 _unsupported_imgopts 'compat=0.10'
 
-function run_qemu()
+run_qemu()
 {
     $QEMU -nographic -qmp stdio -serial none "$@" 2>&1 \
        | _filter_testdir | _filter_qmp | _filter_qemu \
index 7bf8e1daf39452e5bb0a2b5df421c7e8cdf6aa36..f0c1155e8077c156e1c6bee7dee304d7c7cc783a 100755 (executable)
@@ -85,7 +85,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
 echo
 echo "== verify image content =="
 
-function verify_io()
+verify_io()
 {
     if ($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" |
            grep "compat: 0.10" > /dev/null); then
index 2f3259d5587781563f4f72c29623a584deee9660..0af7a73aca13a06d50e927ff81ac081c80058494 100755 (executable)
@@ -34,14 +34,14 @@ trap "exit \$status" 0 1 2 3 15
 
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@" | _filter_imgfmt
     $QEMU -nographic -qmp-pretty stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
                           | _filter_qemu_io | _filter_generated_node_ids \
index 29681bf45c63e06905ca09d0199acbcaa9ea4261..c27dc953b6f52a639ecc1704b77ba0fe226c72c4 100755 (executable)
@@ -44,7 +44,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
     _notrun "Requires a PC machine"
 fi
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
 
@@ -59,7 +59,7 @@ function do_run_qemu()
     echo
 }
 
-function check_info_block()
+check_info_block()
 {
     echo "info block" |
     do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
index f56f2557153d9ae990c9f72756005ab4b9740d5a..a977c9798e3a5a222b9247cf3a6d5be1da56f38d 100755 (executable)
@@ -41,14 +41,14 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     $QEMU -nographic -qmp-pretty stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qemu \
                           | _filter_qmp | _filter_qemu_io \
index 57f3afe1d73e3e8c95b3f6f4bb84e997da3f352b..30f0653ce973f2b3eb65b5730d5ed4909de87585 100755 (executable)
@@ -93,7 +93,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
 echo
 echo "== verify image content =="
 
-function verify_io()
+verify_io()
 {
     echo read -P 22 0 1000
     echo read -P 33 1000 128k
index 58a3f3ff408cebbdd273d2200420ded83421c619..72419e03388f40ecaa7921c2546dbf2350e3981a 100755 (executable)
@@ -42,14 +42,14 @@ _supported_os Linux
 # Persistent dirty bitmaps require compat=1.1
 _unsupported_imgopts 'compat=0.10'
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     $QEMU -nographic -qmp stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
                           | _filter_qemu | _filter_imgfmt \
index 43f2323ff2c5f14530b32bfb94b97406a7364772..be1b636af06612c017237f6bd28e7f1183c0c7f6 100755 (executable)
@@ -40,14 +40,14 @@ _supported_fmt generic
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     $QEMU -nographic -qmp-pretty stdio -serial none "$@"
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
                           | _filter_qemu | _filter_imgfmt \
index b125e54093d73126e46974a16afe16d7475ad216..0708b8b155e73ec2471c4a18a7b4a6ecfdc561f7 100755 (executable)
@@ -41,7 +41,7 @@ _supported_fmt generic
 _supported_proto file
 _supported_os Linux
 
-function do_run_qemu()
+do_run_qemu()
 {
     echo Testing: "$@"
     (
@@ -55,13 +55,13 @@ function do_run_qemu()
     echo
 }
 
-function run_qemu()
+run_qemu()
 {
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
         _filter_generated_node_ids | _filter_imgfmt
 }
 
-function run_qemu_info_block()
+run_qemu_info_block()
 {
     echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG"
 }
index 0f4497a7ea5304ffb5e31d59eee41c7b1e466213..233187a25ccf6e141605b57f3d87e2bfa3bd1212 100644 (file)
@@ -23,7 +23,7 @@ nbd_unix_socket="${TEST_DIR}/qemu-nbd.sock"
 nbd_tcp_addr="127.0.0.1"
 nbd_pid_file="${TEST_DIR}/qemu-nbd.pid"
 
-function nbd_server_stop()
+nbd_server_stop()
 {
     local NBD_PID
     if [ -f "$nbd_pid_file" ]; then
@@ -36,7 +36,7 @@ function nbd_server_stop()
     rm -f "$nbd_unix_socket"
 }
 
-function nbd_server_wait_for_unix_socket()
+nbd_server_wait_for_unix_socket()
 {
     pid=$1
 
@@ -57,14 +57,14 @@ function nbd_server_wait_for_unix_socket()
     exit 1
 }
 
-function nbd_server_start_unix_socket()
+nbd_server_start_unix_socket()
 {
     nbd_server_stop
     $QEMU_NBD -v -t -k "$nbd_unix_socket" "$@" &
     nbd_server_wait_for_unix_socket $!
 }
 
-function nbd_server_set_tcp_port()
+nbd_server_set_tcp_port()
 {
     (ss --help) >/dev/null 2>&1 || _notrun "ss utility not found, skipping test"
 
@@ -80,7 +80,7 @@ function nbd_server_set_tcp_port()
     exit 1
 }
 
-function nbd_server_wait_for_tcp_socket()
+nbd_server_wait_for_tcp_socket()
 {
     pid=$1
 
@@ -101,7 +101,7 @@ function nbd_server_wait_for_tcp_socket()
     exit 1
 }
 
-function nbd_server_start_tcp_socket()
+nbd_server_start_tcp_socket()
 {
     nbd_server_stop
     $QEMU_NBD -v -t -b $nbd_tcp_addr -p $nbd_tcp_port "$@" &
index 34f4a8dc9b464e538ffa94f53a45f894b02e6f65..b67bb3413607e5315ed3a5f6e5edf1c5f48abd79 100644 (file)
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-function do_is_allocated() {
+do_is_allocated() {
     local start=$1
     local size=$2
     local step=$3
@@ -27,11 +27,11 @@ function do_is_allocated() {
     done
 }
 
-function is_allocated() {
+is_allocated() {
     do_is_allocated "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 }
 
-function do_io() {
+do_io() {
     local op=$1
     local start=$2
     local size=$3
@@ -45,22 +45,22 @@ function do_io() {
     done
 }
 
-function io_pattern() {
+io_pattern() {
     do_io "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 }
 
-function io() {
+io() {
     local start=$2
     local pattern=$(( (start >> 9) % 256 ))
 
     do_io "$@" $pattern | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 }
 
-function io_zero() {
+io_zero() {
     do_io "$@" 0 | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 }
 
-function io_test() {
+io_test() {
     local op=$1
     local offset=$2
     local cluster_size=$3
@@ -100,7 +100,7 @@ function io_test() {
     offset=$((offset + num_large * ( l2_size + half_cluster )))
 }
 
-function io_test2() {
+io_test2() {
     local orig_offset=$1
     local cluster_size=$2
     local num=$3
index dadde2a266c16e96bd4f2f611b0ee4264c9f077d..7c87b897fa3da10ad5136aad76c11fec8d65cbd5 100644 (file)
@@ -60,7 +60,7 @@ _in_fd=4
 # $3: A string to search for in the response; if found, this indicates
 #     failure and the test is either aborted (if $qemu_error_no_exit
 #     is not set) or ${QEMU_STATUS[$1]} is set to -1 (otherwise).
-function _timed_wait_for()
+_timed_wait_for()
 {
     local h=${1}
     shift
@@ -131,7 +131,7 @@ function _timed_wait_for()
 # strings the response will be scanned for.  The first of the two
 # indicates success, the latter indicates failure.  Failure is handled
 # like a timeout.
-function _send_qemu_cmd()
+_send_qemu_cmd()
 {
     local h=${1}
     local count=1
@@ -186,7 +186,7 @@ function _send_qemu_cmd()
 # Returns:
 # $QEMU_HANDLE: set to a handle value to communicate with this QEMU instance.
 #
-function _launch_qemu()
+_launch_qemu()
 {
     local comm=
     local fifo_out=
@@ -262,7 +262,7 @@ function _launch_qemu()
 # If $wait is set to anything other than the empty string, the process will not
 # be killed but only waited for, and any output will be forwarded to stdout. If
 # $wait is empty, the process will be killed and all output will be suppressed.
-function _cleanup_qemu()
+_cleanup_qemu()
 {
     # QEMU_PID[], QEMU_IN[], QEMU_OUT[] all use same indices
     for i in "${!QEMU_OUT[@]}"
index cecab269ec6b89002ab51d86e69539e905ee83ba..39f17c1b999fff49632851d84883681793dd724a 100644 (file)
@@ -20,7 +20,7 @@
 
 tls_dir="${TEST_DIR}/tls"
 
-function tls_x509_cleanup()
+tls_x509_cleanup()
 {
     rm -f "${tls_dir}"/*.pem
     rm -f "${tls_dir}"/*/*.pem
@@ -29,7 +29,7 @@ function tls_x509_cleanup()
 }
 
 
-function tls_x509_init()
+tls_x509_init()
 {
     mkdir -p "${tls_dir}"
 
@@ -58,7 +58,7 @@ EOF
 }
 
 
-function tls_x509_create_root_ca()
+tls_x509_create_root_ca()
 {
     name=${1:-ca-cert}
 
@@ -77,7 +77,7 @@ EOF
 }
 
 
-function tls_x509_create_server()
+tls_x509_create_server()
 {
     caname=$1
     name=$2
@@ -108,7 +108,7 @@ EOF
 }
 
 
-function tls_x509_create_client()
+tls_x509_create_client()
 {
     caname=$1
     name=$2