12be1a816SJohn Birrell /*
22be1a816SJohn Birrell  * CDDL HEADER START
32be1a816SJohn Birrell  *
42be1a816SJohn Birrell  * The contents of this file are subject to the terms of the
52be1a816SJohn Birrell  * Common Development and Distribution License (the "License").
62be1a816SJohn Birrell  * You may not use this file except in compliance with the License.
72be1a816SJohn Birrell  *
82be1a816SJohn Birrell  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92be1a816SJohn Birrell  * or http://www.opensolaris.org/os/licensing.
102be1a816SJohn Birrell  * See the License for the specific language governing permissions
112be1a816SJohn Birrell  * and limitations under the License.
122be1a816SJohn Birrell  *
132be1a816SJohn Birrell  * When distributing Covered Code, include this CDDL HEADER in each
142be1a816SJohn Birrell  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152be1a816SJohn Birrell  * If applicable, add the following below this CDDL HEADER, with the
162be1a816SJohn Birrell  * fields enclosed by brackets "[]" replaced with your own identifying
172be1a816SJohn Birrell  * information: Portions Copyright [yyyy] [name of copyright owner]
182be1a816SJohn Birrell  *
192be1a816SJohn Birrell  * CDDL HEADER END
202be1a816SJohn Birrell  */
212be1a816SJohn Birrell 
222be1a816SJohn Birrell /*
232be1a816SJohn Birrell  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
242be1a816SJohn Birrell  * Use is subject to license terms.
252be1a816SJohn Birrell  */
262be1a816SJohn Birrell 
2703836978SPedro F. Giffuni /*
282be1a816SJohn Birrell  * Copyright (c) 2012 by Delphix. All rights reserved.
292be1a816SJohn Birrell  */
302be1a816SJohn Birrell 
312be1a816SJohn Birrell 
322be1a816SJohn Birrell /*
332be1a816SJohn Birrell  * ASSERTION:
342be1a816SJohn Birrell  * Verify the behavior of variations in bufsize.
352be1a816SJohn Birrell  *
362be1a816SJohn Birrell  * SECTION: Speculative Tracing/Options and Tuning;
372be1a816SJohn Birrell  *	Options and Tunables/bufsize
3803836978SPedro F. Giffuni  *
3903836978SPedro F. Giffuni  * NOTES: This test behaves differently depending on the values
4003836978SPedro F. Giffuni  * assigned to bufsize.
4103836978SPedro F. Giffuni  */
4203836978SPedro F. Giffuni 
4303836978SPedro F. Giffuni #pragma D option quiet
4403836978SPedro F. Giffuni #pragma D option bufsize=49
452be1a816SJohn Birrell 
462be1a816SJohn Birrell BEGIN
472be1a816SJohn Birrell {
4803836978SPedro F. Giffuni 	self->speculateFlag = 0;
492be1a816SJohn Birrell 	self->commitFlag = 0;
502be1a816SJohn Birrell 	self->spec = speculation();
512be1a816SJohn Birrell 	printf("Speculative buffer ID: %d\n", self->spec);
522be1a816SJohn Birrell }
532be1a816SJohn Birrell 
542be1a816SJohn Birrell BEGIN
552be1a816SJohn Birrell {
562be1a816SJohn Birrell 	speculate(self->spec);
572be1a816SJohn Birrell 	printf("Lots of data\n");
582be1a816SJohn Birrell 	printf("Has to be crammed into this buffer\n");
592be1a816SJohn Birrell 	printf("Until it overflows\n");
602be1a816SJohn Birrell 	printf("And causes flops\n");
612be1a816SJohn Birrell 	self->speculateFlag++;
622be1a816SJohn Birrell 
632be1a816SJohn Birrell }
642be1a816SJohn Birrell 
652be1a816SJohn Birrell BEGIN
662be1a816SJohn Birrell /1 <= self->speculateFlag/
672be1a816SJohn Birrell {
682be1a816SJohn Birrell 	commit(self->spec);
692be1a816SJohn Birrell 	self->commitFlag++;
702be1a816SJohn Birrell }
712be1a816SJohn Birrell 
722be1a816SJohn Birrell BEGIN
732be1a816SJohn Birrell /1 <= self->commitFlag/
742be1a816SJohn Birrell {
752be1a816SJohn Birrell 	printf("Statement was executed\n");
762be1a816SJohn Birrell 	exit(0);
772be1a816SJohn Birrell }
782be1a816SJohn Birrell 
792be1a816SJohn Birrell BEGIN
802be1a816SJohn Birrell /1 > self->commitFlag/
812be1a816SJohn Birrell {
822be1a816SJohn Birrell 	printf("Statement wasn't executed\n");
832be1a816SJohn Birrell 	exit(1);
842be1a816SJohn Birrell }
852be1a816SJohn Birrell