Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 2015 09:32:03 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r291764 - in stable/10: contrib/netbsd-tests/kernel tests/sys/kern
Message-ID:  <201512040932.tB49W3mm055505@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Dec  4 09:32:03 2015
New Revision: 291764
URL: https://svnweb.freebsd.org/changeset/base/291764

Log:
  MFC r290913,r291181:
  
  r290913:
  
  Port contrib/netbsd-tests/kernel/t_mqueue.c to FreeBSD
  
  - Add missing headers
  - Ensure mqueuefs is loaded
  - Make sure the mqueuefs path is absolute and relative to /
  - Cast the result of mq_open returning -1 to (mqd_t) to mute a compiler
    warning
  
  Sponsored by: EMC / Isilon Storage Division
  
  r291181:
  
  Integrate contrib/netbsd-tests/kernel/t_mqueue into the FreeBSD test
  suite as tests/sys/kern/mqueue_test

Modified:
  stable/10/contrib/netbsd-tests/kernel/t_mqueue.c
  stable/10/tests/sys/kern/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/netbsd-tests/kernel/t_mqueue.c
==============================================================================
--- stable/10/contrib/netbsd-tests/kernel/t_mqueue.c	Fri Dec  4 09:29:47 2015	(r291763)
+++ stable/10/contrib/netbsd-tests/kernel/t_mqueue.c	Fri Dec  4 09:32:03 2015	(r291764)
@@ -6,6 +6,13 @@
  * This file is in the Public Domain.
  */
 
+#ifdef __FreeBSD__
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "freebsd_test_suite/macros.h"
+#endif
+
 #include <atf-c.h>
 
 #include <stdio.h>
@@ -111,16 +118,28 @@ ATF_TC_BODY(mqueue, tc)
 	char template[32];
 	char mq_name[64];
 
+#ifdef __FreeBSD__
+	ATF_REQUIRE_KERNEL_MODULE("mqueuefs");
+#endif
+
 	strlcpy(template, "./t_mqueue.XXXXXX", sizeof(template));
 	tmpdir = mkdtemp(template);
 	ATF_REQUIRE_MSG(tmpdir != NULL, "mkdtemp failed: %d", errno);
+#ifdef __FreeBSD__
+	snprintf(mq_name, sizeof(mq_name), "/t_mqueue");
+#else
 	snprintf(mq_name, sizeof(mq_name), "%s/mq", tmpdir);
+#endif
 
 	mqd_t mqfd;
 
 	mqfd = mq_open(mq_name, O_RDWR | O_CREAT,
 	    S_IRUSR | S_IRWXG | S_IROTH, NULL);
+#ifdef __FreeBSD__
+	ATF_REQUIRE_MSG(mqfd != (mqd_t)-1, "mq_open failed: %d", errno);
+#else
 	ATF_REQUIRE_MSG(mqfd != -1, "mq_open failed: %d", errno);
+#endif
 
 	send_msgs(mqfd);
 	receive_msgs(mqfd);

Modified: stable/10/tests/sys/kern/Makefile
==============================================================================
--- stable/10/tests/sys/kern/Makefile	Fri Dec  4 09:29:47 2015	(r291763)
+++ stable/10/tests/sys/kern/Makefile	Fri Dec  4 09:32:03 2015	(r291764)
@@ -15,6 +15,11 @@ LDADD.ptrace_test+=			-lpthread
 LDADD.unix_seqpacket_test+=		-lpthread
 
 NETBSD_ATF_TESTS_C+=	lockf_test
+NETBSD_ATF_TESTS_C+=	mqueue_test
+
+CFLAGS.mqueue_test+=	-I${SRCTOP}/tests
+DPADD.mqueue_test+=	${LIBRT}
+LDADD.mqueue_test+=	-lrt
 
 WARNS?=	5
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512040932.tB49W3mm055505>