3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2016 by Delphix. All rights reserved.
17 . $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
21 # Listing zfs children should work correctly.
24 verify_runnable "global"
26 log_assert "Listing zfs children should work correctly."
28 TESTCHILD=$TESTPOOL/$TESTFS/testchild
29 TESTCHILD1=$TESTCHILD-1
30 TESTCHILD2=$TESTCHILD-2
31 TESTCHILD3=$TESTCHILD-3
35 destroy_dataset $TESTCHILD
36 destroy_dataset $TESTCHILD1
37 destroy_dataset $TESTCHILD2
38 destroy_dataset $TESTCHILD3
43 # 0 children handled correctly
44 log_must_program $TESTPOOL - <<-EOF
46 for s in zfs.list.children("$TESTPOOL/$TESTFS") do
53 log_must_program $TESTPOOL - <<-EOF
55 for s in zfs.list.children("$TESTPOOL") do
56 assert(s == "$TESTPOOL/$TESTFS")
64 log_must zfs create $TESTCHILD
66 log_must_program $TESTPOOL - <<-EOF
68 for s in zfs.list.children("$TESTPOOL/$TESTFS") do
69 assert(s == "$TESTCHILD")
76 log_must zfs create $TESTCHILD1
77 log_must zfs create $TESTCHILD2
78 log_must zfs create $TESTCHILD3
80 # All children appear exactly once
81 log_must_program $TESTPOOL - <<-EOF
83 a["$TESTCHILD"] = false
84 a["$TESTCHILD1"] = false
85 a["$TESTCHILD2"] = false
86 a["$TESTCHILD3"] = false
88 for s in zfs.list.children("$TESTPOOL/$TESTFS") do
94 assert(a["$TESTCHILD"] and
102 log_mustnot_program $TESTPOOL - <<-EOF
103 zfs.list.children("$TESTPOOL/not-a-fs")
107 log_mustnot_program $TESTPOOL - <<-EOF
108 zfs.list.children("not-a-pool/$TESTFS")
112 # Can't look in a different pool than the one specified on command line
113 log_mustnot_program $TESTPOOL - <<-EOF
114 zfs.list.children("rpool")
119 log_mustnot_program $TESTPOOL - <<-EOF
120 zfs.list.children("$TESTPOOL/$TESTFS@$TESTSNAP")
125 log_pass "Listing zfs children should work correctly."