Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1809980rwr; Thu, 20 Apr 2023 23:08:44 -0700 (PDT) X-Google-Smtp-Source: AKy350b7xe64coRijZ9zGrHbCcFTXiXubY8FoI2pRA4tLycLra40DHFxKWTdKH5a8Q4EvDWbihVz X-Received: by 2002:a17:902:db11:b0:1a6:8405:f709 with SMTP id m17-20020a170902db1100b001a68405f709mr5068061plx.20.1682057323886; Thu, 20 Apr 2023 23:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682057323; cv=none; d=google.com; s=arc-20160816; b=agVz8h77PsdZ4hcAYohv8NRo8iaj6IPkZn0If2CcuuAvZooEFSP49OrGQsNit9wykY NBKVMBkvA7c3nNz6Jf/tiTK5/DMWETDnA1syLS9r9FWO40xGhkGrfNBhSKsa31R5q9JO 0jeueHO80BxEOOMg+EMsq4OSyFCPVJva+dhBULWRcRcTUZVxc4YyFQfaVpnxWjKRK3Sk AeE0YBNYl8bB4ZsHu3YPLUs0zq8IE0Uv25t+M797MPgH6MPxoEMff0TWq5Q+CcGhKeGK PKS5zj6Gt4AFDjs0YqPb4eYKoIb+yUMWtKryslpjNUSUk96F5WTby77MW1MCurJOwvrm 4Fmw== 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=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=XGvlNwUNB3jUlAOcN47057umXGN8OAZqrPkeYBCecKO/Vf/PQ9tz3clRVmhYDnK97h 5jpJ/coqchK5T56PSPksm0KEHkbF2tSK85hIeRv/Zw6/XWqlt0hyRRUpwmoCbagFnfNs 9kXANS6fO+8CZWfKuYM/vYHoVOrgOhVX9Qjn9aLzYYDJousqp9ITu3IeveEBiBvMm4rr gsqb18yyXgGPb9T4Ohyo/yb0hJN2YFAj57vhmuwudD6qqnE4vEyHxwTB0YVo3VGm4Ra3 y7ksOMZwWDn6mhSEVZDUOVQXqsZpRob1mJwhqGMDmeJbKg5Iwicgx/aSMsrfkzqb+EVs aZRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GEw6TKHo; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=7Rygyher; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org ([23.128.96.18]) by mx.google.com with ESMTP id bg7-20020a17090b0d8700b00246c31928f2si3615127pjb.171.2023.04.20.23.08.29; Thu, 20 Apr 2023 23:08:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GEw6TKHo; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=7Rygyher; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233776AbjDUGGG (ORCPT + 99 others); Fri, 21 Apr 2023 02:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233766AbjDUGFx (ORCPT ); Fri, 21 Apr 2023 02:05:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE2057D9B; Thu, 20 Apr 2023 23:05:48 -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-out1.suse.de (Postfix) with ESMTPS id 15D6021A46; Fri, 21 Apr 2023 06:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682057117; 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=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=GEw6TKHoazlhD6fIfZGSNs5r3O+3MOd9mphNy516ylLPLONcYrxYz3YNkm63nd5uvjR7Wb ZTvT0IacChM06xccvg+/Aw/Qon+oJwhgRiq0yywrmCRONJAocqWG6emA8WUMO6U3RNYlq6 M8LKXIUWL+K0Y+YHEdaof16GtVVQZkA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682057117; 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=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=7Rygyhert0Lviw6K0Vm49y/D7gG0WOqgrud4pzBkv+TULlnm/BGxLzv3dQYu4JS33hGlys 1s0gAphw2aAZ6WBw== 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 09A0C1390E; Fri, 21 Apr 2023 06:05:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JKFXAp0nQmRsZgAAMHmgww (envelope-from ); Fri, 21 Apr 2023 06:05:17 +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 , Daniel Wagner Subject: [PATCH REPOST blktests v2 2/9] nvme: Do not hard code device size for dd test Date: Fri, 21 Apr 2023 08:04:58 +0200 Message-Id: <20230421060505.10132-3-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230421060505.10132-1-dwagner@suse.de> References: <20230421060505.10132-1-dwagner@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Read the block device sizes instead hard coding them. Signed-off-by: Daniel Wagner --- tests/nvme/014 | 10 +++++++++- tests/nvme/015 | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/nvme/014 b/tests/nvme/014 index d13cff7921da..28913641ae40 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -23,6 +23,9 @@ test() { local port local nvmedev local loop_dev + local size + local bs + local count local file_path="$TMPDIR/img" local subsys_name="blktests-subsystem-1" @@ -41,7 +44,12 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none + size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" + bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + count=$((size / bs - 1)) + + dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + count="${count}" bs="${bs}" status=none nvme flush "/dev/${nvmedev}" -n 1 diff --git a/tests/nvme/015 b/tests/nvme/015 index bb52ba2598db..2f7957caac88 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -22,6 +22,9 @@ test() { local port local nvmedev + local size + local bs + local count local file_path="$TMPDIR/img" local subsys_name="blktests-subsystem-1" @@ -38,7 +41,12 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none + size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" + bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + count=$((size / bs - 1)) + + dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + count="${count}" bs="${bs}" status=none nvme flush "/dev/${nvmedev}n1" -n 1 -- 2.40.0