Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: linux-nvdimm@lists.01.org
Cc: Joao Martins <joao.m.martins@oracle.com>
Subject: [PATCH daxctl v2 5/5] daxctl/test: add a test for daxctl-create with input file
Date: Fri, 18 Dec 2020 02:14:38 +0000	[thread overview]
Message-ID: <20201218021438.8926-6-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20201218021438.8926-1-joao.m.martins@oracle.com>

The test creates a multi-range device (4 mappings) using the
same setup as one of the tests. Afterwards we validate that
the size/nr-mappings are the same as the original test.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 test/daxctl-create.sh | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index 41d5ba5888f7..e1d733916851 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -199,6 +199,7 @@ daxctl_test_multi()
 daxctl_test_multi_reconfig()
 {
 	local ncfgs=$1
+	local dump=$2
 	local daxdev
 
 	size=$((available / ncfgs))
@@ -226,6 +227,10 @@ daxctl_test_multi_reconfig()
 	test "$(daxctl_get_nr_mappings "$testdev")" -eq $((ncfgs / 2))
 	test "$(daxctl_get_nr_mappings "$daxdev_1")" -eq $((ncfgs / 2))
 
+	if [[ $dump ]]; then
+		"$DAXCTL" list -M -d "$daxdev_1" | jq -er '.[]' > $dump
+	fi
+
 	fail_if_available
 
 	"$DAXCTL" disable-device "$daxdev_1" && "$DAXCTL" destroy-device "$daxdev_1"
@@ -328,7 +333,7 @@ daxctl_test3()
 # pick at the end of the region
 daxctl_test4()
 {
-	daxctl_test_multi_reconfig 8
+	daxctl_test_multi_reconfig 8 ""
 	clear_dev
 	test_pass
 }
@@ -371,6 +376,29 @@ daxctl_test6()
 	test_pass
 }
 
+# Test 7: input device
+# Successfully creates a device with an input file from the multi-range
+# device test, and checking that we have the same number of mappings/size.
+daxctl_test7()
+{
+	daxctl_test_multi_reconfig 8 "input.json"
+
+	# The parameter should parse the region_id from the chardev entry
+	# therefore using the same region_id as test4
+	daxdev_1=$("$DAXCTL" create-device --input input.json | jq -er '.[].chardev')
+
+	# Validate if it's the same mappings as done by test4
+	# It also validates the size computed from the mappings
+	# A zero value means it failed, and four mappings is what's
+	# created by daxctl_test4
+	test "$(daxctl_get_nr_mappings "$daxdev_1")" -eq 4
+
+	"$DAXCTL" disable-device "$daxdev_1" && "$DAXCTL" destroy-device "$daxdev_1"
+
+	clear_dev
+	test_pass
+}
+
 find_testdev
 rc=1
 setup_dev
@@ -381,5 +409,6 @@ daxctl_test3
 daxctl_test4
 daxctl_test5
 daxctl_test6
+daxctl_test7
 reset_dev
 exit 0
-- 
1.8.3.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  parent reply	other threads:[~2020-12-18  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  2:14 [PATCH daxctl v2 0/5] daxctl: range mapping allocation Joao Martins
2020-12-18  2:14 ` [PATCH daxctl v2 1/5] libdaxctl: add mapping iterator APIs Joao Martins
2020-12-18  2:14 ` [PATCH daxctl v2 2/5] daxctl: include mappings when listing Joao Martins
2020-12-18  2:14 ` [PATCH daxctl v2 3/5] libdaxctl: add daxctl_dev_set_mapping() Joao Martins
2020-12-18  2:14 ` [PATCH daxctl v2 4/5] daxctl: allow creating devices from input json Joao Martins
2020-12-18  2:14 ` Joao Martins [this message]
2020-12-19  8:21 ` [PATCH daxctl v2 0/5] daxctl: range mapping allocation Verma, Vishal L

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218021438.8926-6-joao.m.martins@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox