tst.usym.ksh revision 178476
1239922Sgonzo#
2239922Sgonzo# CDDL HEADER START
3239922Sgonzo#
4239922Sgonzo# The contents of this file are subject to the terms of the
5239922Sgonzo# Common Development and Distribution License (the "License").
6239922Sgonzo# You may not use this file except in compliance with the License.
7239922Sgonzo#
8239922Sgonzo# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9239922Sgonzo# or http://www.opensolaris.org/os/licensing.
10239922Sgonzo# See the License for the specific language governing permissions
11239922Sgonzo# and limitations under the License.
12239922Sgonzo#
13239922Sgonzo# When distributing Covered Code, include this CDDL HEADER in each
14239922Sgonzo# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15239922Sgonzo# If applicable, add the following below this CDDL HEADER, with the
16239922Sgonzo# fields enclosed by brackets "[]" replaced with your own identifying
17239922Sgonzo# information: Portions Copyright [yyyy] [name of copyright owner]
18239922Sgonzo#
19239922Sgonzo# CDDL HEADER END
20239922Sgonzo#
21239922Sgonzo
22239922Sgonzo#
23239922Sgonzo# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24239922Sgonzo# Use is subject to license terms.
25239922Sgonzo#
26239922Sgonzo# ident	"%Z%%M%	%I%	%E% SMI"
27239922Sgonzo
28239922Sgonzoscript()
29239922Sgonzo{
30239922Sgonzo	$dtrace -qs /dev/stdin <<EOF
31239922Sgonzo	profile-1234hz
32239922Sgonzo	/arg1 != 0/
33239922Sgonzo	{
34239922Sgonzo		@[usym(arg1)] = count();
35239922Sgonzo	}
36239922Sgonzo
37239922Sgonzo	tick-100ms
38239922Sgonzo	/i++ == 20/
39239922Sgonzo	{
40239922Sgonzo		exit(0);
41239922Sgonzo	}
42239922SgonzoEOF
43239922Sgonzo}
44239922Sgonzo
45239922Sgonzospinny()
46239922Sgonzo{
47239922Sgonzo	while true; do
48239922Sgonzo		let i=i+1
49239922Sgonzo	done
50239922Sgonzo}
51239922Sgonzo
52239922Sgonzoif [ $# != 1 ]; then
53239922Sgonzo	echo expected one argument: '<'dtrace-path'>'
54239922Sgonzo	exit 2
55239922Sgonzofi
56239922Sgonzo
57239922Sgonzodtrace=$1
58239922Sgonzo
59239922Sgonzospinny &
60239922Sgonzochild=$!
61239922Sgonzo
62239922Sgonzo#
63239922Sgonzo# This test is essentially the same as that in the ufunc test; see that
64239922Sgonzo# test for the rationale.
65239922Sgonzo#
66239922Sgonzoscript | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
67239922Sgonzostatus=$? 
68239922Sgonzo
69239922Sgonzokill $child
70239922Sgonzoexit $status
71243423Sgonzo