diff options
author | Jason King <jasonbking@users.noreply.github.com> | 2020-01-22 19:03:17 -0600 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2020-01-22 17:03:17 -0800 |
commit | e2ef1cbf04c713fcdba33f8183e6a61a18f61119 (patch) | |
tree | 2b36d80a1fa639052d441758d7dc2ecb2c6e908f /tests | |
parent | 79add96766f03e7382f9a4b356e7a06f66b600f8 (diff) |
Support inheriting properties in channel programs
This adds support in channel programs to inherit properties analogous
to `zfs inherit` by adding `zfs.sync.inherit` and `zfs.check.inherit`
functions to the ZFS LUA API.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jason King <jason.king@joyent.com>
Closes #9738
Diffstat (limited to 'tests')
3 files changed, 41 insertions, 1 deletions
diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 4342662e7..f93f6479a 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -80,7 +80,7 @@ tags = ['functional', 'channel_program', 'lua_core'] tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit', 'tst.get_index_props', 'tst.get_mountpoint', 'tst.get_neg', 'tst.get_number_props', 'tst.get_string_props', 'tst.get_type', - 'tst.get_userquota', 'tst.get_written', 'tst.list_bookmarks', + 'tst.get_userquota', 'tst.get_written', 'tst.inherit', 'tst.list_bookmarks', 'tst.list_children', 'tst.list_clones', 'tst.list_holds', 'tst.list_snapshots', 'tst.list_system_props', 'tst.list_user_props', 'tst.parse_args_neg','tst.promote_conflict', 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 d9894f682..5330edaf2 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 @@ -13,6 +13,7 @@ dist_pkgdata_SCRIPTS = \ tst.get_type.ksh \ tst.get_userquota.ksh \ tst.get_written.ksh \ + tst.inherit.ksh \ tst.list_bookmarks.ksh \ tst.list_children.ksh \ tst.list_clones.ksh \ diff --git a/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.inherit.ksh b/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.inherit.ksh new file mode 100755 index 000000000..e199b4c8b --- /dev/null +++ b/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.inherit.ksh @@ -0,0 +1,39 @@ +#!/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 2020 Joyent, Inc. +# + +. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib + +verify_runnable "global" + +fs=$TESTPOOL/$TESTFS +testprop="com.joyent:testprop" +testval="testval" + +log_must dataset_setprop $fs $testprop $testval +log_must_program_sync $TESTPOOL - $fs $testprop <<-EOF + arg = ... + fs = arg["argv"][1] + prop = arg["argv"][2] + err = zfs.sync.inherit(fs, prop) + msg = "resetting " .. prop .. " on " .. fs .. " err=" .. err + return msg +EOF + + +prop=$(get_prop $testprop $fs) +[[ "$prop" == "-" ]] || log_fail "Property still set after inheriting" + +log_pass "Inherit/clear property with channel program works." |