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 2013 Spectra Logic.  All rights reserved.
27# Use is subject to license terms.
28#
29
30. ${STF_SUITE}/include/libtest.kshlib
31
32###############################################################################
33#
34# __stc_assertion_start
35#
36# ID: fsync_integrity_001_pos
37#
38# DESCRIPTION:
39#
40# Verify the integrity of non-aligned writes to the same blocks within the same
41# transaction group, where an fsync is issued by a non-final writer.
42#
43# STRATEGY:
44
45# This test verifies that the unoverride in the following sequence of events is
46# handled correctly:
47#
48# 1) A new transaction group opens
49# 2) A write is issued to a certain block
50# 3) The writer fsyncs() that file
51# 4) TBD module immediately writes that block, then places an override in the
52#    syncer's TBD data structure, indicating that it doesn't need to write that
53#    block when syncing.
54# 5) Another write is issued to the same block, with different data.
55# 6) TBD module unoverrides that block in the syncer's TBD data structure
56# 7) The syncer writes that block
57#
58#
59# TESTABILITY: explicit
60#
61# TEST_AUTOMATION_LEVEL: automated
62#
63# CODING_STATUS: BEGIN (2013-1-21)
64#
65# __stc_assertion_end
66#
67###############################################################################
68
69verify_runnable "both"
70
71log_assert "Verify the integrity of non-aligned writes to the same blocks within the same transaction group, where an fsync is issued by a non-final writer."
72
73# Run the test program
74fsync_integrity ${TESTDIR}/${TESTFILE}
75
76# Success is indicated by the return status
77if [[ $? -ne 0 ]]; then
78  log_fail "Test failed to execute or file became corrupted"
79else
80  log_pass
81fi
82
83
84