xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/mib/tst.icmp.ksh (revision 4926:0c0bcae7290e)
12633Sahl#
22633Sahl# CDDL HEADER START
32633Sahl#
42633Sahl# The contents of this file are subject to the terms of the
52633Sahl# Common Development and Distribution License (the "License").
62633Sahl# You may not use this file except in compliance with the License.
72633Sahl#
82633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl# or http://www.opensolaris.org/os/licensing.
102633Sahl# See the License for the specific language governing permissions
112633Sahl# and limitations under the License.
122633Sahl#
132633Sahl# When distributing Covered Code, include this CDDL HEADER in each
142633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl# If applicable, add the following below this CDDL HEADER, with the
162633Sahl# fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl# information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl#
192633Sahl# CDDL HEADER END
202633Sahl#
212633Sahl
222633Sahl#
23*4926Sjhaslam# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
242633Sahl# Use is subject to license terms.
252633Sahl#
26*4926Sjhaslam# ident	"%Z%%M%	%I%	%E% SMI"
272633Sahl
282633Sahl#
292633Sahl# This script tests that several of the the mib:::icmp* probes fire and fire
302633Sahl# with a valid args[0].
312633Sahl#
322633Sahlscript()
332633Sahl{
342633Sahl	$dtrace -s /dev/stdin <<EOF
352633Sahl	mib:::icmpInEchos
362633Sahl	{
372633Sahl		in = args[0];
382633Sahl	}
392633Sahl
402633Sahl	mib:::icmpOutEchoReps
412633Sahl	{
422633Sahl		reps = args[0];
432633Sahl	}
442633Sahl
452633Sahl	mib:::icmpOutMsgs
462633Sahl	{
472633Sahl		msgs = args[0];
482633Sahl	}
492633Sahl
502633Sahl	profile:::tick-10msec
512633Sahl	/in && reps && msgs/
522633Sahl	{
532633Sahl		exit(0);
542633Sahl	}
552633SahlEOF
562633Sahl}
572633Sahl
582633Sahlpinger()
592633Sahl{
602633Sahl	while true; do
612633Sahl		ping -A inet localhost
622633Sahl		/usr/bin/sleep 1
632633Sahl	done
642633Sahl}
652633Sahl
662804Stomeeif [ $# != 1 ]; then
672804Stomee	echo expected one argument: '<'dtrace-path'>'
682804Stomee	exit 2
692804Stomeefi
702804Stomee
712804Stomeedtrace=$1
722633Sahl
732633Sahlpinger &
742633Sahlpinger=$!
752633Sahlscript
762633Sahlstatus=$?
772633Sahl
782633Sahlkill $pinger
792633Sahlexit $status
80