1#! /usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# $FreeBSD$ 24 25# 26# Copyright 2012 Spectra Logic Corporation. All rights reserved. 27# Use is subject to license terms. 28# 29 30. $STF_SUITE/include/libtest.kshlib 31. $STF_SUITE/tests/zil/zil.kshlib 32 33############################################################################### 34# 35# __stc_assertion_start 36# 37# ID: zil_002_pos 38# 39# DESCRIPTION: 40# 41# XXX XXX XXX 42# 43# STRATEGY: 44# 1) XXX 45# 2) XXX 46# 47# TESTABILITY: explicit 48# 49# TEST_AUTOMATION_LEVEL: automated 50# 51# CODING_STATUS: COMPLETED (YYYY-MM-DD) XXX 52# 53# __stc_assertion_end 54# 55############################################################################### 56 57verify_runnable "both" 58 59td5=$TESTDIR/5 60tf1=$td5/1 61tf2=$td5/2 62tf3=$td5/3 63file_size=`expr $POOLSIZE / 4` 64write_count=`expr $file_size / $BLOCK_SIZE` 65 66function check_file 67{ 68 typeset fname="$1" 69 typeset -i expected_size="$2" 70 71 log_must test -f $fname 72 log_must test $expected_size == $(size_of_file $fname) 73} 74 75function cleanup 76{ 77 ls -lr $TESTDIR 78 log_must $RM -rf $TESTDIR/* 79} 80 81log_onexit cleanup 82 83log_assert "Verify that creating and deleting content works" 84 85# Run the pre-export tests. 86zil_setup 87log_must $MKDIR $td5 88log_must $FILE_WRITE -o create -f $tf1 -b $BLOCK_SIZE -c $write_count -d 0 89check_file $tf1 $file_size 90log_must $CP $tf1 $tf2 91log_must $CP $tf2 $tf3 92check_file $tf2 $file_size 93log_must $CMP $tf1 $tf2 94log_must $RM -f $tf3 95 96# Now run the post-export tests. 97zil_reimport_pool $TESTPOOL 98check_file $tf1 $file_size 99check_file $tf2 $file_size 100log_must $CMP $tf1 $tf2 101log_mustnot test -f $tf3 102log_must test -f $tf1 103cur_file_size=$(size_of_file $tf1) 104log_must test $file_size -eq $cur_file_size 105 106log_pass "Success creating and deleting content" 107