Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 2015 12:09:01 +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: r282858 - in stable/10: etc/mtree tests/freebsd_test_suite tests/sys tests/sys/aio tests/sys/mqueue tools/regression/aio/aiotest tools/regression/aio/kqueue tools/regression/mqueue
Message-ID:  <201505131209.t4DC92BL042214@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed May 13 12:09:01 2015
New Revision: 282858
URL: https://svnweb.freebsd.org/changeset/base/282858

Log:
  MFC r281593,r282071,r282074,r282133,r282134,r282135,r282136,r282137,r282138:
  
  r282071:
  
  Integrate tools/regression/mqueue into the FreeBSD test suite as
  tests/sys/mqueue
  
  r282074:
  
  Integrate tools/regression/aio/aiotest and tools/regression/aio/kqueue into the
  FreeBSD test suite as tests/sys/aio
  
  r282133:
  
  Fill in the copyright boilerplate for the test program
  
  r282134:
  
  Add initial (unpolished) macros for interfacing with the FreeBSD test suite
  
  This is very rough, but will be replaced/redesigned some time soon after I fix
  the Jenkins breakage I introduced
  
  r282135:
  
  Use ATF_REQUIRE_KERNEL_MODULE instead of aio_available function
  
  r282136:
  
  - Use ATF_REQUIRE_KERNEL_MDOULE to require aio(4)
  - Don't use /tmp as a basis for temporary files as it's outside of the ATF
    sandbox
  - Don't override MAX macro in sys/param.h
  
  r282137:
  
  Use PLAIN_REQUIRE_KERNEL_MODULE to require "mqueuefs"
  
  r282138:
  
  Adjust CFLAGS to find freebsd_test_suite/macros.h

Added:
  stable/10/tests/freebsd_test_suite/
     - copied from r282134, head/tests/freebsd_test_suite/
  stable/10/tests/sys/aio/
     - copied from r282074, head/tests/sys/aio/
  stable/10/tests/sys/mqueue/
     - copied from r282071, head/tests/sys/mqueue/
Deleted:
  stable/10/tools/regression/aio/aiotest/
  stable/10/tools/regression/aio/kqueue/
  stable/10/tools/regression/mqueue/
Modified:
  stable/10/etc/mtree/BSD.tests.dist
  stable/10/tests/sys/Makefile
  stable/10/tests/sys/aio/Makefile
  stable/10/tests/sys/aio/aio_kqueue_test.c
  stable/10/tests/sys/aio/aio_test.c
  stable/10/tests/sys/aio/lio_kqueue_test.c
  stable/10/tests/sys/mqueue/Makefile
  stable/10/tests/sys/mqueue/mqtest1.c
  stable/10/tests/sys/mqueue/mqtest2.c
  stable/10/tests/sys/mqueue/mqtest3.c
  stable/10/tests/sys/mqueue/mqtest4.c
  stable/10/tests/sys/mqueue/mqtest5.c
  stable/10/tests/sys/mqueue/mqueue_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.tests.dist
==============================================================================
--- stable/10/etc/mtree/BSD.tests.dist	Wed May 13 12:02:51 2015	(r282857)
+++ stable/10/etc/mtree/BSD.tests.dist	Wed May 13 12:09:01 2015	(r282858)
@@ -178,6 +178,8 @@
         ..
     ..
     sys
+        aio
+        ..
         fifo
         ..
         file
@@ -186,6 +188,8 @@
         ..
         kqueue
         ..
+        mqueue
+        ..
         netinet
         ..
         pjdfstest

Modified: stable/10/tests/sys/Makefile
==============================================================================
--- stable/10/tests/sys/Makefile	Wed May 13 12:02:51 2015	(r282857)
+++ stable/10/tests/sys/Makefile	Wed May 13 12:09:01 2015	(r282858)
@@ -4,10 +4,12 @@
 
 TESTSDIR= ${TESTSBASE}/sys
 
+TESTS_SUBDIRS+=		aio
 TESTS_SUBDIRS+=		fifo
 TESTS_SUBDIRS+=		file
 TESTS_SUBDIRS+=		kern
 TESTS_SUBDIRS+=		kqueue
+TESTS_SUBDIRS+=		mqueue
 TESTS_SUBDIRS+=		netinet
 TESTS_SUBDIRS+=		vm
 

Modified: stable/10/tests/sys/aio/Makefile
==============================================================================
--- head/tests/sys/aio/Makefile	Mon Apr 27 08:51:40 2015	(r282074)
+++ stable/10/tests/sys/aio/Makefile	Wed May 13 12:09:01 2015	(r282858)
@@ -9,6 +9,8 @@ ATF_TESTS_C+=	aio_test
 DPADD.aio_test+=	${LIBUTIL}
 LDADD.aio_test+=	-lutil
 
+CFLAGS+=	-I${.CURDIR:H:H}
+
 WARNS?=	6
 
 .include <bsd.test.mk>

Modified: stable/10/tests/sys/aio/aio_kqueue_test.c
==============================================================================
--- head/tests/sys/aio/aio_kqueue_test.c	Mon Apr 27 08:51:40 2015	(r282074)
+++ stable/10/tests/sys/aio/aio_kqueue_test.c	Wed May 13 12:09:01 2015	(r282858)
@@ -46,25 +46,29 @@
 #include <string.h>
 #include <unistd.h>
 
-#define PATH_TEMPLATE   "/tmp/aio.XXXXXXXXXX"
+#include "freebsd_test_suite/macros.h"
 
-#define MAX 128
+#define PATH_TEMPLATE   "aio.XXXXXXXXXX"
+
+#define MAX_IOCBS 128
 #define MAX_RUNS 300
 /* #define DEBUG */
 
 int
 main (int argc, char *argv[])
 {
-	int fd;
-	struct aiocb *iocb[MAX], *kq_iocb;
-	int i, result, run, error, j;
-	char buffer[32768];
-	int kq = kqueue();
+	struct aiocb *iocb[MAX_IOCBS], *kq_iocb;
+	char *file, pathname[sizeof(PATH_TEMPLATE)+1];
 	struct kevent ke, kq_returned;
 	struct timespec ts;
-	int cancel, pending, tmp_file = 0, failed = 0;
-	char *file, pathname[sizeof(PATH_TEMPLATE)+1];
+	char buffer[32768];
+	int cancel, error, failed = 0, fd, kq, pending, result, run;
+	int tmp_file = 0;
+	unsigned i, j;
+
+	PLAIN_REQUIRE_KERNEL_MODULE("aio", 0);
 
+	kq = kqueue();
 	if (kq < 0) {
 		perror("No kqeueue\n");
 		exit(1);
@@ -86,7 +90,7 @@ main (int argc, char *argv[])
 #ifdef DEBUG
 		printf("Run %d\n", run);
 #endif
-		for (i = 0; i < MAX; i++) {
+		for (i = 0; i < nitems(iocb); i++) {
 			iocb[i] = (struct aiocb *)calloc(1,
 			    sizeof(struct aiocb));
 			if (iocb[i] == NULL)
@@ -94,7 +98,7 @@ main (int argc, char *argv[])
 		}
 		
 		pending = 0;	
-		for (i = 0; i < MAX; i++) {
+		for (i = 0; i < nitems(iocb); i++) {
 			pending++;
 			iocb[i]->aio_nbytes = sizeof(buffer);
 			iocb[i]->aio_buf = buffer;
@@ -129,8 +133,8 @@ main (int argc, char *argv[])
 				}
 			}
 		}
-		cancel = MAX - pending;
-		
+		cancel = nitems(iocb) - pending;
+
 		i = 0;
 		while (pending) {
 
@@ -159,11 +163,11 @@ main (int argc, char *argv[])
 					break;
 #ifdef DEBUG
 				printf("Try again left %d out of %d %d\n",
-				    pending, MAX, cancel);
+				    pending, nitems(iocb), cancel);
 #endif
 			}			
 			
-			for (j = 0; j < MAX && iocb[j] != kq_iocb;
+			for (j = 0; j < nitems(iocb) && iocb[j] != kq_iocb;
 			   j++) ;
 #ifdef DEBUG
 			printf("kq_iocb %p\n", kq_iocb);
@@ -190,7 +194,7 @@ main (int argc, char *argv[])
 			i++;
 		}	
 
-		for (i = 0; i < MAX; i++)
+		for (i = 0; i < nitems(iocb); i++)
 			free(iocb[i]);
 
 	}

Modified: stable/10/tests/sys/aio/aio_test.c
==============================================================================
--- head/tests/sys/aio/aio_test.c	Mon Apr 27 08:51:40 2015	(r282074)
+++ stable/10/tests/sys/aio/aio_test.c	Wed May 13 12:09:01 2015	(r282858)
@@ -59,6 +59,8 @@
 
 #include <atf-c.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define	PATH_TEMPLATE	"aio.XXXXXXXXXX"
 
 /*
@@ -82,15 +84,6 @@ struct aio_context {
 
 static int	aio_timedout;
 
-static void
-aio_available(void)
-{
-
-	if (modfind("aio") == -1)
-		atf_tc_skip("aio support not available in the kernel; "
-		    "skipping testcases");
-}
-
 /*
  * Each test run specifies a timeout in seconds.  Use the somewhat obsoleted
  * signal(3) and alarm(3) APIs to set this up.
@@ -211,7 +204,7 @@ aio_write_test(struct aio_context *ac)
 	struct aiocb aio, *aiop;
 	ssize_t len;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	bzero(&aio, sizeof(aio));
 	aio.aio_buf = ac->ac_buffer;
@@ -263,7 +256,7 @@ aio_read_test(struct aio_context *ac)
 	struct aiocb aio, *aiop;
 	ssize_t len;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	bzero(ac->ac_buffer, ac->ac_buflen);
 	bzero(&aio, sizeof(aio));
@@ -346,7 +339,7 @@ ATF_TC_BODY(aio_file_test, tc)
 	struct aio_context ac;
 	int fd;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	strcpy(pathname, PATH_TEMPLATE);
 	fd = mkstemp(pathname);
@@ -392,7 +385,7 @@ ATF_TC_BODY(aio_fifo_test, tc)
 	char pathname[PATH_MAX];
 	struct aio_context ac;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	/*
 	 * In theory, mkstemp() can return a name that is then collided with.
@@ -461,7 +454,7 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc
 	struct aio_context ac;
 	int sockets[2];
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, sockets) != -1,
 	    "socketpair failed: %s", strerror(errno));
@@ -503,7 +496,7 @@ ATF_TC_BODY(aio_pty_test, tc)
 	struct termios ts;
 	int error;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	ATF_REQUIRE_MSG(openpty(&read_fd, &write_fd, NULL, NULL, NULL) == 0,
 	    "openpty failed: %s", strerror(errno));
@@ -550,7 +543,7 @@ ATF_TC_BODY(aio_pipe_test, tc)
 	struct aio_context ac;
 	int pipes[2];
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	ATF_REQUIRE_MSG(pipe(pipes) != -1,
 	    "pipe failed: %s", strerror(errno));
@@ -613,7 +606,7 @@ ATF_TC_BODY(aio_md_test, tc)
 	struct aio_context ac;
 	struct md_ioctl mdio;
 
-	aio_available();
+	ATF_REQUIRE_KERNEL_MODULE("aio");
 
 	mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0);
 	ATF_REQUIRE_MSG(mdctl_fd != -1,

Modified: stable/10/tests/sys/aio/lio_kqueue_test.c
==============================================================================
--- head/tests/sys/aio/lio_kqueue_test.c	Mon Apr 27 08:51:40 2015	(r282074)
+++ stable/10/tests/sys/aio/lio_kqueue_test.c	Wed May 13 12:09:01 2015	(r282858)
@@ -48,16 +48,18 @@
 #include <string.h>
 #include <unistd.h>
 
-#define PATH_TEMPLATE   "/tmp/aio.XXXXXXXXXX"
+#include "freebsd_test_suite/macros.h"
+
+#define PATH_TEMPLATE   "aio.XXXXXXXXXX"
 
 #define LIO_MAX 5
-#define MAX LIO_MAX * 16
+#define MAX_IOCBS LIO_MAX * 16
 #define MAX_RUNS 300
 
 int
 main(int argc, char *argv[]){
 	int fd;
-	struct aiocb *iocb[MAX];
+	struct aiocb *iocb[MAX_IOCBS];
 	struct aiocb **lio[LIO_MAX], **lio_element, **kq_lio;
 	int i, result, run, error, j, k;
 	char buffer[32768];
@@ -69,6 +71,8 @@ main(int argc, char *argv[]){
 	char *file, pathname[sizeof(PATH_TEMPLATE)-1];
 	int tmp_file = 0, failed = 0;
 
+	PLAIN_REQUIRE_KERNEL_MODULE("aio", 0);
+
 	if (kq < 0) {
 		perror("No kqeueue\n");
 		exit(1);
@@ -99,9 +103,9 @@ main(int argc, char *argv[]){
 #endif
 		for (j = 0; j < LIO_MAX; j++) {
 			lio[j] = (struct aiocb **)
-				malloc(sizeof(struct aiocb *) * MAX/LIO_MAX);
-			for(i = 0; i < MAX / LIO_MAX; i++) {
-				k = (MAX / LIO_MAX * j) + i;
+			    malloc(sizeof(struct aiocb *) * MAX_IOCBS/LIO_MAX);
+			for(i = 0; i < MAX_IOCBS / LIO_MAX; i++) {
+				k = (MAX_IOCBS / LIO_MAX * j) + i;
 				lio_element = lio[j];
 				lio[j][i] = iocb[k] = (struct aiocb *)
 					malloc(sizeof(struct aiocb));
@@ -123,7 +127,7 @@ main(int argc, char *argv[]){
 			sig.sigev_notify = SIGEV_KEVENT;
 			time(&time1);
 			result = lio_listio(LIO_NOWAIT, lio[j],
-					    MAX / LIO_MAX, &sig);
+					    MAX_IOCBS / LIO_MAX, &sig);
 			error = errno;
 			time(&time2);
 #ifdef DEBUG
@@ -203,7 +207,7 @@ main(int argc, char *argv[]){
 			} else {
 				printf("PASS: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result);
 			}
-			for(k = 0; k < MAX / LIO_MAX; k++){
+			for(k = 0; k < MAX_IOCBS / LIO_MAX; k++){
 				result = aio_return(kq_lio[k]);
 #ifdef DEBUG
 				printf("Return Resulto for %d %d is %d\n", j, k, result);
@@ -220,7 +224,7 @@ main(int argc, char *argv[]){
 			printf("\n");
 #endif
 
-			for(k = 0; k < MAX / LIO_MAX; k++) {
+			for(k = 0; k < MAX_IOCBS / LIO_MAX; k++) {
 				free(lio[j][k]);
 			}
 			free(lio[j]);

Modified: stable/10/tests/sys/mqueue/Makefile
==============================================================================
--- head/tests/sys/mqueue/Makefile	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/Makefile	Wed May 13 12:09:01 2015	(r282858)
@@ -6,6 +6,8 @@ ATF_TESTS_SH=	mqueue_test
 
 BINDIR=		${TESTSDIR}
 
+CFLAGS+=	-I${.CURDIR:H:H}
+
 PROGS+=		mqtest1
 PROGS+=		mqtest2
 PROGS+=		mqtest3

Modified: stable/10/tests/sys/mqueue/mqtest1.c
==============================================================================
--- head/tests/sys/mqueue/mqtest1.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqtest1.c	Wed May 13 12:09:01 2015	(r282858)
@@ -7,6 +7,8 @@
 #include <signal.h>
 #include <stdio.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define MQNAME	"/mytstqueue1"
 
 int
@@ -17,6 +19,8 @@ main(void)
 	mqd_t mq;
 	int status;
 
+	PLAIN_REQUIRE_KERNEL_MODULE("mqueuefs", 0);
+
 	attr.mq_maxmsg  = 2;
 	attr.mq_msgsize = 100;
 	mq = mq_open(MQNAME, O_CREAT | O_RDWR | O_EXCL, 0666, &attr);

Modified: stable/10/tests/sys/mqueue/mqtest2.c
==============================================================================
--- head/tests/sys/mqueue/mqtest2.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqtest2.c	Wed May 13 12:09:01 2015	(r282858)
@@ -10,6 +10,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define MQNAME	"/mytstqueue2"
 #define LOOPS	1000
 #define PRIO	10
@@ -29,6 +31,8 @@ main(void)
 	int status;
 	pid_t pid;
 	
+	PLAIN_REQUIRE_KERNEL_MODULE("mqueuefs", 0);
+	
 	mq_unlink(MQNAME);
 
 	attr.mq_maxmsg  = 5;

Modified: stable/10/tests/sys/mqueue/mqtest3.c
==============================================================================
--- head/tests/sys/mqueue/mqtest3.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqtest3.c	Wed May 13 12:09:01 2015	(r282858)
@@ -11,6 +11,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define MQNAME	"/mytstqueue3"
 #define LOOPS	1000
 #define PRIO	10
@@ -31,6 +33,8 @@ main(void)
 	mqd_t mq;
 	pid_t pid;
 
+	PLAIN_REQUIRE_KERNEL_MODULE("mqueuefs", 0);
+
 	mq_unlink(MQNAME);
 
 	attr.mq_maxmsg  = 5;

Modified: stable/10/tests/sys/mqueue/mqtest4.c
==============================================================================
--- head/tests/sys/mqueue/mqtest4.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqtest4.c	Wed May 13 12:09:01 2015	(r282858)
@@ -12,6 +12,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define MQNAME	"/mytstqueue4"
 #define LOOPS	1000
 #define PRIO	10
@@ -32,6 +34,8 @@ main(void)
 	int kq, status;
 	pid_t pid;
 
+	PLAIN_REQUIRE_KERNEL_MODULE("mqueuefs", 0);
+
 	mq_unlink(MQNAME);
 
 	attr.mq_maxmsg  = 5;

Modified: stable/10/tests/sys/mqueue/mqtest5.c
==============================================================================
--- head/tests/sys/mqueue/mqtest5.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqtest5.c	Wed May 13 12:09:01 2015	(r282858)
@@ -12,6 +12,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "freebsd_test_suite/macros.h"
+
 #define MQNAME	"/mytstqueue5"
 #define LOOPS	1000
 #define PRIO	10
@@ -34,6 +36,8 @@ main(void)
 	mqd_t mq;
 	pid_t pid;
 
+	PLAIN_REQUIRE_KERNEL_MODULE("mqueuefs", 0);
+
 	mq_unlink(MQNAME);
 
 	sigemptyset(&set);

Modified: stable/10/tests/sys/mqueue/mqueue_test.sh
==============================================================================
--- head/tests/sys/mqueue/mqueue_test.sh	Mon Apr 27 08:31:43 2015	(r282071)
+++ stable/10/tests/sys/mqueue/mqueue_test.sh	Wed May 13 12:09:01 2015	(r282858)
@@ -1,3 +1,30 @@
+#
+# Copyright (c) 2015 EMC / Isilon Storage Division
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
 
 mqtest1_head()
 {



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