From owner-svn-src-all@freebsd.org Sun Jul 15 20:41:17 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 61DDD1027F13; Sun, 15 Jul 2018 20:41:17 +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 12D979729C; Sun, 15 Jul 2018 20:41:17 +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 E817712E4F; Sun, 15 Jul 2018 20:41:16 +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 w6FKfG1a086985; Sun, 15 Jul 2018 20:41:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6FKfG1M086984; Sun, 15 Jul 2018 20:41:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807152041.w6FKfG1M086984@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:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336316 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Commit-Revision: 336316 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:41:17 -0000 Author: tuexen Date: Sun Jul 15 20:41:16 2018 New Revision: 336316 URL: https://svnweb.freebsd.org/changeset/base/336316 Log: Don't require a local sshd for the local TCP state dtrace test This change is similar to the one done in r286171 for tst.ipv4localtcp.ksh. This not only reduces the requirements on the system used for testing but results also in a graceful teardown of the TCP connection. Reviewed by: gnn@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16276 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Sun Jul 15 20:34:22 2018 (r336315) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Sun Jul 15 20:41:16 2018 (r336316) @@ -36,12 +36,11 @@ # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. The lo0 interface missing or not up. -# 3. The local ssh service is not online. -# 4. An unlikely race causes the unlocked global send/receive +# 3. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # -# This test performs a TCP connection to the ssh service (port 22) and -# checks that at least the following packet counts were traced: +# This test performs a TCP connection and checks that at least the +# following packet counts were traced: # # 3 x ip:::send (2 during the TCP handshake, then a FIN) # 4 x tcp:::send (2 during the TCP handshake, 1 message then a FIN) @@ -63,12 +62,25 @@ fi dtrace=$1 local=127.0.0.1 -tcpport=22 DIR=/var/tmp/dtest.$$ +tcpport=1024 +bound=5000 +while [ $tcpport -lt $bound ]; do + nc -z $local $tcpport >/dev/null || break + tcpport=$(($tcpport + 1)) +done +if [ $tcpport -eq $bound ]; then + echo "couldn't find an available TCP port" + exit 1 +fi + mkdir $DIR cd $DIR +# nc will exit when the connection is closed. +nc -l $local $tcpport & + cat > test.pl <<-EOPERL use IO::Socket; my \$s = IO::Socket::INET->new( @@ -77,7 +89,6 @@ cat > test.pl <<-EOPERL PeerPort => $tcpport, Timeout => 3); die "Could not connect to host $local port $tcpport" unless \$s; - print \$s "testing state machine transitions"; close \$s; sleep(2); EOPERL