1178476Sjb# 2178476Sjb# CDDL HEADER START 3178476Sjb# 4178476Sjb# The contents of this file are subject to the terms of the 5178476Sjb# Common Development and Distribution License (the "License"). 6178476Sjb# You may not use this file except in compliance with the License. 7178476Sjb# 8178476Sjb# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9178476Sjb# or http://www.opensolaris.org/os/licensing. 10178476Sjb# See the License for the specific language governing permissions 11178476Sjb# and limitations under the License. 12178476Sjb# 13178476Sjb# When distributing Covered Code, include this CDDL HEADER in each 14178476Sjb# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15178476Sjb# If applicable, add the following below this CDDL HEADER, with the 16178476Sjb# fields enclosed by brackets "[]" replaced with your own identifying 17178476Sjb# information: Portions Copyright [yyyy] [name of copyright owner] 18178476Sjb# 19178476Sjb# CDDL HEADER END 20178476Sjb# 21178476Sjb 22178476Sjb# 23178476Sjb# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24178476Sjb# Use is subject to license terms. 25178476Sjb# 26178476Sjb#ident "%Z%%M% %I% %E% SMI" 27178476Sjb 28178476Sjbif [ $# != 1 ]; then 29178476Sjb echo expected one argument: '<'dtrace-path'>' 30178476Sjb exit 2 31178476Sjbfi 32178476Sjb 33178476Sjbfile=out.$$ 34178476Sjbdtrace=$1 35178476Sjb 36178476Sjbrm -f $file 37178476Sjb 38178476Sjb$dtrace -o $file -c date -s /dev/stdin <<EOF 39178476Sjb 40178476Sjb #pragma D option quiet 41178476Sjb #pragma D option bufsize=1M 42178476Sjb #pragma D option bufpolicy=fill 43178476Sjb 44178476Sjb pid\$target:::entry, 45178476Sjb pid\$target:::return, 46178476Sjb pid\$target:a.out::, 47178476Sjb syscall:::return, 48178476Sjb profile:::profile-997 49178476Sjb /pid == \$target/ 50178476Sjb { 51178476Sjb printf("START %s:%s:%s:%s\n", 52178476Sjb probeprov, probemod, probefunc, probename); 53178476Sjb trace(ustackdepth); 54178476Sjb ustack(100); 55178476Sjb trace("END\n"); 56178476Sjb } 57178476Sjb 58178476Sjb tick-1sec 59178476Sjb /n++ == 10/ 60178476Sjb { 61178476Sjb trace("test timed out..."); 62178476Sjb exit(1); 63178476Sjb } 64178476SjbEOF 65178476Sjb 66178476Sjbstatus=$? 67178476Sjbif [ "$status" -ne 0 ]; then 68178476Sjb echo $tst: dtrace failed 69178476Sjb exit $status 70178476Sjbfi 71178476Sjb 72178476Sjbperl /dev/stdin $file <<EOF 73178476Sjb while (<>) { 74178476Sjb chomp; 75178476Sjb 76178476Sjb last if /^\$/; 77178476Sjb 78178476Sjb die "expected START at \$.\n" unless /^START/; 79178476Sjb 80178476Sjb \$_ = <>; 81178476Sjb chomp; 82178476Sjb die "expected depth (\$_) at \$.\n" unless /^(\d+)\$/; 83178476Sjb \$depth = \$1; 84178476Sjb 85178476Sjb for (\$i = 0; \$i < \$depth; \$i++) { 86178476Sjb \$_ = <>; 87178476Sjb chomp; 88178476Sjb die "unexpected END at \$.\n" if /^END/; 89178476Sjb } 90178476Sjb 91178476Sjb \$_ = <>; 92178476Sjb chomp; 93178476Sjb die "expected END at \$.\n" unless /^END\$/; 94178476Sjb } 95178476SjbEOF 96178476Sjb 97178476Sjbstatus=$? 98178476Sjb 99178476Sjbcount=`wc -l $file | cut -f1 -do` 100178476Sjbif [ "$count" -lt 1000 ]; then 101178476Sjb echo $tst: output was too short 102178476Sjb status=1 103178476Sjbfi 104178476Sjb 105178476Sjb 106178476Sjbif [ "$status" -eq 0 ]; then 107178476Sjb rm -f $file 108178476Sjbfi 109178476Sjb 110178476Sjbexit $status 111