1N/A#
1N/A# CDDL HEADER START
1N/A#
1N/A# The contents of this file are subject to the terms of the
1N/A# Common Development and Distribution License (the "License").
1N/A# You may not use this file except in compliance with the License.
1N/A#
1N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1N/A# or http://www.opensolaris.org/os/licensing.
1N/A# See the License for the specific language governing permissions
1N/A# and limitations under the License.
1N/A#
1N/A# When distributing Covered Code, include this CDDL HEADER in each
1N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1N/A# If applicable, add the following below this CDDL HEADER, with the
1N/A# fields enclosed by brackets "[]" replaced with your own identifying
1N/A# information: Portions Copyright [yyyy] [name of copyright owner]
1N/A#
1N/A# CDDL HEADER END
1N/A#
1N/A
1N/A#
1N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
1N/A# Use is subject to license terms.
1N/A#
1N/A# ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A#
1N/A# This script tests that the firing order of probes in a process is:
1N/A#
1N/A# 1. proc:::start
1N/A# 2. proc:::lwp-start
1N/A# 3. proc:::lwp-exit
1N/A# 4. proc:::exit
1N/A#
1N/A# If this fails, the script will run indefinitely; it relies on the harness
1N/A# to time it out.
1N/A#
1N/Ascript()
1N/A{
1N/A $dtrace -s /dev/stdin <<EOF
1N/A proc:::start
1N/A /curpsinfo->pr_ppid == $child/
1N/A {
1N/A self->start = 1;
1N/A }
1N/A
1N/A proc:::lwp-start
1N/A /self->start/
1N/A {
1N/A self->lwp_start = 1;
1N/A }
1N/A
1N/A proc:::lwp-exit
1N/A /self->lwp_start/
1N/A {
1N/A self->lwp_exit = 1;
1N/A }
1N/A
1N/A proc:::exit
1N/A /self->lwp_exit == 1/
1N/A {
1N/A exit(0);
1N/A }
1N/AEOF
1N/A}
1N/A
1N/Asleeper()
1N/A{
1N/A while true; do
1N/A /usr/bin/sleep 1
1N/A done
1N/A}
1N/A
1N/Aif [ $# != 1 ]; then
1N/A echo expected one argument: '<'dtrace-path'>'
1N/A exit 2
1N/Afi
1N/A
1N/Adtrace=$1
1N/A
1N/Asleeper &
1N/Achild=$!
1N/A
1N/Ascript
1N/Astatus=$?
1N/A
1N/Akill $child
1N/Aexit $status
1N/A