diff mbox series

[daxctl,v2,5/5] daxctl/test: Add a test for daxctl-create with align

Message ID 20201216224833.6229-6-joao.m.martins@oracle.com (mailing list archive)
State New
Headers show
Series daxctl: device align support | expand

Commit Message

Joao Martins Dec. 16, 2020, 10:48 p.m. UTC
Add a test which uses the newly added --align property
which allows a device created with daxctl create-device
to select its page size. If the available size is bigger
than 1G then use 1G as page size, otherwise use 2M.

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

Patch

diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index 0d35112b4119..5598e5a89aaf 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -281,6 +281,34 @@  daxctl_test5()
 	test_pass
 }
 
+# Test 6: align
+# Successfully creates a device with a align property
+daxctl_test6()
+{
+	local daxdev
+	local align
+	local size
+
+	# Available size
+	size=$available
+
+	# Use 2M by default or 1G if supported
+	align=2097152
+	if [[ $((available >= 1073741824 )) ]]; then
+		align=1073741824
+		size=$align
+	fi
+
+	daxdev=$("$DAXCTL" create-device -r 0 -s $size -a $align | jq -er '.[].chardev')
+
+	test -n "$daxdev"
+
+	"$DAXCTL" disable-device "$daxdev" && "$DAXCTL" destroy-device "$daxdev"
+
+	clear_dev
+	test_pass
+}
+
 find_testdev
 rc=1
 setup_dev
@@ -290,5 +318,6 @@  daxctl_test2
 daxctl_test3
 daxctl_test4
 daxctl_test5
+daxctl_test6
 reset_dev
 exit 0