tst.udp.ksh revision 14ea49401f3c8c61422aefbda43809e275f60c6c
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# CDDL HEADER START
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# The contents of this file are subject to the terms of the
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# Common Development and Distribution License (the "License").
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# You may not use this file except in compliance with the License.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# or http://www.opensolaris.org/os/licensing.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# See the License for the specific language governing permissions
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# and limitations under the License.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# When distributing Covered Code, include this CDDL HEADER in each
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# If applicable, add the following below this CDDL HEADER, with the
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# fields enclosed by brackets "[]" replaced with your own identifying
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# information: Portions Copyright [yyyy] [name of copyright owner]
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# CDDL HEADER END
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# Use is subject to license terms.
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# ident "%Z%%M% %I% %E% SMI"
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# This script tests that several of the the mib:::udp* probes fire and fire
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest# with a valid args[0].
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest#
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrestscript()
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest{
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest $dtrace -s /dev/stdin <<EOF
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest mib:::udpHCOutDatagrams
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest {
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest out = args[0];
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest }
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest mib:::udpHCInDatagrams
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest {
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest in = args[0];
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest }
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest profile:::tick-10msec
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest /in && out/
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest {
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest exit(0);
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest }
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew ForrestEOF
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest}
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrestrupper()
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest{
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest while true; do
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest rup localhost
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest /usr/bin/sleep 1
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest done
}
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
rupper &
rupper=$!
script
status=$?
kill $rupper
exit $status