From patchwork Fri Jun 22 22:19:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10483153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0C8C602CB for ; Fri, 22 Jun 2018 22:19:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90A6028FF5 for ; Fri, 22 Jun 2018 22:19:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 853B928FF3; Fri, 22 Jun 2018 22:19:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A96328FF3 for ; Fri, 22 Jun 2018 22:19:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933811AbeFVWTu (ORCPT ); Fri, 22 Jun 2018 18:19:50 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:29608 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933807AbeFVWTs (ORCPT ); Fri, 22 Jun 2018 18:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1529705989; x=1561241989; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=SeujDpgdnxL//mHpJARo1hoM0yqz6vJ1HT13Kd8FysI=; b=eJGKPZZziFR9QdnRd9UFYQKjgcgt7rGalUyhwASwAVXTjjJTHlEMZZJr 5rYv3qblI+zpiuml6AfvCbBQpQmVh3T4lC9T0lSyl9Wz2Sv8ens3ZnHuw tLTJ3FKXEpML07qFL1K1BEPx7wqNO0VREBX0WqfOhWbJi0OYALiznVZyW TsIgnUzXUvfyiSrOAyL7xEnz8ObwZKKECGXQ1WnEC1aXyv9VZK5LAItEa 8XO9N9naA2AemB2Mny4go/gaLTGKEt/7MRnryUaA2fAtbZiTa/jmxC4xc UaCef78A5Ng6cDiyaGhnCtPcsxharivrzKgQKOHIGd2p8/6VXFQMOUu/5 Q==; X-IronPort-AV: E=Sophos;i="5.51,259,1526313600"; d="scan'208";a="83827518" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 23 Jun 2018 06:19:47 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 22 Jun 2018 15:09:15 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jun 2018 15:19:47 -0700 From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH blktests 03/15] check, tests/meta/012: Use array["index"] instead of array[index] Date: Fri, 22 Jun 2018 15:19:34 -0700 Message-Id: <20180622221946.10987-4-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622221946.10987-1-bart.vanassche@wdc.com> References: <20180622221946.10987-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This causes shellcheck to stop complaining about these array element accesses. Signed-off-by: Bart Van Assche --- check | 44 ++++++++++++++++++++++---------------------- tests/meta/012 | 4 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/check b/check index 5e1ba7bc8401..1774be4fe1a7 100755 --- a/check +++ b/check @@ -156,11 +156,11 @@ declare -A TEST_RUN _read_last_test_run() { local seqres="${RESULTS_DIR}/${TEST_NAME}" - LAST_TEST_RUN[date]="" - LAST_TEST_RUN[status]="" - LAST_TEST_RUN[reason]="" - LAST_TEST_RUN[exit_status]="" - LAST_TEST_RUN[runtime]="" + LAST_TEST_RUN["date"]="" + LAST_TEST_RUN["status"]="" + LAST_TEST_RUN["reason"]="" + LAST_TEST_RUN["exit_status"]="" + LAST_TEST_RUN["runtime"]="" if [[ ! -e $seqres ]]; then return @@ -247,9 +247,9 @@ _output_test_run() { fi if [[ -v TEST_DEV ]]; then - _output_status "$TEST_NAME => $(basename "$TEST_DEV")" "${TEST_RUN[status]}ed" + _output_status "$TEST_NAME => $(basename "$TEST_DEV")" "${TEST_RUN["status"]}ed" else - _output_status "$TEST_NAME" "${TEST_RUN[status]}ed" + _output_status "$TEST_NAME" "${TEST_RUN["status"]}ed" fi ( @@ -306,14 +306,14 @@ _call_test() { _read_last_test_run _output_last_test_run - TEST_RUN[date]="$(date "+%F %T")" + TEST_RUN["date"]="$(date "+%F %T")" mkdir -p "$(dirname "$seqres")" # Remove leftovers from last time. rm -f "${seqres}" "${seqres}."* if [[ -w /dev/kmsg ]]; then - local dmesg_marker="run blktests $TEST_NAME at ${TEST_RUN[date]}" + local dmesg_marker="run blktests $TEST_NAME at ${TEST_RUN["date"]}" echo "$dmesg_marker" >> /dev/kmsg else local dmesg_marker="" @@ -328,35 +328,35 @@ _call_test() { TIMEFORMAT="%Rs" pushd . >/dev/null || return { time "$test_func" >"${seqres}.out" 2>&1; } 2>"${seqres}.runtime" - TEST_RUN[exit_status]=$? + TEST_RUN["exit_status"]=$? popd >/dev/null || return - TEST_RUN[runtime]="$(cat "${seqres}.runtime")" + TEST_RUN["runtime"]="$(cat "${seqres}.runtime")" rm -f "${seqres}.runtime" _cleanup if ! diff "tests/${TEST_NAME}.out" "${seqres}.out" >/dev/null; then mv "${seqres}.out" "${seqres}.out.bad" - TEST_RUN[status]=fail - TEST_RUN[reason]=output - elif [[ ${TEST_RUN[exit_status]} -ne 0 ]]; then - TEST_RUN[status]=fail - TEST_RUN[reason]="exit" + TEST_RUN["status"]=fail + TEST_RUN["reason"]=output + elif [[ ${TEST_RUN["exit_status"]} -ne 0 ]]; then + TEST_RUN["status"]=fail + TEST_RUN["reason"]="exit" elif ! _check_dmesg "$dmesg_marker"; then - TEST_RUN[status]=fail - TEST_RUN[reason]=dmesg + TEST_RUN["status"]=fail + TEST_RUN["reason"]=dmesg else - TEST_RUN[status]=pass + TEST_RUN["status"]=pass fi rm -f "${seqres}.out" _write_test_run _output_test_run - if [[ ${TEST_RUN[status]} = pass ]]; then + if [[ ${TEST_RUN["status"]} = pass ]]; then return 0 else - case "${TEST_RUN[reason]}" in + case "${TEST_RUN["reason"]}" in output) diff -u "tests/${TEST_NAME}.out" "${seqres}.out.bad" | awk " { @@ -369,7 +369,7 @@ _call_test() { }" ;; exit) - echo " exited with status ${TEST_RUN[exit_status]}" + echo " exited with status ${TEST_RUN["exit_status"]}" ;; dmesg) echo " something found in dmesg:" diff --git a/tests/meta/012 b/tests/meta/012 index fcf8fbdde2aa..ab8c2a73eaa5 100755 --- a/tests/meta/012 +++ b/tests/meta/012 @@ -22,8 +22,8 @@ DESCRIPTION="record pid and random junk" test() { echo "Running ${TEST_NAME}" sleep 1 - TEST_RUN[pid]=$$ - TEST_RUN[random]="$(od -N $((4 * (RANDOM % 4))) -An -vtx1 /dev/urandom | tr -d ' \n')" + TEST_RUN["pid"]=$$ + TEST_RUN["random"]="$(od -N $((4 * (RANDOM % 4))) -An -vtx1 /dev/urandom | tr -d ' \n')" TEST_RUN[$$]=hello echo "Test complete" }