From owner-svn-src-all@freebsd.org Sun Jul 15 20:34:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6306710279E1; Sun, 15 Jul 2018 20:34:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1564E96ED9; Sun, 15 Jul 2018 20:34:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB59A12E0E; Sun, 15 Jul 2018 20:34:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6FKYMwL085940; Sun, 15 Jul 2018 20:34:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6FKYMlR085937; Sun, 15 Jul 2018 20:34:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807152034.w6FKYMlR085937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 15 Jul 2018 20:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336315 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/ip usr.sbin/dtrace/tests/tools X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/ip usr.sbin/dtrace/tests/tools X-SVN-Commit-Revision: 336315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2018 20:34:23 -0000 Author: tuexen Date: Sun Jul 15 20:34:22 2018 New Revision: 336315 URL: https://svnweb.freebsd.org/changeset/base/336315 Log: Fix the UDP tests for dtrace. The code imported from opensolaris was depending on ping supporting UDP for sending probes. Since this is not supported by ping on FreeBSD use a perl script instead. The remote test requires the usage of ksh93, so state that in the sheband. Enable the local test, but keep the remote test disabled, since it requires a remote machine on the LAN. Reviewed by: markj@, gnn@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16268 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh Sun Jul 15 19:25:15 2018 (r336314) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh Sun Jul 15 20:34:22 2018 (r336315) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh # # CDDL HEADER START # @@ -36,14 +36,14 @@ # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # -# This test sends a UDP message using ping and checks that at least the +# This test sends a UDP message using perl and checks that at least the # following counts were traced: # -# 1 x ip:::send (UDP sent to ping's base UDP port) -# 1 x udp:::send (UDP sent to ping's base UDP port) +# 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) # -# No udp:::receive event is expected as the response ping -U elicits is +# 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. @@ -56,8 +56,25 @@ fi dtrace=$1 local=127.0.0.1 +port=33434 +DIR=/var/tmp/dtest.$$ -$dtrace -c "/sbin/ping -U $local" -qs /dev/stdin < test.pl <<-EOPERL + use IO::Socket; + my \$s = IO::Socket::INET->new( + Proto => "udp", + PeerAddr => "$local", + PeerPort => $port); + die "Could not create UDP socket $local port $port" unless \$s; + send \$s, "Hello", 0; + close \$s; + sleep(2); +EOPERL + +$dtrace -c 'perl test.pl' -qs /dev/stdin <= 1 ? "yes" : "no"); printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); } -EOF +EODTRACE + +status=$? + +cd / +/bin/rm -rf $DIR + +exit $status Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh Sun Jul 15 19:25:15 2018 (r336314) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh Sun Jul 15 20:34:22 2018 (r336315) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh93 # # CDDL HEADER START # @@ -36,7 +36,7 @@ # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # -# This test sends a UDP message using ping and checks that at least the +# This test sends a UDP message using perl and checks that at least the # following counts were traced: # # 1 x ip:::send (UDP sent to ping's base UDP port) @@ -50,6 +50,8 @@ fi dtrace=$1 getaddr=./get.ipv4remote.pl +port=33434 +DIR=/var/tmp/dtest.$$ if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" @@ -60,7 +62,22 @@ if (( $? != 0 )); then exit 4 fi -$dtrace -c "/sbin/ping -U $dest" -qs /dev/stdin < test.pl <<-EOPERL + use IO::Socket; + my \$s = IO::Socket::INET->new( + Proto => "udp", + PeerAddr => "$dest", + PeerPort => $port); + die "Could not create UDP socket $dest port $port" unless \$s; + send \$s, "Hello", 0; + close \$s; + sleep(2); +EOPERL + +$dtrace -c 'perl test.pl' -qs /dev/stdin <= 1 ? "yes" : "no"); printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); } -EOF +EODTRACE + +status=$? + +cd / +/bin/rm -rf $DIR + +exit $status Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Sun Jul 15 19:25:15 2018 (r336314) +++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Sun Jul 15 20:34:22 2018 (r336315) @@ -33,7 +33,6 @@ exclude EXFAIL common/funcs/tst.copyin.d exclude EXFAIL common/funcs/tst.copyinto.d exclude EXFAIL common/funcs/tst.ddi_pathname.d exclude EXFAIL common/io/tst.fds.d -exclude EXFAIL common/ip/tst.ipv4localudp.ksh exclude EXFAIL common/mdb/tst.dtracedcmd.ksh exclude EXFAIL common/misc/tst.dofmax.ksh exclude EXFAIL common/misc/tst.include.ksh