err.BufSizeVariations2.d revision 253726
1249259Sdim/*
2249259Sdim * CDDL HEADER START
3249259Sdim *
4249259Sdim * The contents of this file are subject to the terms of the
5249259Sdim * Common Development and Distribution License (the "License").
6249259Sdim * You may not use this file except in compliance with the License.
7249259Sdim *
8249259Sdim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9249259Sdim * or http://www.opensolaris.org/os/licensing.
10249259Sdim * See the License for the specific language governing permissions
11249259Sdim * and limitations under the License.
12249259Sdim *
13249259Sdim * When distributing Covered Code, include this CDDL HEADER in each
14249259Sdim * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15249259Sdim * If applicable, add the following below this CDDL HEADER, with the
16249259Sdim * fields enclosed by brackets "[]" replaced with your own identifying
17249259Sdim * information: Portions Copyright [yyyy] [name of copyright owner]
18249259Sdim *
19249259Sdim * CDDL HEADER END
20249259Sdim */
21249259Sdim
22249259Sdim/*
23249259Sdim * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24249259Sdim * Use is subject to license terms.
25249259Sdim */
26249259Sdim
27249259Sdim/*
28249259Sdim * Copyright (c) 2012 by Delphix. All rights reserved.
29249259Sdim */
30249259Sdim
31249259Sdim/*
32249259Sdim * ASSERTION:
33249259Sdim * Verify the behavior of variations in bufsize.
34249259Sdim *
35249259Sdim * SECTION: Speculative Tracing/Options and Tuning;
36249259Sdim *	    Options and Tunables/bufsize
37249259Sdim *
38249259Sdim * NOTES: This test behaves differently depending on the values
39249259Sdim * assigned to bufsize.
40249259Sdim * 1. 0 > bufsize.
41249259Sdim * 2. 0 == bufsize.
42249259Sdim * 3. 0 < bufsize <= 7
43249259Sdim * 4. 8 <= bufsize <= 31
44249259Sdim * 5. 32 <= bufsize <= 47
45249259Sdim * 6. 48 <= bufsize <= 71
46249259Sdim * 7. 72 <= bufsize
47249259Sdim */
48249259Sdim
49249259Sdim#pragma D option quiet
50249259Sdim#pragma D option bufsize=4
51249259Sdim
52BEGIN
53{
54	self->speculateFlag = 0;
55	self->commitFlag = 0;
56	self->spec = speculation();
57	printf("Speculative buffer ID: %d\n", self->spec);
58}
59
60BEGIN
61{
62	speculate(self->spec);
63	printf("Lots of data\n");
64	printf("Has to be crammed into this buffer\n");
65	printf("Until it overflows\n");
66	printf("And causes flops\n");
67	self->speculateFlag++;
68
69}
70
71BEGIN
72/1 <= self->speculateFlag/
73{
74	commit(self->spec);
75	self->commitFlag++;
76}
77
78BEGIN
79/1 <= self->commitFlag/
80{
81	printf("Statement was executed\n");
82	exit(0);
83}
84
85BEGIN
86/1 > self->commitFlag/
87{
88	printf("Statement wasn't executed\n");
89	exit(1);
90}
91