1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2016, 2017 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib 19 20verify_runnable "global" 21snap=$TESTPOOL/$TESTFS@$TESTSNAP 22fs=$TESTPOOL/$TESTFS 23file=$TESTDIR/$TESTFILE0 24 25function cleanup 26{ 27 destroy_dataset $snap && log_must rm $file 28} 29 30log_onexit cleanup 31 32log_must mkfile 128b $file 33create_snapshot $TESTPOOL/$TESTFS $TESTSNAP 34log_must rm $file 35 36log_must snapexists $snap 37log_must zfs unmount $fs 38 39log_must_program_sync $TESTPOOL - $fs <<-EOF 40 arg = ... 41 fs = arg["argv"][1] 42 err = zfs.sync.rollback(fs) 43 msg = "rolling back " .. fs .. " err=" .. err 44 return msg 45EOF 46 47log_must zfs mount $fs 48log_must [ -f $file ] 49 50log_pass "Rolling back snapshot with channel program works." 51