svn commit: r292821 - head/tests/sys/kern

Garrett Cooper ngie at FreeBSD.org
Mon Dec 28 02:35:00 UTC 2015


Author: ngie
Date: Mon Dec 28 02:34:59 2015
New Revision: 292821
URL: https://svnweb.freebsd.org/changeset/base/292821

Log:
  - Remove unused but set ssize in shutdown_send_sigpipe
  - Add #ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS` for untestable code
    because FreeBSD doesn't have a means to map source addresses for
    SEQ_PACKET AF_UNIX sockets (paraphrased). Put pathname variable
    under the #ifdef to mute another unused but set variable warning
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tests/sys/kern/unix_seqpacket_test.c

Modified: head/tests/sys/kern/unix_seqpacket_test.c
==============================================================================
--- head/tests/sys/kern/unix_seqpacket_test.c	Mon Dec 28 02:28:12 2015	(r292820)
+++ head/tests/sys/kern/unix_seqpacket_test.c	Mon Dec 28 02:34:59 2015	(r292821)
@@ -671,7 +671,9 @@ ATF_TC_BODY(send_recv, tc)
 ATF_TC_WITHOUT_HEAD(sendto_recvfrom);
 ATF_TC_BODY(sendto_recvfrom, tc)
 {
+#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS
 	const char* path;
+#endif
 	struct sockaddr_storage from;
 	int sv[2];
 	const int bufsize = 64;
@@ -682,7 +684,10 @@ ATF_TC_BODY(sendto_recvfrom, tc)
 	socklen_t fromlen;
 
 	/* setup the socket pair */
-	path = mk_pair_of_sockets(sv);
+#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS
+	path =
+#endif
+		mk_pair_of_sockets(sv);
 
 	/* send and receive a small packet */
 	datalen = strlen(data) + 1;	/* +1 for the null */
@@ -703,14 +708,16 @@ ATF_TC_BODY(sendto_recvfrom, tc)
 	}
 	ATF_CHECK_EQ(datalen, rsize);
 
+#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS
 	/*
 	 * FreeBSD does not currently provide the source address for SEQ_PACKET
 	 * AF_UNIX sockets, and POSIX does not require it, so these two checks
 	 * are disabled.  If FreeBSD gains that feature in the future, then
 	 * these checks may be reenabled
 	 */
-	/* ATF_CHECK_EQ(PF_LOCAL, from.ss_family); */
-	/* ATF_CHECK_STREQ(path, ((struct sockaddr_un*)&from)->sun_path); */
+	ATF_CHECK_EQ(PF_LOCAL, from.ss_family);
+	ATF_CHECK_STREQ(path, ((struct sockaddr_un*)&from)->sun_path);
+#endif
 	close(sv[0]);
 	close(sv[1]);
 }
@@ -795,7 +802,6 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc)
 	/* ATF's isolation mechanisms will guarantee uniqueness of this file */
 	const char *path = "sock";
 	const char *data = "data";
-	ssize_t ssize;
 	int s, err, s2;
 
 	s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
@@ -820,7 +826,7 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc)
 
 	ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR));
 	ATF_REQUIRE(SIG_ERR != signal(SIGPIPE, shutdown_send_sigpipe_handler));
-	ssize = send(s2, data, sizeof(data), MSG_EOR);
+	(void)send(s2, data, sizeof(data), MSG_EOR);
 	ATF_CHECK_EQ(1, got_sigpipe);
 	close(s);
 	close(s2);


More information about the svn-src-head mailing list