1d583b39bSJohn Wren Kennedy# 2d583b39bSJohn Wren Kennedy# CDDL HEADER START 3d583b39bSJohn Wren Kennedy# 4d583b39bSJohn Wren Kennedy# The contents of this file are subject to the terms of the 5d583b39bSJohn Wren Kennedy# Common Development and Distribution License (the "License"). 6d583b39bSJohn Wren Kennedy# You may not use this file except in compliance with the License. 7d583b39bSJohn Wren Kennedy# 8d583b39bSJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9d583b39bSJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 10d583b39bSJohn Wren Kennedy# See the License for the specific language governing permissions 11d583b39bSJohn Wren Kennedy# and limitations under the License. 12d583b39bSJohn Wren Kennedy# 13d583b39bSJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 14d583b39bSJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15d583b39bSJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 16d583b39bSJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 17d583b39bSJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 18d583b39bSJohn Wren Kennedy# 19d583b39bSJohn Wren Kennedy# CDDL HEADER END 20d583b39bSJohn Wren Kennedy# 21d583b39bSJohn Wren Kennedy 22d583b39bSJohn Wren Kennedy# 23d583b39bSJohn Wren Kennedy# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24d583b39bSJohn Wren Kennedy# Use is subject to license terms. 25d583b39bSJohn Wren Kennedy# 26d583b39bSJohn Wren Kennedy 27*1d32ba66SJohn Wren Kennedy# 28*1d32ba66SJohn Wren Kennedy# Copyright (c) 2016 by Delphix. All rights reserved. 29*1d32ba66SJohn Wren Kennedy# 30*1d32ba66SJohn Wren Kennedy 31d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/atime/atime.cfg 32d583b39bSJohn Wren Kennedy. $STF_SUITE/include/libtest.shlib 33d583b39bSJohn Wren Kennedy 34d583b39bSJohn Wren Kennedy# 35d583b39bSJohn Wren Kennedy# Check if the access time for specified file is updated. 36d583b39bSJohn Wren Kennedy# 37d583b39bSJohn Wren Kennedy# $1 Given an absolute path to a file name 38d583b39bSJohn Wren Kennedy# 39d583b39bSJohn Wren Kennedy# Return value: 40d583b39bSJohn Wren Kennedy# 0 -> The access time is updated. 41d583b39bSJohn Wren Kennedy# 1 -> The access time is not updated. 42d583b39bSJohn Wren Kennedy# 43d583b39bSJohn Wren Kennedyfunction check_atime_updated 44d583b39bSJohn Wren Kennedy{ 45d583b39bSJohn Wren Kennedy typeset filename=$1 46d583b39bSJohn Wren Kennedy 47*1d32ba66SJohn Wren Kennedy typeset before=$(ls -Eu $filename | awk '{print $7}') 48*1d32ba66SJohn Wren Kennedy log_must cat $filename 49*1d32ba66SJohn Wren Kennedy typeset after=$(ls -Eu $filename | awk '{print $7}') 50d583b39bSJohn Wren Kennedy 51d583b39bSJohn Wren Kennedy if [[ $before != $after ]]; then 52d583b39bSJohn Wren Kennedy return 0 53d583b39bSJohn Wren Kennedy else 54d583b39bSJohn Wren Kennedy return 1 55d583b39bSJohn Wren Kennedy fi 56d583b39bSJohn Wren Kennedy} 57d583b39bSJohn Wren Kennedy 58d583b39bSJohn Wren Kennedyfunction setup_snap_clone 59d583b39bSJohn Wren Kennedy{ 60d583b39bSJohn Wren Kennedy # Create two file to verify snapshot. 61*1d32ba66SJohn Wren Kennedy log_must touch $TESTDIR/$TESTFILE 62d583b39bSJohn Wren Kennedy 63d583b39bSJohn Wren Kennedy create_snapshot $TESTPOOL/$TESTFS $TESTSNAP 64d583b39bSJohn Wren Kennedy create_clone $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTCLONE 65d583b39bSJohn Wren Kennedy} 66d583b39bSJohn Wren Kennedy 67d583b39bSJohn Wren Kennedyfunction cleanup 68d583b39bSJohn Wren Kennedy{ 69d583b39bSJohn Wren Kennedy destroy_clone $TESTPOOL/$TESTCLONE 70d583b39bSJohn Wren Kennedy destroy_snapshot $TESTPOOL/$TESTFS@$TESTSNAP 71d583b39bSJohn Wren Kennedy} 72