xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/funcs/tst.chill.ksh (revision 2804:e8e3422f18c2)
12633Sahl#
22633Sahl# CDDL HEADER START
32633Sahl#
42633Sahl# The contents of this file are subject to the terms of the
52633Sahl# Common Development and Distribution License (the "License").
62633Sahl# You may not use this file except in compliance with the License.
72633Sahl#
82633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl# or http://www.opensolaris.org/os/licensing.
102633Sahl# See the License for the specific language governing permissions
112633Sahl# and limitations under the License.
122633Sahl#
132633Sahl# When distributing Covered Code, include this CDDL HEADER in each
142633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl# If applicable, add the following below this CDDL HEADER, with the
162633Sahl# fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl# information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl#
192633Sahl# CDDL HEADER END
202633Sahl#
212633Sahl
222633Sahl#
232633Sahl# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
242633Sahl# Use is subject to license terms.
252633Sahl#
262633Sahl# ident	"%Z%%M%	%I%	%E% SMI"
272633Sahl#
282633Sahl
292633Sahldtrace_script()
302633Sahl{
312633Sahl
322633Sahl	$dtrace -w -s /dev/stdin <<EOF
332633Sahl
342633Sahl	/*
352633Sahl 	* ASSERTION:
362633Sahl 	*	Positive test of chill()
372633Sahl 	*
382633Sahl 	* SECTION: Actions and Subroutines/chill()
392633Sahl 	* 
402633Sahl 	* NOTES: This test does no verification - it's not possible.  So,
412633Sahl 	* 	we just run this and make sure it runs.
422633Sahl 	*/
432633Sahl
442633Sahl	BEGIN 
452633Sahl	{
462633Sahl		i = 0;
472633Sahl	}
482633Sahl
492633Sahl	syscall:::entry
502633Sahl	/i <= 5/
512633Sahl	{
522633Sahl		chill(100000000);
532633Sahl		i++;
542633Sahl	}
552633Sahl
562633Sahl	syscall:::entry
572633Sahl	/i > 5/
582633Sahl	{
592633Sahl		exit(0);
602633Sahl	}
612633SahlEOF
622633Sahl}
632633Sahl
64*2804Stomeeif [ $# != 1 ]; then
65*2804Stomee	echo expected one argument: '<'dtrace-path'>'
66*2804Stomee	exit 2
67*2804Stomeefi
68*2804Stomee
69*2804Stomeedtrace=$1
702633Sahl
712633Sahldtrace_script &
722633Sahlchild=$!
732633Sahl
742633Sahlwait $child
752633Sahlstatus=$?
762633Sahl
772633Sahlexit $status
78