dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / ip / tst.ipv4remoteudp.ksh
blobb0893c816145beaaeeb96d4b146fa6c2d06c45ad
1 #!/usr/bin/ksh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
24 # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 # Test {udp,ip}:::{send,receive} of IPv4 UDP to a remote host.
30 # This may fail due to:
32 # 1. A change to the ip stack breaking expected probe behavior,
33 # which is the reason we are testing.
34 # 2. No physical network interface is plumbed and up.
35 # 3. No other hosts on this subnet are reachable and listening on rpcbind.
36 # 4. An unlikely race causes the unlocked global send/receive
37 # variables to be corrupted.
39 # This test sends a UDP message using ping and checks that at least the
40 # following counts were traced:
42 # 1 x ip:::send (UDP sent to ping's base UDP port)
43 # 1 x udp:::send (UDP sent to ping's base UDP port)
46 if (( $# != 1 )); then
47 print -u2 "expected one argument: <dtrace-path>"
48 exit 2
51 dtrace=$1
52 getaddr=./get.ipv4remote.pl
54 if [[ ! -x $getaddr ]]; then
55 print -u2 "could not find or execute sub program: $getaddr"
56 exit 3
58 $getaddr | read source dest
59 if (( $? != 0 )); then
60 exit 4
63 $dtrace -c "/usr/sbin/ping -U $dest" -qs /dev/stdin <<EOF | grep -v 'is alive'
64 BEGIN
66 ipsend = udpsend = 0;
69 ip:::send
70 /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
71 args[4]->ipv4_protocol == IPPROTO_UDP/
73 ipsend++;
76 udp:::send
77 /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
79 udpsend++;
82 END
84 printf("Minimum UDP events seen\n\n");
85 printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
86 printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
88 EOF