ndctl/b787320-ndctl-test-Move-sector-mode-to-a-different-region.patch
Jeff Moyer 06e22bf492 Sync test harness with kernel updates.
The kernel removed support for nd_blk, since no hardware ever hit the
market.  That change broke the unit tests.  Fix them.

Resolves: rhbz#2141031
2023-06-02 14:53:04 -04:00

43 lines
1.8 KiB
Diff

ndctl/test: Move sector-mode to a different region
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2143636
commit b787320498508192f1e04ac38d39da4eb3ca26e9
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:32:10 2022 -0800
ndctl/test: Move sector-mode to a different region
Previously the largest region on the nfit_test.1 bus belonged to a BLK-mode
region. With the removal of BLK-mode support update the test to instead
find a suitable PMEM region to perform the checkout.
Link: https://lore.kernel.org/r/164141833068.3990253.15694496866707006837.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 439ef33..f70b0f1 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -19,11 +19,11 @@ reset
reset1
rc=1
-query=". | sort_by(.size) | reverse | .[0].dev"
-NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
-REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
+query=". | sort_by(.available_size) | reverse | .[0].dev"
+REGION=$($NDCTL list -R -b $NFIT_TEST_BUS1 | jq -r "$query")
echo 0 > /sys/bus/nd/devices/$REGION/read_only
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
+echo $ALIGN_SIZE > /sys/bus/nd/devices/$REGION/align
+NAMESPACE=$($NDCTL create-namespace --no-autolabel -r $REGION -m sector -f -l 4K | jq -r ".dev")
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K