From be029a4979f40d472ab142c6612f85c2fb67a95b Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 20 Jul 2018 15:37:29 +0000 Subject: [PATCH] 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 --- .../test/tst/common/ip/tst.ipv4localudp.ksh | 19 +++++++++++++------ .../tst/common/ip/tst.ipv4localudp.ksh.out | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh index 323a6e56acbf..196448b66027 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh @@ -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 <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 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out index bca55327ef57..d94aa3104dad 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out @@ -3,4 +3,5 @@ Minimum UDP events seen ip:::send - yes ip:::receive - yes udp:::send - yes +udp:::receive - yes