aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/runfiles/linux.run8
-rw-r--r--tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/channel_program/synctask_core/tst.list_user_props.ksh98
3 files changed, 103 insertions, 4 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index a844d6b1b..1bd3fd605 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -78,10 +78,10 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
'tst.get_number_props', 'tst.get_string_props', 'tst.get_type',
'tst.get_userquota', 'tst.get_written', 'tst.list_children',
'tst.list_clones', 'tst.list_snapshots', 'tst.list_system_props',
- 'tst.parse_args_neg', 'tst.promote_conflict', 'tst.promote_multiple',
- 'tst.promote_simple', 'tst.rollback_mult', 'tst.rollback_one',
- 'tst.snapshot_destroy', 'tst.snapshot_neg', 'tst.snapshot_recursive',
- 'tst.snapshot_simple']
+ 'tst.list_user_props', 'tst.parse_args_neg','tst.promote_conflict',
+ 'tst.promote_multiple', 'tst.promote_simple', 'tst.rollback_mult',
+ 'tst.rollback_one', 'tst.snapshot_destroy', 'tst.snapshot_neg',
+ 'tst.snapshot_recursive', 'tst.snapshot_simple']
tags = ['functional', 'channel_program', 'synctask_core']
[tests/functional/chattr]
diff --git a/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am b/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am
index 48b89b578..93ec25a03 100644
--- a/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am
+++ b/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am
@@ -23,6 +23,7 @@ dist_pkgdata_SCRIPTS = \
tst.list_clones.ksh \
tst.list_snapshots.ksh \
tst.list_system_props.ksh \
+ tst.list_user_props.ksh \
tst.parse_args_neg.ksh \
tst.promote_conflict.ksh \
tst.promote_conflict.zcp \
diff --git a/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.list_user_props.ksh b/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.list_user_props.ksh
new file mode 100755
index 000000000..910dddc03
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.list_user_props.ksh
@@ -0,0 +1,98 @@
+#!/bin/ksh -p
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2017 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
+
+#
+# DESCRIPTION:
+# Listing zfs user properties should work correctly.
+#
+
+verify_runnable "global"
+
+TESTPROP="org.openzfs:test_property"
+TESTPROP1=$TESTPROP-1
+TESTPROP2=$TESTPROP-2
+TESTPROP3=$TESTPROP-3
+TESTPROP4=$TESTPROP-4
+
+TESTVAL="true"
+TESTVAL1="busy"
+TESTVAL2="9223372036854775808"
+TESTVAL3="801f2266-3715-41f4-9080-3d5e913b0f15"
+TESTVAL4="TOZwOfACvQtmDyiq68elB3a3g9YYyxBjSnLtN3ZyQYNOAKykzIE2khKKOBncJiDx"
+
+
+# 0 properties handled correctly
+log_must_program $TESTPOOL - <<-EOF
+ n = 0
+ for p in zfs.list.properties("$TESTPOOL/$TESTFS") do
+ n = n + 1
+ end
+ assert(n == 0)
+ return 0
+EOF
+
+# Add a single user property
+log_must zfs set $TESTPROP="$TESTVAL" $TESTPOOL/$TESTFS
+
+log_must_program $TESTPOOL - <<-EOF
+ n = 0
+ for p,v in zfs.list.properties("$TESTPOOL/$TESTFS") do
+ assert(p == "$TESTPROP")
+ assert(v == "$TESTVAL")
+ n = n + 1
+ end
+ assert(n == 1)
+ return 0
+EOF
+
+log_must zfs set $TESTPROP1="$TESTVAL1" $TESTPOOL/$TESTFS
+log_must zfs set $TESTPROP2="$TESTVAL2" $TESTPOOL/$TESTFS
+log_must zfs set $TESTPROP3="$TESTVAL3" $TESTPOOL/$TESTFS
+log_must zfs set $TESTPROP4="$TESTVAL4" $TESTPOOL/$TESTFS
+
+# All user properties have correct value and appear exactly once
+log_must_program $TESTPOOL - <<-EOF
+ a = {}
+ a["$TESTPROP"] = false
+ a["$TESTPROP1"] = false
+ a["$TESTPROP2"] = false
+ a["$TESTPROP3"] = false
+ a["$TESTPROP4"] = false
+ m = {}
+ m["$TESTPROP"] = "$TESTVAL"
+ m["$TESTPROP1"] = "$TESTVAL1"
+ m["$TESTPROP2"] = "$TESTVAL2"
+ m["$TESTPROP3"] = "$TESTVAL3"
+ m["$TESTPROP4"] = "$TESTVAL4"
+ n = 0
+ for p,v in zfs.list.properties("$TESTPOOL/$TESTFS") do
+ assert(not a[p])
+ a[p] = true
+ assert(v == m[p])
+ n = n + 1
+ end
+ assert(n == 5)
+ assert(a["$TESTPROP"] and
+ a["$TESTPROP1"] and
+ a["$TESTPROP2"] and
+ a["$TESTPROP3"] and
+ a["$TESTPROP4"])
+ return 0
+EOF
+
+log_pass "Listing zfs user properies should work correctly."