]> sourceware.org Git - lvm2.git/commitdiff
tests: aux.sh separately assign
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 29 Jun 2017 10:07:34 +0000 (12:07 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 29 Jun 2017 20:23:17 +0000 (22:23 +0200)
Declare and assign separately to avoid masking return values.

test/lib/aux.sh

index b13056055c5e59c597e0a2ea3b7973804c3863a6..e82d69844bb7afd7a845f1198e9c5b2bdde077bb 100644 (file)
@@ -695,8 +695,9 @@ prepare_md_dev() {
        local rchunk=$2
        local rdevs=$3
 
-       local maj=$(mdadm --version 2>&1) || skip "mdadm tool is missing!"
+       local maj
        local mddev
+       maj=$(mdadm --version 2>&1) || skip "mdadm tool is missing!"
 
        cleanup_md_dev
 
@@ -746,8 +747,8 @@ cleanup_md_dev() {
        test -f MD_DEV || return 0
 
        local IFS=$IFS_NL
-       local dev=$(< MD_DEV)
-
+       local dev
+       dev=$(< MD_DEV)
        udev_wait
        mdadm --stop "$dev" || true
        test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename "$dev")"
@@ -972,7 +973,8 @@ enable_dev() {
        rm -f debug.log strace.log
        init_udev_transaction
        for dev in "$@"; do
-               local name=$(echo "$dev" | sed -e 's,.*/,,')
+               local name
+               name=$(echo "$dev" | sed -e 's,.*/,,')
                dmsetup create -u "TEST-$name" "$name" "$name.table" 2>/dev/null || \
                        dmsetup load "$name" "$name.table"
                # using device name (since device path does not exists yes with udev)
@@ -999,7 +1001,8 @@ restore_from_devtable() {
        rm -f debug.log strace.log
        init_udev_transaction
        for dev in "$@"; do
-               local name=$(echo "$dev" | sed -e 's,.*/,,')
+               local name
+               name=$(echo "$dev" | sed -e 's,.*/,,')
                dmsetup load "$name" "$name.devtable"
                dmsetup resume "$name"
        done
@@ -1381,7 +1384,8 @@ target_at_least() {
                esac
        fi
 
-       local version=$(dmsetup targets 2>/dev/null | grep "${1##dm-} " 2>/dev/null)
+       local version
+       version=$(dmsetup targets 2>/dev/null | grep "${1##dm-} " 2>/dev/null)
        version=${version##* v}
 
        version_at_least "$version" "${@:2}" || {
@@ -1397,7 +1401,8 @@ target_at_least() {
 # e.g. driver_at_least 4 33
 #
 driver_at_least() {
-       local version=$(dmsetup version | tail -1 2>/dev/null)
+       local version
+       version=$(dmsetup version | tail -1 2>/dev/null)
        version=${version##*:}
        version_at_least "$version" "$@" || {
                echo "Found driver version $version, but requested" "$@" "." >&2
@@ -1478,7 +1483,8 @@ have_cache() {
 }
 
 have_tool_at_least() {
-       local version=$($1 -V 2>/dev/null)
+       local version
+       version=$("$1" -V 2>/dev/null)
        version=${version%%-*}
        shift
 
@@ -1515,7 +1521,8 @@ awk_parse_init_count_in_lvmpolld_dump() {
 }
 
 check_lvmpolld_init_rq_count() {
-       local ret=$(awk -v vvalue="$2" -v vkey="${3:-lvname}" "$(awk_parse_init_count_in_lvmpolld_dump)" lvmpolld_dump.txt)
+       local ret
+       ret=$(awk -v vvalue="$2" -v vkey="${3:-lvname}" "$(awk_parse_init_count_in_lvmpolld_dump)" lvmpolld_dump.txt)
        test "$ret" -eq "$1" || {
                echo "check_lvmpolld_init_rq_count failed. Expected $1, got $ret"
                return 1
This page took 0.036453 seconds and 5 git commands to generate.