xref: /src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.chill.ksh (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
112456ea8SJohn Birrell#
212456ea8SJohn Birrell# CDDL HEADER START
312456ea8SJohn Birrell#
412456ea8SJohn Birrell# The contents of this file are subject to the terms of the
512456ea8SJohn Birrell# Common Development and Distribution License (the "License").
612456ea8SJohn Birrell# You may not use this file except in compliance with the License.
712456ea8SJohn Birrell#
812456ea8SJohn Birrell# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
912456ea8SJohn Birrell# or http://www.opensolaris.org/os/licensing.
1012456ea8SJohn Birrell# See the License for the specific language governing permissions
1112456ea8SJohn Birrell# and limitations under the License.
1212456ea8SJohn Birrell#
1312456ea8SJohn Birrell# When distributing Covered Code, include this CDDL HEADER in each
1412456ea8SJohn Birrell# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1512456ea8SJohn Birrell# If applicable, add the following below this CDDL HEADER, with the
1612456ea8SJohn Birrell# fields enclosed by brackets "[]" replaced with your own identifying
1712456ea8SJohn Birrell# information: Portions Copyright [yyyy] [name of copyright owner]
1812456ea8SJohn Birrell#
1912456ea8SJohn Birrell# CDDL HEADER END
2012456ea8SJohn Birrell#
2112456ea8SJohn Birrell
2212456ea8SJohn Birrell#
2312456ea8SJohn Birrell# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2412456ea8SJohn Birrell# Use is subject to license terms.
2512456ea8SJohn Birrell#
2612456ea8SJohn Birrell# ident	"%Z%%M%	%I%	%E% SMI"
2712456ea8SJohn Birrell#
2812456ea8SJohn Birrell
2912456ea8SJohn Birrelldtrace_script()
3012456ea8SJohn Birrell{
3112456ea8SJohn Birrell
3212456ea8SJohn Birrell	$dtrace -w -s /dev/stdin <<EOF
3312456ea8SJohn Birrell
3412456ea8SJohn Birrell	/*
3512456ea8SJohn Birrell 	* ASSERTION:
3612456ea8SJohn Birrell 	*	Positive test of chill()
3712456ea8SJohn Birrell 	*
3812456ea8SJohn Birrell 	* SECTION: Actions and Subroutines/chill()
3912456ea8SJohn Birrell 	* 
4012456ea8SJohn Birrell 	* NOTES: This test does no verification - it's not possible.  So,
4112456ea8SJohn Birrell 	* 	we just run this and make sure it runs.
4212456ea8SJohn Birrell 	*/
4312456ea8SJohn Birrell
4412456ea8SJohn Birrell	BEGIN 
4512456ea8SJohn Birrell	{
4612456ea8SJohn Birrell		i = 0;
4712456ea8SJohn Birrell	}
4812456ea8SJohn Birrell
4912456ea8SJohn Birrell	syscall:::entry
5012456ea8SJohn Birrell	/i <= 5/
5112456ea8SJohn Birrell	{
5212456ea8SJohn Birrell		chill(100000000);
5312456ea8SJohn Birrell		i++;
5412456ea8SJohn Birrell	}
5512456ea8SJohn Birrell
5612456ea8SJohn Birrell	syscall:::entry
5712456ea8SJohn Birrell	/i > 5/
5812456ea8SJohn Birrell	{
5912456ea8SJohn Birrell		exit(0);
6012456ea8SJohn Birrell	}
6112456ea8SJohn BirrellEOF
6212456ea8SJohn Birrell}
6312456ea8SJohn Birrell
6412456ea8SJohn Birrellif [ $# != 1 ]; then
6512456ea8SJohn Birrell	echo expected one argument: '<'dtrace-path'>'
6612456ea8SJohn Birrell	exit 2
6712456ea8SJohn Birrellfi
6812456ea8SJohn Birrell
6912456ea8SJohn Birrelldtrace=$1
7012456ea8SJohn Birrell
7112456ea8SJohn Birrelldtrace_script &
7212456ea8SJohn Birrellchild=$!
7312456ea8SJohn Birrell
7412456ea8SJohn Birrellwait $child
7512456ea8SJohn Birrellstatus=$?
7612456ea8SJohn Birrell
7712456ea8SJohn Birrellexit $status
78