From patchwork Wed Jul 26 12:46:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 126347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp389930vqo; Wed, 26 Jul 2023 06:08:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6fTiXD2zB6r7Alcc3P2n+Fx+WzeYGehYrFtgo6+vigGmmPjWJnFwq+rFSPLBJXU4EBbne X-Received: by 2002:a17:903:1c7:b0:1b8:a6bd:c378 with SMTP id e7-20020a17090301c700b001b8a6bdc378mr1647441plh.20.1690376896205; Wed, 26 Jul 2023 06:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690376896; cv=none; d=google.com; s=arc-20160816; b=nVYVlLCvqXBeJH+Pg0h8JYCEBn/S7yeZHNozGBDNJVNgawlZ4QuZA+ANVK8EkQyJCx U8j+bVsxOZrXfg5BYoCojMt2WXbt9V+80ajEYPUBm7AL12maZQG/xXTKLJ1p2XJ8DJxV yabR5vcmA3zsWUD7KQATSayebzKkl7nsVAFKgS4KNckd0UIfuLel+ijhkksoTaopCF5V RCIiHHbxOKLTDXQGL3J2iUedPFTpstG/rJQcbYThkENKZLRtYcf+Q1fJvawAOBcHzsKK 8h7aqIycp5TkJdowcrLFewwkAPzHtfvv5RlHvCd73UPcMuS8syEjue7vog6/yHlK63ta LMpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ySX0bPj+OlMTvPO100mpK3C4LxGQ/kzWWhKoP04YVHk=; fh=yOxxhxcNlYDvRknRRq8NylD2QGGuF+oF8+pXpC2Qo68=; b=d8fFP+pidMQjstY0iR17xITSukWl+sDK0pUYUhMhRmbF5TNn0MBRjm2+HiYezjz55g NR4oKRCoPo7pOevGTmGKITi1W47biyB+dxFFfyPkuHx2s2hYoZcexOQIUrbxBUQyTYNe mSuRD4R90kcxcxFKe28bIQYCI2rpfevL39PTuzChuZUwDS2qZ5nO3aksaZZ9ndbmwlIB TiqWB5ULtTyyE/8beF/TcRShsFey/vMuTy3mVH8U6Z6TdsBUl4TeVzglNINzm40DZlvC BX63S28q9cF/JUeAOoJO1iFRNro/Yqbt4a2uqE696ymL8bN7tbYT2hup4nQEBiPz4jVW zYeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AKtgX+NC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a170903244200b001b54bdd6412si13933981pls.396.2023.07.26.06.08.02; Wed, 26 Jul 2023 06:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AKtgX+NC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234059AbjGZMrZ (ORCPT + 99 others); Wed, 26 Jul 2023 08:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232132AbjGZMrF (ORCPT ); Wed, 26 Jul 2023 08:47:05 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C678119AF; Wed, 26 Jul 2023 05:46:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 51E7D1F889; Wed, 26 Jul 2023 12:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690375613; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySX0bPj+OlMTvPO100mpK3C4LxGQ/kzWWhKoP04YVHk=; b=AKtgX+NCpWFD8HQkbljdOBCJEOSXiyjSXlv52g/XZtdrgzy1THtGdKlR7KwPirf4vpZfUp +x3D94lFH79P/ZhF3wCNVmLUhPQpskrvD7RygtAZJkJDZptzNvDPXpQJJlrPWKrw5Az46Q b2h0xKW90ZwzqXL8QhdAltKR2Rks7Lw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690375613; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySX0bPj+OlMTvPO100mpK3C4LxGQ/kzWWhKoP04YVHk=; b=+dcub53dQfa2pb+ohD1nVAXphmcHNkufPR8FYTL3Lgr58kOUXNVU9c8kr8KbSY0aicP6fj 2ys9Hcr/Wvgaz0Bg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 38922139BD; Wed, 26 Jul 2023 12:46:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EcVIDb0VwWQjUAAAMHmgww (envelope-from ); Wed, 26 Jul 2023 12:46:53 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Daniel Wagner Subject: [PATCH blktests v1 02/11] nvme: Reorganize test preamble code section Date: Wed, 26 Jul 2023 14:46:35 +0200 Message-ID: <20230726124644.12619-3-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230726124644.12619-1-dwagner@suse.de> References: <20230726124644.12619-1-dwagner@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772488644592849179 X-GMAIL-MSGID: 1772488644592849179 This unifies all the tests preamble code section. Reorganize all tests to start with printing the test name, then the setting nvmet and finally followed by the variable declarations. Signed-off-by: Daniel Wagner --- tests/nvme/006 | 4 ++-- tests/nvme/007 | 4 ++-- tests/nvme/016 | 4 ++-- tests/nvme/017 | 4 ++-- tests/nvme/030 | 8 ++++---- tests/nvme/031 | 8 ++++---- tests/nvme/033 | 7 ++++--- tests/nvme/034 | 7 ++++--- tests/nvme/035 | 7 ++++--- tests/nvme/036 | 7 ++++--- tests/nvme/037 | 8 ++++---- tests/nvme/038 | 6 +++--- tests/nvme/039 | 4 ++-- tests/nvme/040 | 7 ++++--- tests/nvme/041 | 8 ++++---- tests/nvme/042 | 8 ++++---- tests/nvme/043 | 8 ++++---- tests/nvme/044 | 8 ++++---- tests/nvme/045 | 8 ++++---- tests/nvme/048 | 8 ++++---- 20 files changed, 69 insertions(+), 64 deletions(-) diff --git a/tests/nvme/006 b/tests/nvme/006 index ea0db93791a7..b44c56b6a25d 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -18,12 +18,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local loop_dev local subsys_name="blktests-subsystem-1" - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" diff --git a/tests/nvme/007 b/tests/nvme/007 index 243a79f5a254..112432df7a9d 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -17,12 +17,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/016 b/tests/nvme/016 index f617cf103900..cac0c0509aca 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local iterations="${nvme_num_iter}" local loop_dev local subsys_nqn="blktests-subsystem-1" - _setup_nvmet - loop_dev="$(losetup -f)" local genctr=1 diff --git a/tests/nvme/017 b/tests/nvme/017 index 3dbb7c174b56..429a25e8e011 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local iterations="${nvme_num_iter}" local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/030 b/tests/nvme/030 index cfcdcbe6be23..a0b999cace94 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -16,14 +16,14 @@ requires() { } test() { - local port - local genctr - local subsys="blktests-subsystem-" - echo "Running ${TEST_NAME}" _setup_nvmet + local port + local genctr + local subsys="blktests-subsystem-" + port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" diff --git a/tests/nvme/031 b/tests/nvme/031 index e70898819a86..27b08e96dd0b 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -24,15 +24,15 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local loop_dev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" diff --git a/tests/nvme/033 b/tests/nvme/033 index 90aee817de5d..5a4fac03bea0 100755 --- a/tests/nvme/033 +++ b/tests/nvme/033 @@ -45,13 +45,14 @@ compare_dev_info() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/034 b/tests/nvme/034 index e0ede717c373..334b2525d1b6 100755 --- a/tests/nvme/034 +++ b/tests/nvme/034 @@ -15,14 +15,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/035 b/tests/nvme/035 index 0896f7bb578d..68a9b608920e 100755 --- a/tests/nvme/035 +++ b/tests/nvme/035 @@ -21,14 +21,15 @@ device_requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/036 b/tests/nvme/036 index 8218c6538dfd..c3fc5d4a948d 100755 --- a/tests/nvme/036 +++ b/tests/nvme/036 @@ -14,13 +14,14 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/037 b/tests/nvme/037 index fc6c21343652..5a78444b7e78 100755 --- a/tests/nvme/037 +++ b/tests/nvme/037 @@ -13,15 +13,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - for ((i = 0; i < iterations; i++)); do port=$(_nvmet_passthru_target_setup "${subsys}${i}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" \ diff --git a/tests/nvme/038 b/tests/nvme/038 index 24f02d4ad4d1..5af28da03c36 100755 --- a/tests/nvme/038 +++ b/tests/nvme/038 @@ -19,13 +19,13 @@ requires() { } test() { - local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" - local port - echo "Running ${TEST_NAME}" _setup_nvmet + local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local port + mkdir -p "${subsys_path}" rmdir "${subsys_path}" diff --git a/tests/nvme/039 b/tests/nvme/039 index f327b54a8d00..73b53d0b949c 100755 --- a/tests/nvme/039 +++ b/tests/nvme/039 @@ -131,12 +131,12 @@ inject_invalid_admin_cmd() } test_device() { + echo "Running ${TEST_NAME}" + local nvme_verbose_errors local ns_dev local ctrl_dev - echo "Running ${TEST_NAME}" - if _check_kernel_option NVME_VERBOSE_ERRORS; then nvme_verbose_errors=true else diff --git a/tests/nvme/040 b/tests/nvme/040 index 688a0939a376..3b76753132f3 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -17,6 +17,10 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local file_path="${TMPDIR}/img" local port @@ -24,9 +28,6 @@ test() { local nvmedev local fio_pid - echo "Running ${TEST_NAME}" - - _setup_nvmet truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" diff --git a/tests/nvme/041 b/tests/nvme/041 index 5b04b99b128e..d8937915d622 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -28,8 +32,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" @@ -38,8 +40,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ diff --git a/tests/nvme/042 b/tests/nvme/042 index 8df5ed37aacc..af291cb33a04 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -30,13 +34,9 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/043 b/tests/nvme/043 index 8f4b783a02ff..4a37f91e50c3 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -31,8 +35,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" @@ -41,8 +43,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/044 b/tests/nvme/044 index fca0897af27b..27cb343f5ea7 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -30,8 +34,6 @@ test() { local ctrlkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" @@ -47,8 +49,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/045 b/tests/nvme/045 index eca629a18691..005d62d4f886 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -22,6 +22,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -34,8 +38,6 @@ test() { local ctrldev local rand_io_size - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" @@ -51,8 +53,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/048 b/tests/nvme/048 index a6ebb8927865..6efcd7d6ab03 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -81,6 +81,10 @@ set_qid_max() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys_name="blktests-subsystem-1" local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" local file_path="${TMPDIR}/img" @@ -89,10 +93,6 @@ test() { local hostid local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - hostid="${def_hostid}" hostnqn="${def_hostnqn}"