bb5e3b2f129cc39517b925419c22f69a378ec023eh# CDDL HEADER START
bb5e3b2f129cc39517b925419c22f69a378ec023eh# The contents of this file are subject to the terms of the
bb5e3b2f129cc39517b925419c22f69a378ec023eh# Common Development and Distribution License (the "License").
bb5e3b2f129cc39517b925419c22f69a378ec023eh# You may not use this file except in compliance with the License.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bb5e3b2f129cc39517b925419c22f69a378ec023eh# See the License for the specific language governing permissions
bb5e3b2f129cc39517b925419c22f69a378ec023eh# and limitations under the License.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# When distributing Covered Code, include this CDDL HEADER in each
bb5e3b2f129cc39517b925419c22f69a378ec023eh# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# If applicable, add the following below this CDDL HEADER, with the
bb5e3b2f129cc39517b925419c22f69a378ec023eh# fields enclosed by brackets "[]" replaced with your own identifying
bb5e3b2f129cc39517b925419c22f69a378ec023eh# information: Portions Copyright [yyyy] [name of copyright owner]
bb5e3b2f129cc39517b925419c22f69a378ec023eh# CDDL HEADER END
bb5e3b2f129cc39517b925419c22f69a378ec023eh# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# Use is subject to license terms.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# DESCRIPTION:
bb5e3b2f129cc39517b925419c22f69a378ec023eh# to the originally snapshot'd file system, after the file
bb5e3b2f129cc39517b925419c22f69a378ec023eh# system has been changed. Uses 'sum -r'.
bb5e3b2f129cc39517b925419c22f69a378ec023eh# STRATEGY:
bb5e3b2f129cc39517b925419c22f69a378ec023eh# 1) Create a file in the zfs dataset
bb5e3b2f129cc39517b925419c22f69a378ec023eh# 2) Sum the file for later comparison
bb5e3b2f129cc39517b925419c22f69a378ec023eh# 3) Create a snapshot of the dataset
bb5e3b2f129cc39517b925419c22f69a378ec023eh# 4) Append to the original file
bb5e3b2f129cc39517b925419c22f69a378ec023eh# 5) Verify both checksums match
bb5e3b2f129cc39517b925419c22f69a378ec023eh if [[ $? -eq 0 ]]; then
bb5e3b2f129cc39517b925419c22f69a378ec023eh if [[ -e $SNAPDIR1 ]]; then
bb5e3b2f129cc39517b925419c22f69a378ec023eh if [[ -e $TESTDIR ]]; then
bb5e3b2f129cc39517b925419c22f69a378ec023ehlog_assert "Verify that a snapshot of a dataset is identical to " \
bb5e3b2f129cc39517b925419c22f69a378ec023eh "the original dataset."
bb5e3b2f129cc39517b925419c22f69a378ec023ehlog_must file_write -o create -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
922d2c76afbee21520ffa2088c4e60dcb80d3945ehFILE_SUM=`sum -r $TESTDIR1/$TESTFILE | awk '{ print $1 }'`
bb5e3b2f129cc39517b925419c22f69a378ec023ehlog_must file_write -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
922d2c76afbee21520ffa2088c4e60dcb80d3945ehSNAP_FILE_SUM=`sum -r $SNAPDIR1/$TESTFILE | awk '{ print $1 }'`
bb5e3b2f129cc39517b925419c22f69a378ec023eh log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"