From patchwork Mon Sep 23 03:30:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 11156003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19FE313BD for ; Mon, 23 Sep 2019 03:30:26 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9CA120640 for ; Mon, 23 Sep 2019 03:30:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=fossix-org.20150623.gappssmtp.com header.i=@fossix-org.20150623.gappssmtp.com header.b="tFytgsMy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9CA120640 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2610C202EF288; Sun, 22 Sep 2019 20:32:59 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2607:f8b0:4864:20::642; helo=mail-pl1-x642.google.com; envelope-from=santosh@fossix.org; receiver=linux-nvdimm@lists.01.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C2375202ECFB2 for ; Sun, 22 Sep 2019 20:32:57 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id 4so5895206pld.10 for ; Sun, 22 Sep 2019 20:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B1EjxyQW2HzpVDS4CBtEcXK4EzIeCET2yol9JwL4618=; b=tFytgsMysfmTHmK47FEIbfXMC9CnsEzq4oKQZOJFDeW/athewE5jnyVewZMpziztNz 7Bpjcvh3jEXeJ8LSB6xyIjDLfjgQV9e4A/ClA46fpUDfEtRXPoa8lIpVdrty82yczSXf O1jZsmw9yepU9SpVZngKQqjVotR7yu7ZLZ7+NQwn4y07dZGBlfny1TaSyd5aJylwWT8b 56RC/hrixqahTlKdG+q8HTnnK7fSh0izB2chPpeNgtrNfTgQeDrzkfOs29ei6Yo2bLbp BAF5Umn+PxlK9X6bNAn5mCFOmphJ/2kBIsbvKl5CQf+zDrvzhsZriqE9u6kQX7z6ZWpy nnag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B1EjxyQW2HzpVDS4CBtEcXK4EzIeCET2yol9JwL4618=; b=dwib8a+RrNli0szkgyFg6yYEgofqiDyNKmRayabSKxqx7cOoMgoX5PHfSwEkAfb4XT YaZc98KJ5TeCKEqArEXb7V7vSFRqDycx7/J78iTTumdS6Wzc4EfOtUgGtmn7y+Wa6TwH M8x8zoe2VhODRWv0igtpy6c5O72xwJN18jLZWirio5EkOt8lHsn1gEOEplBDL1urj1Sw OxcNphL8cnWO1T62sAWxzOzJwQDbQq6sFXkZ0KBLz/PZkQ2FRB1lZL0LEqtm+TrMgCSd YdDPWDywCFMfdXFUj5/5QUvfXdprR+0GeImBXmrQK0xOZFtJ7uXXOOZiI8tjQnPHHuc0 tGdA== X-Gm-Message-State: APjAAAWQUoyb0IjclBwhmzLPRUlpq8/APM01ja1n6xoe/xBKVo9ahUQb 0Ux0IQ0vkJa0x8JUcAXNW/KsfL+B+tE= X-Google-Smtp-Source: APXvYqzDi3lQOQhVUC5FTj92t3d+rAC7bvrZvt7ly3NjpjkmAuJqOBttfloaD0OsECSm3yVy7SXVpA== X-Received: by 2002:a17:902:8505:: with SMTP id bj5mr3621773plb.11.1569209422716; Sun, 22 Sep 2019 20:30:22 -0700 (PDT) Received: from santosiv.in.ibm.com ([129.41.84.73]) by smtp.gmail.com with ESMTPSA id s1sm15338873pjs.31.2019.09.22.20.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2019 20:30:22 -0700 (PDT) From: Santosh Sivaraj To: linux-nvdimm@lists.01.org, Dan Williams Subject: [PATCH 1/2] rename nfit_test_bus with a more generic name Date: Mon, 23 Sep 2019 09:00:14 +0530 Message-Id: <20190923033015.26732-1-santosh@fossix.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: harish@linux.ibm.com Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" This cleanup would avoid confusion when ndctl is used for testing on non-nfit platforms. Signed-off-by: Santosh Sivaraj --- test/blk-exhaust.sh | 14 +++++++------- test/btt-check.sh | 8 ++++---- test/btt-errors.sh | 22 +++++++++++----------- test/btt-pad-compat.sh | 12 ++++++------ test/clear.sh | 12 ++++++------ test/common | 10 +++++----- test/create.sh | 10 +++++----- test/daxdev-errors.sh | 14 +++++++------- test/firmware-update.sh | 8 ++++---- test/inject-error.sh | 8 ++++---- test/inject-smart.sh | 2 +- test/label-compat.sh | 10 +++++----- test/max_available_extent_ns.sh | 8 ++++---- test/monitor.sh | 10 +++++----- test/multi-dax.sh | 12 ++++++------ test/pfn-meta-errors.sh | 8 ++++---- test/pmem-errors.sh | 8 ++++---- test/rescan-partitions.sh | 8 ++++---- test/sector-mode.sh | 14 +++++++------- test/security.sh | 14 +++++++------- 20 files changed, 106 insertions(+), 106 deletions(-) diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh index 326ce73..067ed27 100755 --- a/test/blk-exhaust.sh +++ b/test/blk-exhaust.sh @@ -23,17 +23,17 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all # if the kernel accounting is correct we should be able to create two # pmem and two blk namespaces on nfit_test.0 rc=1 -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw +$NDCTL create-namespace -b $TEST_BUS0 -t pmem +$NDCTL create-namespace -b $TEST_BUS0 -t pmem +$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw +$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw # clearnup and exit _cleanup diff --git a/test/btt-check.sh b/test/btt-check.sh index ceabee5..c91a5ad 100755 --- a/test/btt-check.sh +++ b/test/btt-check.sh @@ -37,7 +37,7 @@ check_min_kver "4.14" || do_skip "may not support badblocks clearing on pmem via create() { - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector) rc=2 eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" @@ -50,9 +50,9 @@ create() reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } # re-enable the BTT namespace, and do IO to it in an attempt to diff --git a/test/btt-errors.sh b/test/btt-errors.sh index cb35865..65224b3 100755 --- a/test/btt-errors.sh +++ b/test/btt-errors.sh @@ -54,15 +54,15 @@ trap 'err $LINENO cleanup' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 # create a btt namespace and clear errors (if any) dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector) eval "$(echo "$json" | json2var)" [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 @@ -135,11 +135,11 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1 # reset everything to get a clean log if grep -q "$MNT" /proc/mounts; then umount $MNT; fi -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector) eval "$(echo "$json" | json2var)" [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 @@ -157,8 +157,8 @@ force_raw 0 dd if=/dev/$blockdev of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true # done, exit -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all _cleanup exit 0 diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh index 2c1f271..a5fc796 100755 --- a/test/btt-pad-compat.sh +++ b/test/btt-pad-compat.sh @@ -31,7 +31,7 @@ trap 'err $LINENO' ERR create() { - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector) rc=2 eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" @@ -47,9 +47,9 @@ create() reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } verify_idx() @@ -120,7 +120,7 @@ create_oldfmt_ns() # that supports a raw namespace with a 4K sector size, prior to # v4.13 raw namespaces are limited to 512-byte sector size. rc=77 - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000) + json=$($NDCTL create-namespace -b $TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000) rc=2 eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" @@ -128,7 +128,7 @@ create_oldfmt_ns() [ $size -gt 0 ] || err "$LINENO" # reconfig it to sector mode - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -e $dev -m sector --force) + json=$($NDCTL create-namespace -b $TEST_BUS0 -e $dev -m sector --force) eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" [ -n "$size" ] || err "$LINENO" diff --git a/test/clear.sh b/test/clear.sh index 17d5bed..f0b4a9b 100755 --- a/test/clear.sh +++ b/test/clear.sh @@ -23,15 +23,15 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 # create pmem dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw) eval $(echo $json | json2var) [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 @@ -73,8 +73,8 @@ fi if check_min_kver "4.9"; then # check for re-appearance of stale badblocks from poison_list - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all # since we have cleared the errors, a disable/reenable shouldn't bring them back if read sector len < /sys/block/$blockdev/badblocks; then diff --git a/test/common b/test/common index 1814a0c..54085ae 100644 --- a/test/common +++ b/test/common @@ -27,10 +27,10 @@ else fi -# NFIT_TEST_BUS[01] +# TEST_BUS[01] # -NFIT_TEST_BUS0="nfit_test.0" -NFIT_TEST_BUS1="nfit_test.1" +TEST_BUS0="nfit_test.0" +TEST_BUS1="nfit_test.1" ACPI_BUS="ACPI.NFIT" E820_BUS="e820" @@ -82,8 +82,8 @@ check_prereq() # _cleanup() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL disable-region -b $NFIT_TEST_BUS1 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS1 all modprobe -r nfit_test } diff --git a/test/create.sh b/test/create.sh index 8d78797..1398c79 100755 --- a/test/create.sh +++ b/test/create.sh @@ -24,15 +24,15 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 # create pmem dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw) eval $(echo $json | json2var ) [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 @@ -53,7 +53,7 @@ $NDCTL destroy-namespace -f $dev # create blk dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -v) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw -v) eval $(echo $json | json2var) [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh index c5adb72..c877874 100755 --- a/test/daxdev-errors.sh +++ b/test/daxdev-errors.sh @@ -23,16 +23,16 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query") +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096) +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096) chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") #{ @@ -53,11 +53,11 @@ chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[ # } #} -json1=$($NDCTL list -b $NFIT_TEST_BUS0 --mode=devdax --namespaces) +json1=$($NDCTL list -b $TEST_BUS0 --mode=devdax --namespaces) eval $(echo $json1 | json2var) nsdev=$dev -json1=$($NDCTL list -b $NFIT_TEST_BUS0) +json1=$($NDCTL list -b $TEST_BUS0) eval $(echo $json1 | json2var) busdev=$dev diff --git a/test/firmware-update.sh b/test/firmware-update.sh index 7852e58..dbd5c7f 100755 --- a/test/firmware-update.sh +++ b/test/firmware-update.sh @@ -12,9 +12,9 @@ trap 'err $LINENO' ERR reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all if [ -f $image ]; then rm -f $image fi @@ -22,7 +22,7 @@ reset() detect() { - dev=$($NDCTL list -b $NFIT_TEST_BUS0 -D | jq .[0].dev | tr -d '"') + dev=$($NDCTL list -b $TEST_BUS0 -D | jq .[0].dev | tr -d '"') [ -n "$dev" ] || err "$LINENO" } diff --git a/test/inject-error.sh b/test/inject-error.sh index 49e68b3..3e33a1b 100755 --- a/test/inject-error.sh +++ b/test/inject-error.sh @@ -35,7 +35,7 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support error injection" create() { - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem --align=4k) + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem --align=4k) rc=2 eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" @@ -46,9 +46,9 @@ create() reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } check_status() diff --git a/test/inject-smart.sh b/test/inject-smart.sh index 18655ba..fa18a58 100755 --- a/test/inject-smart.sh +++ b/test/inject-smart.sh @@ -4,7 +4,7 @@ rc=77 . ./common -bus="$NFIT_TEST_BUS0" +bus="$TEST_BUS0" inj_val="42" trap 'err $LINENO' ERR diff --git a/test/label-compat.sh b/test/label-compat.sh index dc6226d..a31bf4a 100755 --- a/test/label-compat.sh +++ b/test/label-compat.sh @@ -23,12 +23,12 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all -# grab the largest pmem region on -b $NFIT_TEST_BUS0 +# grab the largest pmem region on -b $TEST_BUS0 query=". | sort_by(.available_size) | reverse | .[0].dev" -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query") +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query") # we assume that $region is comprised of 4 dimms query=". | .regions[0].mappings | sort_by(.dimm) | .[].dimm" @@ -40,7 +40,7 @@ do i=$((i+1)) done -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all len=$($NDCTL list -r $region -N | jq -r "length") diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh index 1c7e7bf..5701195 100755 --- a/test/max_available_extent_ns.sh +++ b/test/max_available_extent_ns.sh @@ -13,14 +13,14 @@ check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_siz init() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } do_test() { - region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1) + region=$($NDCTL list -b $TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1) available_sz=$($NDCTL list -r $region | jq -r .[].available_size) size=$(( available_sz/4 )) diff --git a/test/monitor.sh b/test/monitor.sh index 29d4ea1..c9f7224 100755 --- a/test/monitor.sh +++ b/test/monitor.sh @@ -20,9 +20,9 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service" init() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } start_monitor() @@ -36,10 +36,10 @@ start_monitor() set_smart_supported_bus() { - smart_supported_bus=$NFIT_TEST_BUS0 + smart_supported_bus=$TEST_BUS0 monitor_dimms=$(./list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev) if [ -z $monitor_dimms ]; then - smart_supported_bus=$NFIT_TEST_BUS1 + smart_supported_bus=$TEST_BUS1 fi } diff --git a/test/multi-dax.sh b/test/multi-dax.sh index 0829bf2..1dca352 100755 --- a/test/multi-dax.sh +++ b/test/multi-dax.sh @@ -23,17 +23,17 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query") +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") _cleanup diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh index 2b57f19..f930325 100755 --- a/test/pfn-meta-errors.sh +++ b/test/pfn-meta-errors.sh @@ -30,15 +30,15 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 # create a fsdax namespace and clear errors (if any) dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m fsdax) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m fsdax) eval "$(echo "$json" | json2var)" [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh index 9553a3f..8ce57c8 100755 --- a/test/pmem-errors.sh +++ b/test/pmem-errors.sh @@ -28,15 +28,15 @@ trap 'err $LINENO cleanup' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all rc=1 # create pmem dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw) +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw) eval $(echo $json | json2var) [ $dev = "x" ] && echo "fail: $LINENO" && false [ $mode != "raw" ] && echo "fail: $LINENO" && false diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh index 9c7b7a0..5e01665 100755 --- a/test/rescan-partitions.sh +++ b/test/rescan-partitions.sh @@ -27,9 +27,9 @@ check_prereq "blockdev" reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $TEST_BUS0 all + $NDCTL zero-labels -b $TEST_BUS0 all + $NDCTL enable-region -b $TEST_BUS0 all } test_mode() @@ -37,7 +37,7 @@ test_mode() local mode="$1" # create namespace - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m "$mode") + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m "$mode") rc=2 eval "$(echo "$json" | json2var)" [ -n "$dev" ] || err "$LINENO" diff --git a/test/sector-mode.sh b/test/sector-mode.sh index 4b964c5..7f60452 100755 --- a/test/sector-mode.sh +++ b/test/sector-mode.sh @@ -20,17 +20,17 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +$NDCTL disable-region -b $TEST_BUS0 all +$NDCTL zero-labels -b $TEST_BUS0 all +$NDCTL enable-region -b $TEST_BUS0 all -$NDCTL disable-region -b $NFIT_TEST_BUS1 all -$NDCTL zero-labels -b $NFIT_TEST_BUS1 all -$NDCTL enable-region -b $NFIT_TEST_BUS1 all +$NDCTL disable-region -b $TEST_BUS1 all +$NDCTL zero-labels -b $TEST_BUS1 all +$NDCTL enable-region -b $TEST_BUS1 all rc=1 query=". | sort_by(.size) | reverse | .[0].dev" -NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query") +NAMESPACE=$($NDCTL list -b $TEST_BUS1 -N | jq -r "$query") REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev") echo 0 > /sys/bus/nd/devices/$REGION/read_only $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K diff --git a/test/security.sh b/test/security.sh index c86d2c6..80d64df 100755 --- a/test/security.sh +++ b/test/security.sh @@ -17,14 +17,14 @@ trap 'err $LINENO' ERR setup() { - $NDCTL disable-region -b "$NFIT_TEST_BUS0" all + $NDCTL disable-region -b "$TEST_BUS0" all } detect() { - dev="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].dev)" + dev="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].dev)" [ -n "$dev" ] || err "$LINENO" - id="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].id)" + id="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].id)" [ -n "$id" ] || err "$LINENO" } @@ -83,9 +83,9 @@ lock_dimm() # inline. Once a subsequent user arrives we can refactor this to a # helper in test/common: # get_test_dimm_path "nfit_test.0" "nmem3" - handle="$($NDCTL list -b "$NFIT_TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)" + handle="$($NDCTL list -b "$TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)" test_dimm_path="" - for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*; do + for test_dimm in /sys/devices/platform/"$TEST_BUS0"/nfit_test_dimm/test_dimm*; do td_handle_file="$test_dimm/handle" test -e "$td_handle_file" || continue td_handle="$(cat "$td_handle_file")" @@ -107,7 +107,7 @@ lock_dimm() get_security_state() { - $NDCTL list -i -b "$NFIT_TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security + $NDCTL list -i -b "$TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security } setup_passphrase() @@ -184,7 +184,7 @@ test_4_security_unlock() echo "Incorrect security state: $sstate expected: unlocked" err "$LINENO" fi - $NDCTL disable-region -b "$NFIT_TEST_BUS0" all + $NDCTL disable-region -b "$TEST_BUS0" all remove_passphrase } From patchwork Mon Sep 23 03:30:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 11156005 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E38B513BD for ; Mon, 23 Sep 2019 03:30:26 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1AC520820 for ; Mon, 23 Sep 2019 03:30:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=fossix-org.20150623.gappssmtp.com header.i=@fossix-org.20150623.gappssmtp.com header.b="XsiDZzS9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1AC520820 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 395BB202EF28A; Sun, 22 Sep 2019 20:33:00 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2607:f8b0:4864:20::541; helo=mail-pg1-x541.google.com; envelope-from=santosh@fossix.org; receiver=linux-nvdimm@lists.01.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 37EBD202ECFB2 for ; Sun, 22 Sep 2019 20:32:59 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id c17so7205304pgg.4 for ; Sun, 22 Sep 2019 20:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sywvno9oH6C2x7JbbNTuKFc1cVwyreXcpG9Pmze4Bmg=; b=XsiDZzS9Mw2A+1DlYsO5UXdfdymh05336cO/Tgk8VrqHsocnL6VKYPDQlR37mAyF0w fnX8FLe4KPkQdTvbPAetfYbt3MygY9ZJT8mRoRXZ9NE1eI7VI1gTj8GWPrh91Kdx9kni G8MOw+HcHQn+AWI+qSqrHC8j44WHVQovHuAcaixkSsDOMQEpCDBQ0oASPmeI93q99bf0 +iSVD8IHYE2uRK5/vLI0KdcyKiDjTk872aYlbgLjuYoIs+U3OyGdOzg1yE0TPaO8zBEt SYq3J58ipPI1UMo5Fa3bUuw6SmTUnONRSbLNoGUlIdYGpSFHTjdkDseSfKOTPD6vebcS djkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sywvno9oH6C2x7JbbNTuKFc1cVwyreXcpG9Pmze4Bmg=; b=mVevP8Y8JmQY9T18IpRrcvDYile3UgXyRoQN+6FpQxuujNk0+tPw62z6buuCZYKs1Z ZIjc90uOLdd6jvAFtqbqD03RVu2xNbMkUK0upBOmy9M1IOqIC8OSlPWGBu0ZcSXPaCko NgMJgJoAi7SV9TF6m6+qnUe6Fz4WVb3WtKIvAkVEKR+Gi2KcnvluyQmulre3l3bI6JAq S+0drfCbATR00kXg5n72yTw9P14jvZPOzkszbI4WkmNK9v9Ybx1pcMWS8KSdfpeEWbC6 oLilYfGOPZDfulb1q9ClPCKavqX4r8J19pE2fNNDoIvOOTapaX+2gXZPVznGjqFLPu25 KyTw== X-Gm-Message-State: APjAAAWxgbR8e7OgDOR0rLfP0JN732gkuDT9RKllMZIroOYy9W62ZkVU DBa750SYsTLp0wBSJEVvCGFep94Fu2Y= X-Google-Smtp-Source: APXvYqyLQNHUr8VS/qzdxQlGgvLcrzOc1ZUKAo9lN41iIEGM/3Ok0QtessYVRHvwTrazMuKAO++P3A== X-Received: by 2002:a17:90a:9306:: with SMTP id p6mr17831475pjo.3.1569209424830; Sun, 22 Sep 2019 20:30:24 -0700 (PDT) Received: from santosiv.in.ibm.com ([129.41.84.73]) by smtp.gmail.com with ESMTPSA id s1sm15338873pjs.31.2019.09.22.20.30.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2019 20:30:24 -0700 (PDT) From: Santosh Sivaraj To: linux-nvdimm@lists.01.org, Dan Williams Subject: [PATCH 2/2] Enable ndctl tests for emulated pmem devices Date: Mon, 23 Sep 2019 09:00:15 +0530 Message-Id: <20190923033015.26732-2-santosh@fossix.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190923033015.26732-1-santosh@fossix.org> References: <20190923033015.26732-1-santosh@fossix.org> MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: harish@linux.ibm.com Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" For QEMU emulated devices and other platforms, nfit drivers are not needed. This patch achieves that by relying upon the environment variable called 'WITHOUT_NFIT'. If 'WITHOUT_NFIT=y', nfit drivers (nfit_test and libnvdimm_test) are not loaded. Signed-off-by: Santosh Sivaraj --- configure.ac | 8 ++++++++ test/btt-pad-compat.sh | 5 ++++- test/clear.sh | 5 ++++- test/common | 19 ++++++++++++++----- test/core.c | 6 ++++++ test/create.sh | 5 ++++- test/daxdev-errors.c | 14 ++++++++++---- test/daxdev-errors.sh | 5 ++++- test/dpa-alloc.c | 17 +++++++++++++---- test/libndctl.c | 21 +++++++++++++++++---- 10 files changed, 84 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 4737cff..33fbd0b 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,14 @@ if test "x$with_bash" = "xyes"; then [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)], []) fi +AC_CANONICAL_HOST +AS_CASE([$host_cpu], + [x86_64|arm*], + [ + AC_DEFINE([ACPI], [1], ["Build for ACPI NFIT"]) + ] +) + AC_SUBST([BASH_COMPLETION_DIR]) AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"]) diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh index a5fc796..1e5ce48 100755 --- a/test/btt-pad-compat.sh +++ b/test/btt-pad-compat.sh @@ -187,7 +187,10 @@ do_tests() ns_info_wipe } -modprobe nfit_test +if [ -z "$WITHOUT_NFIT" ]; then + modprobe nfit_test +fi + check_prereq xxd rc=1 reset diff --git a/test/clear.sh b/test/clear.sh index f0b4a9b..e0b1f84 100755 --- a/test/clear.sh +++ b/test/clear.sh @@ -22,7 +22,10 @@ check_min_kver "4.6" || do_skip "lacks clear poison support" trap 'err $LINENO' ERR # setup (reset nfit_test dimms) -modprobe nfit_test +if [ -z "$WITHOUT_NFIT" ]; then + modprobe nfit_test +fi + $NDCTL disable-region -b $TEST_BUS0 all $NDCTL zero-labels -b $TEST_BUS0 all $NDCTL enable-region -b $TEST_BUS0 all diff --git a/test/common b/test/common index 54085ae..1251ba5 100644 --- a/test/common +++ b/test/common @@ -29,10 +29,17 @@ fi # TEST_BUS[01] # -TEST_BUS0="nfit_test.0" -TEST_BUS1="nfit_test.1" -ACPI_BUS="ACPI.NFIT" -E820_BUS="e820" +echo $WITHOUT_NFIT +if [ -n "$WITHOUT_NFIT" ]; then + echo $BUS_PROVIDER0 + TEST_BUS0="$BUS_PROVIDER0" + TEST_BUS1="$BUS_PROVIDER1" +else + TEST_BUS0="nfit_test.0" + TEST_BUS1="nfit_test.1" + ACPI_BUS="ACPI.NFIT" + E820_BUS="e820" +fi # Functions @@ -84,7 +91,9 @@ _cleanup() { $NDCTL disable-region -b $TEST_BUS0 all $NDCTL disable-region -b $TEST_BUS1 all - modprobe -r nfit_test + if [ -z "$WITHOUT_NFIT" ]; then + modprobe -r nfit_test + fi } # json2var diff --git a/test/core.c b/test/core.c index 888f5d8..1f0c215 100644 --- a/test/core.c +++ b/test/core.c @@ -126,7 +126,9 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, struct ndctl_bus *bus; struct log_ctx log_ctx; const char *list[] = { +#ifdef ACPI "nfit", +#endif "device_dax", "dax_pmem", "dax_pmem_core", @@ -134,7 +136,9 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, "libnvdimm", "nd_blk", "nd_btt", +#ifdef ACPI "nd_e820", +#endif "nd_pmem", }; @@ -239,9 +243,11 @@ retry: ndctl_bus_foreach(nd_ctx, bus) { struct ndctl_region *region; +#ifdef ACPI if (strncmp(ndctl_bus_get_provider(bus), "nfit_test", 9) != 0) continue; +#endif ndctl_region_foreach(bus, region) ndctl_region_disable_invalidate(region); } diff --git a/test/create.sh b/test/create.sh index 1398c79..afc34ac 100755 --- a/test/create.sh +++ b/test/create.sh @@ -23,7 +23,10 @@ check_min_kver "4.5" || do_skip "may lack namespace mode attribute" trap 'err $LINENO' ERR # setup (reset nfit_test dimms) -modprobe nfit_test +if [ -z "$WITHOUT_NFIT" ]; then + modprobe nfit_test +fi + $NDCTL disable-region -b $TEST_BUS0 all $NDCTL zero-labels -b $TEST_BUS0 all $NDCTL enable-region -b $TEST_BUS0 all diff --git a/test/daxdev-errors.c b/test/daxdev-errors.c index 29de16b..1022047 100644 --- a/test/daxdev-errors.c +++ b/test/daxdev-errors.c @@ -45,7 +45,6 @@ struct check_cmd { static sigjmp_buf sj_env; static int sig_count; -static const char *NFIT_PROVIDER0 = "nfit_test.0"; static struct check_cmd *check_cmds; static void sigbus_hdl(int sig, siginfo_t *siginfo, void *ptr) @@ -245,7 +244,7 @@ static struct ndctl_dax * get_dax_region(struct ndctl_region *region) static int test_daxdev_clear_error(const char *bus_name, const char *region_name) { - int rc = 0, i; + int rc = 0, i, with_nfit; struct ndctl_ctx *ctx; struct ndctl_bus *bus; struct ndctl_region *region; @@ -259,6 +258,7 @@ static int test_daxdev_clear_error(const char *bus_name, }; char path[256]; char buf[SYSFS_ATTR_SIZE]; + char *bus_provider; struct log_ctx log_ctx; log_init(&log_ctx, "test/init", "NDCTL_DAXDEV_TEST"); @@ -266,7 +266,13 @@ static int test_daxdev_clear_error(const char *bus_name, if (rc) return rc; - bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0); + with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0; + if (with_nfit) + bus_provider = "nfit_test.0"; + else + bus_provider = getenv("BUS_PROVIDER0"); + + bus = ndctl_bus_get_by_provider(ctx, bus_provider); if (!bus) { rc = -ENODEV; goto cleanup; @@ -289,7 +295,7 @@ static int test_daxdev_clear_error(const char *bus_name, /* get badblocks */ if (snprintf(path, 256, "/sys/devices/platform/%s/%s/%s/badblocks", - NFIT_PROVIDER0, + bus_provider, bus_name, ndctl_region_get_devname(region)) >= 256) { fprintf(stderr, "%s: buffer too small!\n", diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh index c877874..7678a9b 100755 --- a/test/daxdev-errors.sh +++ b/test/daxdev-errors.sh @@ -22,7 +22,10 @@ check_min_kver "4.12" || do_skip "lacks dax dev error handling" trap 'err $LINENO' ERR # setup (reset nfit_test dimms) -modprobe nfit_test +if [ -z "$WITHOUT_NFIT" ]; then + modprobe nfit_test +fi + $NDCTL disable-region -b $TEST_BUS0 all $NDCTL zero-labels -b $TEST_BUS0 all $NDCTL enable-region -b $TEST_BUS0 all diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c index 9a9c6b6..25bbe0e 100644 --- a/test/dpa-alloc.c +++ b/test/dpa-alloc.c @@ -30,8 +30,6 @@ #include #include -static const char *NFIT_PROVIDER0 = "nfit_test.0"; -static const char *NFIT_PROVIDER1 = "nfit_test.1"; #define NUM_NAMESPACES 4 struct test_dpa_namespace { @@ -46,23 +44,34 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) { unsigned int default_available_slots, available_slots, i; struct ndctl_region *region, *blk_region = NULL; + char *bus_provider0, *bus_provider1; struct ndctl_namespace *ndns; struct ndctl_dimm *dimm; unsigned long size; + bool with_nfit; struct ndctl_bus *bus; char uuid_str[40]; int round; int rc; + with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0; + if (with_nfit) { + bus_provider0 = "nfit_test.0"; + bus_provider1 = "nfit_test.1"; + } else { + bus_provider0 = getenv("BUS_PROVIDER0"); + bus_provider1 = getenv("BUS_PROVIDER1"); + } + /* disable nfit_test.1, not used in this test */ - bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1); + bus = ndctl_bus_get_by_provider(ctx, bus_provider1); if (!bus) return -ENXIO; ndctl_region_foreach(bus, region) ndctl_region_disable_invalidate(region); /* init nfit_test.0 */ - bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0); + bus = ndctl_bus_get_by_provider(ctx, bus_provider0); if (!bus) return -ENXIO; ndctl_region_foreach(bus, region) diff --git a/test/libndctl.c b/test/libndctl.c index 02bb9cc..e6fa053 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -94,8 +94,6 @@ * dimm. */ -static const char *NFIT_PROVIDER0 = "nfit_test.0"; -static const char *NFIT_PROVIDER1 = "nfit_test.1"; #define SZ_4K 0x00001000 #define SZ_128K 0x00020000 #define SZ_7M 0x00700000 @@ -2594,11 +2592,18 @@ static void reset_bus(struct ndctl_bus *bus) static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test) { - struct ndctl_bus *bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0); + struct ndctl_bus *bus; struct ndctl_region *region; struct ndctl_dimm *dimm; + bool with_nfit; int rc; + with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0; + if (with_nfit) + bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); + else + bus = ndctl_bus_get_by_provider(ctx, getenv("BUS_PROVIDER0")); + if (!bus) return -ENXIO; @@ -2646,9 +2651,17 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test) static int do_test1(struct ndctl_ctx *ctx, struct ndctl_test *test) { - struct ndctl_bus *bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1); + struct ndctl_bus *bus; + bool with_nfit; int rc; + with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0; + if (with_nfit) + bus = ndctl_bus_get_by_provider(ctx, "nfit_test.1"); + else + bus = ndctl_bus_get_by_provider(ctx, getenv("BUS_PROVIDER1")); + + if (!bus) return -ENXIO;