Test that the dtrace UDP receive probe fires.

This test ensures that the fix committed in
https://svnweb.freebsd.org/changeset/base/336551
actually works.

Reviewed by:		dteske@, markj@, rrs@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D16046
This commit is contained in:
tuexen 2018-07-20 15:37:29 +00:00
parent ff46e28acc
commit 7f7ead5426
2 changed files with 14 additions and 6 deletions

View File

@ -25,7 +25,7 @@
#
#
# Test ip:::{send,receive} of IPv4 UDP to a local address.
# Test {ip,udp}:::{send,receive} of IPv4 UDP to a local address.
#
# This may fail due to:
#
@ -42,11 +42,11 @@
# 1 x ip:::send (UDP sent to UDP port 33434)
# 1 x udp:::send (UDP sent to UDP port 33434)
# 1 x ip:::receive (UDP received)
# 1 x udp:::receive (UDP received)
#
# No udp:::receive event is expected since the UDP packet elicts
# an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally
# the echo request UDP packet only reaches IP, so the udp:::receive probe
# is not triggered by it.
# A udp:::receive event is expected even if the received UDP packet
# elicits an ICMP PORT_UNREACHABLE message since there is no UDP
# socket for receiving the packet.
#
if (( $# != 1 )); then
@ -77,7 +77,7 @@ EOPERL
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
BEGIN
{
ipsend = udpsend = ipreceive = 0;
ipsend = udpsend = ipreceive = udpreceive = 0;
}
ip:::send
@ -100,12 +100,19 @@ ip:::receive
ipreceive++;
}
udp:::receive
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
{
udpreceive++;
}
END
{
printf("Minimum UDP events seen\n\n");
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no");
printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
printf("udp:::receive - %s\n", udpreceive >= 1 ? "yes" : "no");
}
EODTRACE

View File

@ -3,4 +3,5 @@ Minimum UDP events seen
ip:::send - yes
ip:::receive - yes
udp:::send - yes
udp:::receive - yes