svn commit: r281450 - in user/ngie/more-tests: etc/mtree tests/sys tests/sys/fifo tests/sys/fifo/fifo_create tests/sys/fifo/fifo_io tests/sys/fifo/fifo_misc tests/sys/fifo/fifo_open tools/regressio...
Garrett Cooper
ngie at FreeBSD.org
Sun Apr 12 06:18:27 UTC 2015
Author: ngie
Date: Sun Apr 12 06:18:24 2015
New Revision: 281450
URL: https://svnweb.freebsd.org/changeset/base/281450
Log:
Integrate tools/regression/fifo into the FreeBSD test suite as tests/sys/fifo
Added:
user/ngie/more-tests/tests/sys/fifo/
- copied from r281446, user/ngie/more-tests/tools/regression/fifo/
user/ngie/more-tests/tests/sys/fifo/fifo_create.c
- copied, changed from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_create/fifo_create.c
user/ngie/more-tests/tests/sys/fifo/fifo_io.c
- copied, changed from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_io/fifo_io.c
user/ngie/more-tests/tests/sys/fifo/fifo_misc.c
- copied, changed from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_misc/fifo_misc.c
user/ngie/more-tests/tests/sys/fifo/fifo_open.c
- copied, changed from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_open/fifo_open.c
Deleted:
user/ngie/more-tests/tests/sys/fifo/fifo_create/
user/ngie/more-tests/tests/sys/fifo/fifo_io/
user/ngie/more-tests/tests/sys/fifo/fifo_misc/
user/ngie/more-tests/tests/sys/fifo/fifo_open/
user/ngie/more-tests/tools/regression/fifo/
Modified:
user/ngie/more-tests/etc/mtree/BSD.tests.dist
user/ngie/more-tests/tests/sys/Makefile
Modified: user/ngie/more-tests/etc/mtree/BSD.tests.dist
==============================================================================
--- user/ngie/more-tests/etc/mtree/BSD.tests.dist Sun Apr 12 06:00:13 2015 (r281449)
+++ user/ngie/more-tests/etc/mtree/BSD.tests.dist Sun Apr 12 06:18:24 2015 (r281450)
@@ -354,6 +354,8 @@
..
..
sys
+ fifo
+ ..
file
..
kern
Modified: user/ngie/more-tests/tests/sys/Makefile
==============================================================================
--- user/ngie/more-tests/tests/sys/Makefile Sun Apr 12 06:00:13 2015 (r281449)
+++ user/ngie/more-tests/tests/sys/Makefile Sun Apr 12 06:18:24 2015 (r281450)
@@ -4,6 +4,7 @@
TESTSDIR= ${TESTSBASE}/sys
+TESTS_SUBDIRS+= fifo
TESTS_SUBDIRS+= file
TESTS_SUBDIRS+= kern
TESTS_SUBDIRS+= kqueue
Copied and modified: user/ngie/more-tests/tests/sys/fifo/fifo_create.c (from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_create/fifo_create.c)
==============================================================================
--- user/ngie/more-tests/tools/regression/fifo/fifo_create/fifo_create.c Sun Apr 12 01:14:43 2015 (r281446, copy source)
+++ user/ngie/more-tests/tests/sys/fifo/fifo_create.c Sun Apr 12 06:18:24 2015 (r281450)
@@ -75,7 +75,7 @@
* All activity occurs within a temporary directory created early in the
* test.
*/
-char temp_dir[PATH_MAX];
+static char temp_dir[PATH_MAX];
static void __unused
atexit_temp_dir(void)
@@ -94,7 +94,7 @@ fifo_create_test(int use_mkfifo)
{
struct stat old_dirsb, dirsb, fifosb;
const char *testname;
- char path[PATH_MAX];
+ char path[] = "testfifo";
int error;
if (use_mkfifo)
@@ -106,14 +106,12 @@ fifo_create_test(int use_mkfifo)
* Sleep to make sure that the time stamp on the directory will be
* updated.
*/
- if (stat(temp_dir, &old_dirsb) < 0)
+ if (stat(".", &old_dirsb) < 0)
err(-1, "basic_create_test: %s: stat: %s", testname,
temp_dir);
sleep(2);
- snprintf(path, PATH_MAX, "%s/testfifo", temp_dir);
-
if (use_mkfifo) {
if (mkfifo(path, 0600) < 0)
err(-1, "basic_create_test: %s: %s", testname, path);
@@ -149,7 +147,7 @@ fifo_create_test(int use_mkfifo)
err(-1, "basic_create_test: dup %s unexpected error",
testname);
- if (stat(temp_dir, &dirsb) < 0) {
+ if (stat(".", &dirsb) < 0) {
error = errno;
(void)unlink(path);
errno = error;
@@ -205,7 +203,7 @@ fifo_permission_test(int use_mkfifo)
{
const struct permission_test *ptp;
mode_t __unused old_umask;
- char path[PATH_MAX];
+ char path[] = "testfifo";
const char *testname;
struct stat sb;
int error, i;
@@ -215,7 +213,6 @@ fifo_permission_test(int use_mkfifo)
else
testname = "mknod";
- snprintf(path, PATH_MAX, "%s/testfifo", temp_dir);
old_umask = umask(0022);
for (i = 0; i < permission_test_count; i++) {
ptp = &permission_test[i];
@@ -256,14 +253,14 @@ fifo_permission_test(int use_mkfifo)
}
int
-main(int argc, char *argv[])
+main(void)
{
int i;
if (geteuid() != 0)
errx(-1, "must be run as root");
- strcpy(temp_dir, "/tmp/fifo_create.XXXXXXXXXXX");
+ strcpy(temp_dir, "fifo_create.XXXXXXXXXXX");
if (mkdtemp(temp_dir) == NULL)
err(-1, "mkdtemp");
atexit(atexit_temp_dir);
Copied and modified: user/ngie/more-tests/tests/sys/fifo/fifo_io.c (from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_io/fifo_io.c)
==============================================================================
--- user/ngie/more-tests/tools/regression/fifo/fifo_io/fifo_io.c Sun Apr 12 01:14:43 2015 (r281446, copy source)
+++ user/ngie/more-tests/tests/sys/fifo/fifo_io.c Sun Apr 12 06:18:24 2015 (r281450)
@@ -88,7 +88,7 @@
* All activity occurs within a temporary directory created early in the
* test.
*/
-char temp_dir[PATH_MAX];
+static char temp_dir[PATH_MAX];
static void __unused
atexit_temp_dir(void)
@@ -130,8 +130,7 @@ cleanfifo3(const char *fifoname, int fd1
* so using non-blocking opens in order to avoid deadlocking the process.
*/
static int
-openfifo(const char *fifoname, const char *testname, int *reader_fdp,
- int *writer_fdp)
+openfifo(const char *fifoname, int *reader_fdp, int *writer_fdp)
{
int error, fd1, fd2;
@@ -155,7 +154,7 @@ openfifo(const char *fifoname, const cha
* Open one file descriptor for the fifo, supporting both read and write.
*/
static int
-openfifo_rw(const char *fifoname, const char *testname, int *fdp)
+openfifo_rw(const char *fifoname, int *fdp)
{
int fd;
@@ -249,7 +248,7 @@ test_simpleio(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", "test_simpleio", &reader_fd, &writer_fd)
+ if (openfifo("testfifo", &reader_fd, &writer_fd)
< 0) {
warn("test_simpleio: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
@@ -296,12 +295,12 @@ test_simpleio(void)
cleanfifo2("testfifo", reader_fd, writer_fd);
}
-static int alarm_fired;
+static volatile int alarm_fired;
/*
* Non-destructive SIGALRM handler.
*/
static void
-sigalarm(int signum)
+sigalarm(int signum __unused)
{
alarm_fired = 1;
@@ -408,7 +407,7 @@ test_blocking_read_empty(void)
u_char ch;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
+ if (openfifo("testfifo", &reader_fd, &writer_fd)
< 0) {
warn("test_blocking_read_empty: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
@@ -477,8 +476,7 @@ test_blocking_one_byte(void)
u_char ch;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_blocking: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -544,8 +542,7 @@ test_nonblocking_one_byte(void)
u_char ch;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_nonblocking: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -609,8 +606,7 @@ test_blocking_partial_write(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_blocking_partial_write: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -668,8 +664,7 @@ test_nonblocking_partial_write(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_blocking_partial_write: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -736,8 +731,7 @@ test_coalesce_big_read(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_coalesce_big_read: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -808,8 +802,7 @@ test_coalesce_big_write(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_coalesce_big_write: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -1078,7 +1071,7 @@ test_events_outofbox(void)
int kqueue_fd, reader_fd, writer_fd;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_events_outofbox: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -1134,8 +1127,7 @@ test_events_write_read_byte(void)
u_char ch;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_events_write_read_byte: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -1227,8 +1219,7 @@ test_events_partial_write(void)
ssize_t len;
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd)
- < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("test_events_partial_write: openfifo: testfifo");
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -1313,8 +1304,7 @@ test_events_rdwr(void)
char ch;
makefifo("testfifo", __func__);
- if (openfifo_rw("testfifo", __func__, &fd)
- < 0) {
+ if (openfifo_rw("testfifo", &fd) < 0) {
warn("%s: openfifo_rw: testfifo", __func__);
cleanfifo2("testfifo", -1, -1);
exit(-1);
@@ -1381,10 +1371,10 @@ test_events_rdwr(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
- strcpy(temp_dir, "/tmp/fifo_io.XXXXXXXXXXX");
+ strcpy(temp_dir, "fifo_io.XXXXXXXXXXX");
if (mkdtemp(temp_dir) == NULL)
err(-1, "mkdtemp");
atexit(atexit_temp_dir);
Copied and modified: user/ngie/more-tests/tests/sys/fifo/fifo_misc.c (from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_misc/fifo_misc.c)
==============================================================================
--- user/ngie/more-tests/tools/regression/fifo/fifo_misc/fifo_misc.c Sun Apr 12 01:14:43 2015 (r281446, copy source)
+++ user/ngie/more-tests/tests/sys/fifo/fifo_misc.c Sun Apr 12 06:18:24 2015 (r281450)
@@ -50,7 +50,7 @@
* All activity occurs within a temporary directory created early in the
* test.
*/
-char temp_dir[PATH_MAX];
+static char temp_dir[PATH_MAX];
static void __unused
atexit_temp_dir(void)
@@ -79,8 +79,7 @@ cleanfifo(const char *fifoname, int fd1,
}
static int
-openfifo(const char *fifoname, const char *testname, int *reader_fdp,
- int *writer_fdp)
+openfifo(const char *fifoname, int *reader_fdp, int *writer_fdp)
{
int error, fd1, fd2;
@@ -110,7 +109,7 @@ test_lseek(void)
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("%s: openfifo", __func__);
cleanfifo("testfifo", -1, -1);
exit(-1);
@@ -185,7 +184,7 @@ test_ioctl(void)
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("%s: openfifo", __func__);
cleanfifo("testfifo", -1, -1);
exit(-1);
@@ -237,7 +236,7 @@ test_chmodchown(void)
makefifo("testfifo", __func__);
- if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
+ if (openfifo("testfifo", &reader_fd, &writer_fd) < 0) {
warn("%s: openfifo", __func__);
cleanfifo("testfifo", -1, -1);
exit(-1);
@@ -316,10 +315,10 @@ test_chmodchown(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
- strcpy(temp_dir, "/tmp/fifo_misc.XXXXXXXXXXX");
+ strcpy(temp_dir, "fifo_misc.XXXXXXXXXXX");
if (mkdtemp(temp_dir) == NULL)
err(-1, "mkdtemp");
atexit(atexit_temp_dir);
Copied and modified: user/ngie/more-tests/tests/sys/fifo/fifo_open.c (from r281446, user/ngie/more-tests/tools/regression/fifo/fifo_open/fifo_open.c)
==============================================================================
--- user/ngie/more-tests/tools/regression/fifo/fifo_open/fifo_open.c Sun Apr 12 01:14:43 2015 (r281446, copy source)
+++ user/ngie/more-tests/tests/sys/fifo/fifo_open.c Sun Apr 12 06:18:24 2015 (r281450)
@@ -87,7 +87,7 @@
* All activity occurs within a temporary directory created early in the
* test.
*/
-char temp_dir[PATH_MAX];
+static char temp_dir[PATH_MAX];
static void __unused
atexit_temp_dir(void)
@@ -453,13 +453,13 @@ test_non_blocking_writer(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
if (geteuid() != 0)
errx(-1, "must be run as root");
- strcpy(temp_dir, "/tmp/fifo_open.XXXXXXXXXXX");
+ strcpy(temp_dir, "fifo_open.XXXXXXXXXXX");
if (mkdtemp(temp_dir) == NULL)
err(-1, "mkdtemp");
if (chdir(temp_dir) < 0)
More information about the svn-src-user
mailing list