svn commit: r336597 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/ip usr.sbin/dtrace/tests/tools

Michael Tuexen tuexen at FreeBSD.org
Sun Jul 22 10:51:02 UTC 2018


Author: tuexen
Date: Sun Jul 22 10:50:59 2018
New Revision: 336597
URL: https://svnweb.freebsd.org/changeset/base/336597

Log:
  Improve TCP related tests for dtrace.
  
  Ensure that the TCP connections are terminated gracefully as expected
  by the test. Use appropriate numbers for sent/received packets.
  In addition, enable tst.localtcpstate.ksh, which should pass, but
  doesn't until https://reviews.freebsd.org/D16369 is committed.
  
  Reviewed by:		markj@
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D16288

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
  head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh	Sun Jul 22 05:37:58 2018	(r336596)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh	Sun Jul 22 10:50:59 2018	(r336597)
@@ -38,17 +38,14 @@
 # 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)
-# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
-# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
-# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
+# 7 x ip:::send (3 during the setup, 4 during the teardown)
+# 7 x tcp:::send (3 during the setup, 4 during the teardown)
+# 7 x ip:::receive (3 during the setup, 4 during the teardown)
+# 7 x tcp:::receive (3 during the setup, 4 during the teardown)
 
-# The actual count tested is 5 each way, since we are tracing both
+# The actual count tested is 7 each way, since we are tracing both
 # source and destination events.
 #
-# For this test to work, we are assuming that the TCP handshake and
-# TCP close will enter the IP code path and not use tcp fusion.
-#
 
 if (( $# != 1 )); then
 	print -u2 "expected one argument: <dtrace-path>"
@@ -123,10 +120,10 @@ tcp:::receive
 END
 {
 	printf("Minimum TCP events seen\n\n");
-	printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
-	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
-	printf("tcp:::send - %s\n", tcpsend >= 5 ? "yes" : "no");
-	printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");
+	printf("ip:::send - %s\n", ipsend >= 7 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 7 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 7 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 7 ? "yes" : "no");
 }
 EODTRACE
 

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh	Sun Jul 22 05:37:58 2018	(r336596)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh	Sun Jul 22 10:50:59 2018	(r336597)
@@ -39,11 +39,12 @@
 # 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)
-# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
-# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
-# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
-# 
+# 4 x ip:::send (2 during connection setup, 2 during connection teardown)
+# 4 x tcp:::send (2 during connection setup, 2 during connection teardown)
+# 5 x ip:::receive (1 during connection setup, the response, 1 window update,
+#                   1 banner line, 2 during connection teardown)
+# 5 x tcp:::receive (1 during connection setup, the response, 1 window update,
+#                    1 banner line, 2 during connection teardown)
 
 if (( $# != 1 )); then
 	print -u2 "expected one argument: <dtrace-path>"
@@ -75,6 +76,7 @@ cat > test.pl <<-EOPERL
 	    PeerPort => $tcpport,
 	    Timeout => 3);
 	die "Could not connect to host $dest port $tcpport" unless \$s;
+	readline \$s;
 	close \$s;
 	sleep(2);
 EOPERL
@@ -114,10 +116,10 @@ tcp:::receive
 END
 {
 	printf("Minimum TCP events seen\n\n");
-	printf("ip:::send - %s\n", ipsend >= 3 ? "yes" : "no");
-	printf("ip:::receive - %s\n", ipreceive >= 2 ? "yes" : "no");
-	printf("tcp:::send - %s\n", tcpsend >= 3 ? "yes" : "no");
-	printf("tcp:::receive - %s\n", tcpreceive >= 2 ? "yes" : "no");
+	printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");
 }
 EODTRACE
 

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 22 05:37:58 2018	(r336596)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh	Sun Jul 22 10:50:59 2018	(r336597)
@@ -42,18 +42,14 @@
 # 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)
-# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
-# 3 x tcp:::receive (1 during the TCP handshake, 1 message then the FIN ACK)
+# 7 x ip:::send (3 during the setup, 4 during the teardown)
+# 7 x tcp:::send (3 during the setup, 4 during the teardown)
+# 7 x ip:::receive (3 during the setup, 4 during the teardown)
+# 7 x tcp:::receive (3 during the setup, 4 during the teardown)
 #
-# The actual ip count tested is 5 each way, since we are tracing both
-# source and destination events.  The actual tcp count tested is 7
-# each way, since the TCP fusion send/receive events will not reach IP.
+# The actual count tested is 7 each way, since we are tracing both
+# source and destination events.
 #
-# For this test to work, we are assuming that the TCP handshake and
-# TCP close will enter the IP code path and not use tcp fusion.
-#
 
 if (( $# != 1 )); then
 	print -u2 "expected one argument: <dtrace-path>"
@@ -157,8 +153,8 @@ tcp:::accept-established
 END
 {
 	printf("Minimum TCP events seen\n\n");
-	printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
-	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
+	printf("ip:::send - %s\n", ipsend >= 7 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 7 ? "yes" : "no");
 	printf("tcp:::send - %s\n", tcpsend >= 7 ? "yes" : "no");
 	printf("tcp:::receive - %s\n", tcpreceive >= 7 ? "yes" : "no");
 	printf("tcp:::state-change to syn-sent - %s\n",

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh	Sun Jul 22 05:37:58 2018	(r336596)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh	Sun Jul 22 10:50:59 2018	(r336597)
@@ -43,14 +43,13 @@
 # This test performs a TCP connection to the ssh service (port 22) and
 # checks that at least the following packet counts were traced:
 #
-# 4 x ip:::send (2 during the TCP handshake, the message, then a FIN)
-# 4 x tcp:::send (2 during the TCP handshake, the messages, then a FIN)
-# 3 x ip:::receive (1 during the TCP handshake, the response, then the FIN ACK)
-# 3 x tcp:::receive (1 during the TCP handshake, the response, then the FIN ACK)
+# 4 x ip:::send (2 during connection setup, 2 during connection teardown)
+# 4 x tcp:::send (2 during connection setup, 2 during connection teardown)
+# 5 x ip:::receive (1 during connection setup, the response, 1 window update,
+#                   1 banner line, 2 during connection teardown)
+# 5 x tcp:::receive (1 during connection setup, the response, 1 window update,
+#                    1 banner line, 2 during connection teardown)
 #
-# For this test to work, we are assuming that the TCP handshake and
-# TCP close will enter the IP code path and not use tcp fusion.
-#
 
 if (( $# != 1 )); then
 	print -u2 "expected one argument: <dtrace-path>"
@@ -82,7 +81,7 @@ cat > test.pl <<-EOPERL
 	    PeerPort => $tcpport,
 	    Timeout => 3);
 	die "Could not connect to host $dest port $tcpport" unless \$s;
-	print \$s "testing state machine transitions";
+	readline \$s;
 	close \$s;
 	sleep(2);
 EOPERL
@@ -145,9 +144,9 @@ END
 {
 	printf("Minimum TCP events seen\n\n");
 	printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no");
-	printf("ip:::receive - %s\n", ipreceive >= 3 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
 	printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no");
-	printf("tcp:::receive - %s\n", tcpreceive >= 3 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");
 	printf("tcp:::state-change to syn-sent - %s\n",
 	    state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no");
 	printf("tcp:::state-change to established - %s\n",

Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
==============================================================================
--- head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh	Sun Jul 22 05:37:58 2018	(r336596)
+++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh	Sun Jul 22 10:50:59 2018	(r336597)
@@ -121,9 +121,6 @@ exclude EXFAIL common/ip/tst.ipv4remotetcp.ksh
 exclude EXFAIL common/ip/tst.ipv4remoteudp.ksh
 exclude EXFAIL common/ip/tst.ipv6remoteicmp.ksh
 exclude EXFAIL common/ip/tst.ipv4remoteicmp.ksh
-
-# FreeBSD never places tcpcbs in the TIME_WAIT state, so the probe never fires.
-exclude EXFAIL common/ip/tst.localtcpstate.ksh
 exclude EXFAIL common/ip/tst.remotetcpstate.ksh
 
 # Tries to enable pid$target:libc::entry, though there's no "libc" module.


More information about the svn-src-all mailing list