@@ -14,9 +14,7 @@ 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
+reset
# if the kernel accounting is correct we should be able to create two
# pmem and two blk namespaces on nfit_test.0
@@ -39,13 +39,6 @@ create()
[ $size -gt 0 ] || err "$LINENO"
}
-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
-}
-
# re-enable the BTT namespace, and do IO to it in an attempt to
# verify it still comes up ok, and functions as expected
post_repair_test()
@@ -45,9 +45,7 @@ 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
+reset
rc=1
@@ -126,9 +124,7 @@ 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
+reset
dev="x"
json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
eval "$(echo "$json" | json2var)"
@@ -148,9 +144,7 @@ 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
+reset
cleanup
_cleanup
exit 0
@@ -37,13 +37,6 @@ create()
fi
}
-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
-}
-
verify_idx()
{
idx0="$1"
@@ -14,9 +14,7 @@ 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
+reset
rc=1
@@ -46,6 +46,21 @@ err()
exit $rc
}
+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
+}
+
+reset1()
+{
+ $NDCTL disable-region -b $NFIT_TEST_BUS1 all
+ $NDCTL zero-labels -b $NFIT_TEST_BUS1 all
+ $NDCTL enable-region -b $NFIT_TEST_BUS1 all
+}
+
+
# check_min_kver
# $1: Supported kernel version. format: X.Y
#
@@ -15,9 +15,7 @@ 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
+reset
rc=1
@@ -10,7 +10,7 @@ trap 'cleanup $LINENO' ERR
cleanup()
{
printf "Error at line %d\n" "$1"
- [[ $testdev ]] && reset
+ [[ $testdev ]] && reset_dax
exit $rc
}
@@ -70,7 +70,7 @@ reset_dev()
"$DAXCTL" enable-device "$testdev"
}
-reset()
+reset_dax()
{
test -n "$testdev"
@@ -15,9 +15,7 @@ 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
+reset
rc=1
@@ -10,11 +10,9 @@ image="update-fw.img"
trap 'err $LINENO' ERR
-reset()
+fwupd_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
+ reset
if [ -f $image ]; then
rm -f $image
fi
@@ -73,7 +71,7 @@ do_tests()
check_min_kver "4.16" || do_skip "may lack firmware update test handling"
modprobe nfit_test
-reset
+fwupd_reset
detect
rc=1
do_tests
@@ -37,13 +37,6 @@ create()
[ $size -gt 0 ] || err "$LINENO"
}
-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
-}
-
check_status()
{
local sector="$1"
@@ -11,13 +11,6 @@ trap 'err $LINENO' ERR
check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
check_prereq "jq"
-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
-}
-
do_test()
{
region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
@@ -40,7 +33,7 @@ do_test()
modprobe nfit_test
rc=1
-init
+reset
do_test
_cleanup
exit 0
@@ -19,13 +19,6 @@ trap 'err $LINENO' ERR
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
-}
-
start_monitor()
{
logfile=$(mktemp)
@@ -112,7 +105,7 @@ test_filter_region()
test_filter_namespace()
{
- init
+ reset
monitor_namespace=$($NDCTL create-namespace -b $smart_supported_bus | jq -r .dev)
monitor_dimms=$(get_monitor_dimm "-n $monitor_namespace")
start_monitor "-n $monitor_namespace"
@@ -170,7 +163,7 @@ do_tests()
modprobe nfit_test
rc=1
-init
+reset
set_smart_supported_bus
do_tests
_cleanup
@@ -17,9 +17,7 @@ ALIGN_SIZE=`getconf PAGESIZE`
# 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
+reset
rc=1
query=". | sort_by(.available_size) | reverse | .[0].dev"
@@ -29,9 +29,7 @@ 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
+reset
rc=1
@@ -28,9 +28,7 @@ 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
+reset
rc=1
@@ -25,13 +25,6 @@ check_min_kver "4.16" || do_skip "may not contain fixes for partition rescanning
check_prereq "parted"
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
-}
-
test_mode()
{
local mode="$1"
@@ -15,13 +15,8 @@ ALIGN_SIZE=`getconf PAGESIZE`
# 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 $NFIT_TEST_BUS1 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
-$NDCTL enable-region -b $NFIT_TEST_BUS1 all
+reset
+reset1
rc=1
query=". | sort_by(.size) | reverse | .[0].dev"
@@ -12,9 +12,7 @@ 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
+reset
rc=1
When BLK mode is removed, tests that expect the nfit_test region to allow pmem namespace creation will need to 'init' rather than 'zero' labels. In preparation, take the time opportunity to move reset() to a common function. So that 'ndctl zero-labels' can be replaced with 'ndctl init-labels' in one central location. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- test/blk-exhaust.sh | 4 +--- test/btt-check.sh | 7 ------- test/btt-errors.sh | 12 +++--------- test/btt-pad-compat.sh | 7 ------- test/clear.sh | 4 +--- test/common | 15 +++++++++++++++ test/create.sh | 4 +--- test/daxctl-create.sh | 4 ++-- test/daxdev-errors.sh | 4 +--- test/firmware-update.sh | 8 +++----- test/inject-error.sh | 7 ------- test/max_available_extent_ns.sh | 9 +-------- test/monitor.sh | 11 ++--------- test/multi-dax.sh | 4 +--- test/pfn-meta-errors.sh | 4 +--- test/pmem-errors.sh | 4 +--- test/rescan-partitions.sh | 7 ------- test/sector-mode.sh | 9 ++------- test/track-uuid.sh | 4 +--- 19 files changed, 36 insertions(+), 92 deletions(-)