Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/aio/aio_test.c
Show First 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | aio_write_test(struct aio_context *ac, completion comp, struct sigevent *sev) | ||||
if (len < 0) | if (len < 0) | ||||
atf_tc_fail("aio failed: %s", strerror(errno)); | atf_tc_fail("aio failed: %s", strerror(errno)); | ||||
if (len != ac->ac_buflen) | if (len != ac->ac_buflen) | ||||
atf_tc_fail("aio short write (%jd)", (intmax_t)len); | atf_tc_fail("aio short write (%jd)", (intmax_t)len); | ||||
} | } | ||||
/* | /* | ||||
* Perform a vectored I/O test of our initialized data buffer to the provided | |||||
* file descriptor. | |||||
* | |||||
* To vectorize the linear buffer, chop it up into two pieces of dissimilar | |||||
* size, and swap their offsets. | |||||
*/ | |||||
static void | |||||
aio_writev_test(struct aio_context *ac, completion comp, struct sigevent *sev) | |||||
{ | |||||
struct aiocb aio; | |||||
struct iovec iov[2]; | |||||
size_t len0, len1; | |||||
ssize_t len; | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = ac->ac_write_fd; | |||||
aio.aio_offset = 0; | |||||
len0 = ac->ac_buflen * 3 / 4; | |||||
len1 = ac->ac_buflen / 4; | |||||
iov[0].iov_base = ac->ac_buffer + len1; | |||||
iov[0].iov_len = len0; | |||||
iov[1].iov_base = ac->ac_buffer; | |||||
iov[1].iov_len = len1; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 2; | |||||
if (sev) | |||||
aio.aio_sigevent = *sev; | |||||
if (aio_writev(&aio) < 0) | |||||
atf_tc_fail("aio_writev failed: %s", strerror(errno)); | |||||
len = comp(&aio); | |||||
if (len < 0) | |||||
atf_tc_fail("aio failed: %s", strerror(errno)); | |||||
if (len != ac->ac_buflen) | |||||
atf_tc_fail("aio short write (%jd)", (intmax_t)len); | |||||
} | |||||
/* | |||||
* Perform a simple read test of our initialized data buffer from the | * Perform a simple read test of our initialized data buffer from the | ||||
* provided file descriptor. | * provided file descriptor. | ||||
*/ | */ | ||||
static void | static void | ||||
aio_read_test(struct aio_context *ac, completion comp, struct sigevent *sev) | aio_read_test(struct aio_context *ac, completion comp, struct sigevent *sev) | ||||
{ | { | ||||
struct aiocb aio; | struct aiocb aio; | ||||
ssize_t len; | ssize_t len; | ||||
Show All 16 Lines | aio_read_test(struct aio_context *ac, completion comp, struct sigevent *sev) | ||||
ATF_REQUIRE_EQ_MSG(len, ac->ac_buflen, | ATF_REQUIRE_EQ_MSG(len, ac->ac_buflen, | ||||
"aio short read (%jd)", (intmax_t)len); | "aio short read (%jd)", (intmax_t)len); | ||||
if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) | if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) | ||||
atf_tc_fail("buffer mismatched"); | atf_tc_fail("buffer mismatched"); | ||||
} | } | ||||
static void | |||||
aio_readv_test(struct aio_context *ac, completion comp, struct sigevent *sev) | |||||
{ | |||||
struct aiocb aio; | |||||
struct iovec iov[2]; | |||||
size_t len0, len1; | |||||
ssize_t len; | |||||
bzero(ac->ac_buffer, ac->ac_buflen); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = ac->ac_read_fd; | |||||
aio.aio_offset = 0; | |||||
len0 = ac->ac_buflen * 3 / 4; | |||||
len1 = ac->ac_buflen / 4; | |||||
iov[0].iov_base = ac->ac_buffer + len1; | |||||
iov[0].iov_len = len0; | |||||
iov[1].iov_base = ac->ac_buffer; | |||||
iov[1].iov_len = len1; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 2; | |||||
if (sev) | |||||
aio.aio_sigevent = *sev; | |||||
if (aio_readv(&aio) < 0) | |||||
atf_tc_fail("aio_read failed: %s", strerror(errno)); | |||||
len = comp(&aio); | |||||
if (len < 0) | |||||
atf_tc_fail("aio failed: %s", strerror(errno)); | |||||
ATF_REQUIRE_EQ_MSG(len, ac->ac_buflen, | |||||
"aio short read (%jd)", (intmax_t)len); | |||||
if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) | |||||
atf_tc_fail("buffer mismatched"); | |||||
} | |||||
/* | /* | ||||
* Series of type-specific tests for AIO. For now, we just make sure we can | * Series of type-specific tests for AIO. For now, we just make sure we can | ||||
* issue a write and then a read to each type. We assume that once a write | * issue a write and then a read to each type. We assume that once a write | ||||
* is issued, a read can follow. | * is issued, a read can follow. | ||||
*/ | */ | ||||
/* | /* | ||||
* Test with a classic file. Assumes we can create a moderate size temporary | * Test with a classic file. Assumes we can create a moderate size temporary | ||||
* file. | * file. | ||||
*/ | */ | ||||
#define FILE_LEN GLOBAL_MAX | #define FILE_LEN GLOBAL_MAX | ||||
#define FILE_PATHNAME "testfile" | #define FILE_PATHNAME "testfile" | ||||
static void | static void | ||||
aio_file_test(completion comp, struct sigevent *sev) | aio_file_test(completion comp, struct sigevent *sev, bool vectored) | ||||
{ | { | ||||
struct aio_context ac; | struct aio_context ac; | ||||
int fd; | int fd; | ||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | ATF_REQUIRE_KERNEL_MODULE("aio"); | ||||
ATF_REQUIRE_UNSAFE_AIO(); | ATF_REQUIRE_UNSAFE_AIO(); | ||||
fd = open(FILE_PATHNAME, O_RDWR | O_CREAT, 0600); | fd = open(FILE_PATHNAME, O_RDWR | O_CREAT, 0600); | ||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | ||||
aio_context_init(&ac, fd, fd, FILE_LEN); | aio_context_init(&ac, fd, fd, FILE_LEN); | ||||
if (vectored) { | |||||
aio_writev_test(&ac, comp, sev); | |||||
aio_readv_test(&ac, comp, sev); | |||||
} else { | |||||
aio_write_test(&ac, comp, sev); | aio_write_test(&ac, comp, sev); | ||||
aio_read_test(&ac, comp, sev); | aio_read_test(&ac, comp, sev); | ||||
} | |||||
close(fd); | close(fd); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(file_poll); | ATF_TC_WITHOUT_HEAD(file_poll); | ||||
ATF_TC_BODY(file_poll, tc) | ATF_TC_BODY(file_poll, tc) | ||||
{ | { | ||||
aio_file_test(poll, NULL); | aio_file_test(poll, NULL, false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(file_signal); | ATF_TC_WITHOUT_HEAD(file_signal); | ||||
ATF_TC_BODY(file_signal, tc) | ATF_TC_BODY(file_signal, tc) | ||||
{ | { | ||||
aio_file_test(poll_signaled, setup_signal()); | aio_file_test(poll_signaled, setup_signal(), false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(file_suspend); | ATF_TC_WITHOUT_HEAD(file_suspend); | ||||
ATF_TC_BODY(file_suspend, tc) | ATF_TC_BODY(file_suspend, tc) | ||||
{ | { | ||||
aio_file_test(suspend, NULL); | aio_file_test(suspend, NULL, false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(file_thread); | ATF_TC_WITHOUT_HEAD(file_thread); | ||||
ATF_TC_BODY(file_thread, tc) | ATF_TC_BODY(file_thread, tc) | ||||
{ | { | ||||
aio_file_test(poll_signaled, setup_thread()); | aio_file_test(poll_signaled, setup_thread(), false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(file_waitcomplete); | ATF_TC_WITHOUT_HEAD(file_waitcomplete); | ||||
ATF_TC_BODY(file_waitcomplete, tc) | ATF_TC_BODY(file_waitcomplete, tc) | ||||
{ | { | ||||
aio_file_test(waitcomplete, NULL); | aio_file_test(waitcomplete, NULL, false); | ||||
} | } | ||||
#define FIFO_LEN 256 | #define FIFO_LEN 256 | ||||
#define FIFO_PATHNAME "testfifo" | #define FIFO_PATHNAME "testfifo" | ||||
static void | static void | ||||
aio_fifo_test(completion comp, struct sigevent *sev) | aio_fifo_test(completion comp, struct sigevent *sev) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); | ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); | ||||
ATF_TC_BODY(fifo_waitcomplete, tc) | ATF_TC_BODY(fifo_waitcomplete, tc) | ||||
{ | { | ||||
aio_fifo_test(waitcomplete, NULL); | aio_fifo_test(waitcomplete, NULL); | ||||
} | } | ||||
#define UNIX_SOCKETPAIR_LEN 256 | #define UNIX_SOCKETPAIR_LEN 256 | ||||
static void | static void | ||||
aio_unix_socketpair_test(completion comp, struct sigevent *sev) | aio_unix_socketpair_test(completion comp, struct sigevent *sev, bool vectored) | ||||
{ | { | ||||
struct aio_context ac; | struct aio_context ac; | ||||
struct rusage ru_before, ru_after; | struct rusage ru_before, ru_after; | ||||
int sockets[2]; | int sockets[2]; | ||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | ATF_REQUIRE_KERNEL_MODULE("aio"); | ||||
ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, sockets) != -1, | ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, sockets) != -1, | ||||
"socketpair failed: %s", strerror(errno)); | "socketpair failed: %s", strerror(errno)); | ||||
aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN); | aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN); | ||||
ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, | ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, | ||||
"getrusage failed: %s", strerror(errno)); | "getrusage failed: %s", strerror(errno)); | ||||
if (vectored) { | |||||
aio_writev_test(&ac, comp, sev); | |||||
aio_readv_test(&ac, comp, sev); | |||||
} else { | |||||
aio_write_test(&ac, comp, sev); | aio_write_test(&ac, comp, sev); | ||||
ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, | |||||
"getrusage failed: %s", strerror(errno)); | |||||
ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); | |||||
ru_before = ru_after; | |||||
aio_read_test(&ac, comp, sev); | aio_read_test(&ac, comp, sev); | ||||
} | |||||
ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, | ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, | ||||
"getrusage failed: %s", strerror(errno)); | "getrusage failed: %s", strerror(errno)); | ||||
ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); | |||||
ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); | ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); | ||||
close(sockets[0]); | close(sockets[0]); | ||||
close(sockets[1]); | close(sockets[1]); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(socket_poll); | ATF_TC_WITHOUT_HEAD(socket_poll); | ||||
ATF_TC_BODY(socket_poll, tc) | ATF_TC_BODY(socket_poll, tc) | ||||
{ | { | ||||
aio_unix_socketpair_test(poll, NULL); | aio_unix_socketpair_test(poll, NULL, false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(socket_signal); | ATF_TC_WITHOUT_HEAD(socket_signal); | ||||
ATF_TC_BODY(socket_signal, tc) | ATF_TC_BODY(socket_signal, tc) | ||||
{ | { | ||||
aio_unix_socketpair_test(poll_signaled, setup_signal()); | aio_unix_socketpair_test(poll_signaled, setup_signal(), false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(socket_suspend); | ATF_TC_WITHOUT_HEAD(socket_suspend); | ||||
ATF_TC_BODY(socket_suspend, tc) | ATF_TC_BODY(socket_suspend, tc) | ||||
{ | { | ||||
aio_unix_socketpair_test(suspend, NULL); | aio_unix_socketpair_test(suspend, NULL, false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(socket_thread); | ATF_TC_WITHOUT_HEAD(socket_thread); | ||||
ATF_TC_BODY(socket_thread, tc) | ATF_TC_BODY(socket_thread, tc) | ||||
{ | { | ||||
aio_unix_socketpair_test(poll_signaled, setup_thread()); | aio_unix_socketpair_test(poll_signaled, setup_thread(), false); | ||||
} | } | ||||
ATF_TC_WITHOUT_HEAD(socket_waitcomplete); | ATF_TC_WITHOUT_HEAD(socket_waitcomplete); | ||||
ATF_TC_BODY(socket_waitcomplete, tc) | ATF_TC_BODY(socket_waitcomplete, tc) | ||||
{ | { | ||||
aio_unix_socketpair_test(waitcomplete, NULL); | aio_unix_socketpair_test(waitcomplete, NULL, false); | ||||
} | } | ||||
struct aio_pty_arg { | struct aio_pty_arg { | ||||
int apa_read_fd; | int apa_read_fd; | ||||
int apa_write_fd; | int apa_write_fd; | ||||
}; | }; | ||||
#define PTY_LEN 256 | #define PTY_LEN 256 | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
ATF_TC_BODY(pipe_waitcomplete, tc) | ATF_TC_BODY(pipe_waitcomplete, tc) | ||||
{ | { | ||||
aio_pipe_test(waitcomplete, NULL); | aio_pipe_test(waitcomplete, NULL); | ||||
} | } | ||||
#define MD_LEN GLOBAL_MAX | #define MD_LEN GLOBAL_MAX | ||||
#define MDUNIT_LINK "mdunit_link" | #define MDUNIT_LINK "mdunit_link" | ||||
static void | static int | ||||
aio_md_cleanup(void) | aio_md_setup(void) | ||||
{ | { | ||||
struct md_ioctl mdio; | |||||
int mdctl_fd, error, n, unit; | |||||
char buf[80]; | |||||
mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); | |||||
ATF_REQUIRE(mdctl_fd >= 0); | |||||
n = readlink(MDUNIT_LINK, buf, sizeof(buf)); | |||||
if (n > 0) { | |||||
if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) { | |||||
bzero(&mdio, sizeof(mdio)); | |||||
mdio.md_version = MDIOVERSION; | |||||
mdio.md_unit = unit; | |||||
if (ioctl(mdctl_fd, MDIOCDETACH, &mdio) == -1) { | |||||
error = errno; | |||||
close(mdctl_fd); | |||||
errno = error; | |||||
atf_tc_fail("ioctl MDIOCDETACH failed: %s", | |||||
strerror(errno)); | |||||
} | |||||
} | |||||
} | |||||
close(mdctl_fd); | |||||
} | |||||
static void | |||||
aio_md_test(completion comp, struct sigevent *sev) | |||||
{ | |||||
int error, fd, mdctl_fd, unit; | int error, fd, mdctl_fd, unit; | ||||
char pathname[PATH_MAX]; | char pathname[PATH_MAX]; | ||||
struct aio_context ac; | |||||
struct md_ioctl mdio; | struct md_ioctl mdio; | ||||
char buf[80]; | char buf[80]; | ||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | ATF_REQUIRE_KERNEL_MODULE("aio"); | ||||
mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); | mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); | ||||
ATF_REQUIRE_MSG(mdctl_fd != -1, | ATF_REQUIRE_MSG(mdctl_fd != -1, | ||||
"opening /dev/%s failed: %s", MDCTL_NAME, strerror(errno)); | "opening /dev/%s failed: %s", MDCTL_NAME, strerror(errno)); | ||||
Show All 15 Lines | aio_md_setup(void) | ||||
/* Store the md unit number in a symlink for future cleanup */ | /* Store the md unit number in a symlink for future cleanup */ | ||||
unit = mdio.md_unit; | unit = mdio.md_unit; | ||||
snprintf(buf, sizeof(buf), "%d", unit); | snprintf(buf, sizeof(buf), "%d", unit); | ||||
ATF_REQUIRE_EQ(0, symlink(buf, MDUNIT_LINK)); | ATF_REQUIRE_EQ(0, symlink(buf, MDUNIT_LINK)); | ||||
snprintf(pathname, PATH_MAX, "/dev/md%d", unit); | snprintf(pathname, PATH_MAX, "/dev/md%d", unit); | ||||
fd = open(pathname, O_RDWR); | fd = open(pathname, O_RDWR); | ||||
ATF_REQUIRE_MSG(fd != -1, | ATF_REQUIRE_MSG(fd != -1, | ||||
"opening %s failed: %s", pathname, strerror(errno)); | "opening %s failed: %s", pathname, strerror(errno)); | ||||
return (fd); | |||||
} | |||||
static void | |||||
aio_md_cleanup(void) | |||||
{ | |||||
struct md_ioctl mdio; | |||||
int mdctl_fd, error, n, unit; | |||||
char buf[80]; | |||||
mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); | |||||
ATF_REQUIRE(mdctl_fd >= 0); | |||||
n = readlink(MDUNIT_LINK, buf, sizeof(buf)); | |||||
if (n > 0) { | |||||
if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) { | |||||
bzero(&mdio, sizeof(mdio)); | |||||
mdio.md_version = MDIOVERSION; | |||||
mdio.md_unit = unit; | |||||
if (ioctl(mdctl_fd, MDIOCDETACH, &mdio) == -1) { | |||||
error = errno; | |||||
close(mdctl_fd); | |||||
errno = error; | |||||
atf_tc_fail("ioctl MDIOCDETACH failed: %s", | |||||
strerror(errno)); | |||||
} | |||||
} | |||||
} | |||||
close(mdctl_fd); | |||||
} | |||||
static void | |||||
aio_md_test(completion comp, struct sigevent *sev, bool vectored) | |||||
{ | |||||
struct aio_context ac; | |||||
int fd; | |||||
fd = aio_md_setup(); | |||||
aio_context_init(&ac, fd, fd, MD_LEN); | aio_context_init(&ac, fd, fd, MD_LEN); | ||||
if (vectored) { | |||||
aio_writev_test(&ac, comp, sev); | |||||
aio_readv_test(&ac, comp, sev); | |||||
} else { | |||||
aio_write_test(&ac, comp, sev); | aio_write_test(&ac, comp, sev); | ||||
aio_read_test(&ac, comp, sev); | aio_read_test(&ac, comp, sev); | ||||
} | |||||
close(fd); | close(fd); | ||||
} | } | ||||
ATF_TC_WITH_CLEANUP(md_poll); | ATF_TC_WITH_CLEANUP(md_poll); | ||||
ATF_TC_HEAD(md_poll, tc) | ATF_TC_HEAD(md_poll, tc) | ||||
{ | { | ||||
atf_tc_set_md_var(tc, "require.user", "root"); | atf_tc_set_md_var(tc, "require.user", "root"); | ||||
} | } | ||||
ATF_TC_BODY(md_poll, tc) | ATF_TC_BODY(md_poll, tc) | ||||
{ | { | ||||
aio_md_test(poll, NULL); | aio_md_test(poll, NULL, false); | ||||
} | } | ||||
ATF_TC_CLEANUP(md_poll, tc) | ATF_TC_CLEANUP(md_poll, tc) | ||||
{ | { | ||||
aio_md_cleanup(); | aio_md_cleanup(); | ||||
} | } | ||||
ATF_TC_WITH_CLEANUP(md_signal); | ATF_TC_WITH_CLEANUP(md_signal); | ||||
ATF_TC_HEAD(md_signal, tc) | ATF_TC_HEAD(md_signal, tc) | ||||
{ | { | ||||
atf_tc_set_md_var(tc, "require.user", "root"); | atf_tc_set_md_var(tc, "require.user", "root"); | ||||
} | } | ||||
ATF_TC_BODY(md_signal, tc) | ATF_TC_BODY(md_signal, tc) | ||||
{ | { | ||||
aio_md_test(poll_signaled, setup_signal()); | aio_md_test(poll_signaled, setup_signal(), false); | ||||
} | } | ||||
ATF_TC_CLEANUP(md_signal, tc) | ATF_TC_CLEANUP(md_signal, tc) | ||||
{ | { | ||||
aio_md_cleanup(); | aio_md_cleanup(); | ||||
} | } | ||||
ATF_TC_WITH_CLEANUP(md_suspend); | ATF_TC_WITH_CLEANUP(md_suspend); | ||||
ATF_TC_HEAD(md_suspend, tc) | ATF_TC_HEAD(md_suspend, tc) | ||||
{ | { | ||||
atf_tc_set_md_var(tc, "require.user", "root"); | atf_tc_set_md_var(tc, "require.user", "root"); | ||||
} | } | ||||
ATF_TC_BODY(md_suspend, tc) | ATF_TC_BODY(md_suspend, tc) | ||||
{ | { | ||||
aio_md_test(suspend, NULL); | aio_md_test(suspend, NULL, false); | ||||
} | } | ||||
ATF_TC_CLEANUP(md_suspend, tc) | ATF_TC_CLEANUP(md_suspend, tc) | ||||
{ | { | ||||
aio_md_cleanup(); | aio_md_cleanup(); | ||||
} | } | ||||
ATF_TC_WITH_CLEANUP(md_thread); | ATF_TC_WITH_CLEANUP(md_thread); | ||||
ATF_TC_HEAD(md_thread, tc) | ATF_TC_HEAD(md_thread, tc) | ||||
{ | { | ||||
atf_tc_set_md_var(tc, "require.user", "root"); | atf_tc_set_md_var(tc, "require.user", "root"); | ||||
} | } | ||||
ATF_TC_BODY(md_thread, tc) | ATF_TC_BODY(md_thread, tc) | ||||
{ | { | ||||
aio_md_test(poll_signaled, setup_thread()); | aio_md_test(poll_signaled, setup_thread(), false); | ||||
} | } | ||||
ATF_TC_CLEANUP(md_thread, tc) | ATF_TC_CLEANUP(md_thread, tc) | ||||
{ | { | ||||
aio_md_cleanup(); | aio_md_cleanup(); | ||||
} | } | ||||
ATF_TC_WITH_CLEANUP(md_waitcomplete); | ATF_TC_WITH_CLEANUP(md_waitcomplete); | ||||
ATF_TC_HEAD(md_waitcomplete, tc) | ATF_TC_HEAD(md_waitcomplete, tc) | ||||
{ | { | ||||
atf_tc_set_md_var(tc, "require.user", "root"); | atf_tc_set_md_var(tc, "require.user", "root"); | ||||
} | } | ||||
ATF_TC_BODY(md_waitcomplete, tc) | ATF_TC_BODY(md_waitcomplete, tc) | ||||
{ | { | ||||
aio_md_test(waitcomplete, NULL); | aio_md_test(waitcomplete, NULL, false); | ||||
} | } | ||||
ATF_TC_CLEANUP(md_waitcomplete, tc) | ATF_TC_CLEANUP(md_waitcomplete, tc) | ||||
{ | { | ||||
aio_md_cleanup(); | aio_md_cleanup(); | ||||
} | } | ||||
#define ZVOL_VDEV_PATHNAME "test_vdev" | |||||
#define POOL_SIZE (1 << 28) /* 256 MB */ | |||||
#define ZVOL_SIZE "64m" | |||||
#define POOL_NAME "aio_testpool" | |||||
#define ZVOL_NAME "aio_testvol" | |||||
static int | |||||
aio_zvol_setup(void) | |||||
{ | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_KERNEL_MODULE("zfs"); | |||||
fd = open(ZVOL_VDEV_PATHNAME, O_RDWR | O_CREAT, 0600); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
ATF_REQUIRE_EQ_MSG(0, | |||||
ftruncate(fd, POOL_SIZE), "ftruncate failed: %s", strerror(errno)); | |||||
close(fd); | |||||
ATF_REQUIRE_EQ_MSG(0, | |||||
system("zpool create " POOL_NAME " $PWD/" ZVOL_VDEV_PATHNAME), | |||||
"zpool create failed: %s", strerror(errno)); | |||||
ATF_REQUIRE_EQ_MSG(0, | |||||
system("zfs create -o volblocksize=8192 -o volmode=dev -V " | |||||
ZVOL_SIZE " " POOL_NAME "/" ZVOL_NAME), | |||||
"zfs create failed: %s", strerror(errno)); | |||||
/* | |||||
* XXX Due to bug 251828, we need an extra "zfs set here" | |||||
* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251828 | |||||
*/ | |||||
ATF_REQUIRE_EQ_MSG(0, | |||||
system("zfs set volmode=dev " POOL_NAME "/" ZVOL_NAME), | |||||
"zfs set failed: %s", strerror(errno)); | |||||
fd = open("/dev/zvol/" POOL_NAME "/" ZVOL_NAME, O_RDWR); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
return (fd); | |||||
} | |||||
static void | |||||
aio_zvol_cleanup(void) | |||||
{ | |||||
system("zpool destroy " POOL_NAME); | |||||
} | |||||
ATF_TC_WITHOUT_HEAD(aio_large_read_test); | ATF_TC_WITHOUT_HEAD(aio_large_read_test); | ||||
ATF_TC_BODY(aio_large_read_test, tc) | ATF_TC_BODY(aio_large_read_test, tc) | ||||
{ | { | ||||
struct aiocb cb, *cbp; | struct aiocb cb, *cbp; | ||||
ssize_t nread; | ssize_t nread; | ||||
size_t len; | size_t len; | ||||
int fd; | int fd; | ||||
#ifdef __LP64__ | #ifdef __LP64__ | ||||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | #endif | ||||
*/ | */ | ||||
ATF_REQUIRE(aio_error(&ioreq[i].iocb) == EINPROGRESS); | ATF_REQUIRE(aio_error(&ioreq[i].iocb) == EINPROGRESS); | ||||
ATF_REQUIRE(aio_cancel(s[0], &ioreq[i].iocb) == AIO_CANCELED); | ATF_REQUIRE(aio_cancel(s[0], &ioreq[i].iocb) == AIO_CANCELED); | ||||
close(s[1]); | close(s[1]); | ||||
close(s[0]); | close(s[0]); | ||||
} | } | ||||
/* | static void | ||||
* This test ensures that aio_write() on a blocking socket of a "large" | aio_socket_blocking_short_write_test(bool vectored) | ||||
* buffer does not return a short completion. | |||||
*/ | |||||
ATF_TC_WITHOUT_HEAD(aio_socket_blocking_short_write); | |||||
ATF_TC_BODY(aio_socket_blocking_short_write, tc) | |||||
{ | { | ||||
struct aiocb iocb, *iocbp; | struct aiocb iocb, *iocbp; | ||||
struct iovec iov[2]; | |||||
char *buffer[2]; | char *buffer[2]; | ||||
ssize_t done; | ssize_t done; | ||||
int buffer_size, sb_size; | int buffer_size, sb_size; | ||||
socklen_t len; | socklen_t len; | ||||
int s[2]; | int s[2]; | ||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | ATF_REQUIRE_KERNEL_MODULE("aio"); | ||||
Show All 23 Lines | aio_socket_blocking_short_write_test(bool vectored) | ||||
buffer[1] = malloc(buffer_size); | buffer[1] = malloc(buffer_size); | ||||
ATF_REQUIRE(buffer[1] != NULL); | ATF_REQUIRE(buffer[1] != NULL); | ||||
srandomdev(); | srandomdev(); | ||||
aio_fill_buffer(buffer[1], buffer_size, random()); | aio_fill_buffer(buffer[1], buffer_size, random()); | ||||
memset(&iocb, 0, sizeof(iocb)); | memset(&iocb, 0, sizeof(iocb)); | ||||
iocb.aio_fildes = s[1]; | iocb.aio_fildes = s[1]; | ||||
if (vectored) { | |||||
iov[0].iov_base = buffer[1]; | |||||
iov[0].iov_len = buffer_size / 2 + 1; | |||||
iov[1].iov_base = buffer[1] + buffer_size / 2 + 1; | |||||
iov[1].iov_len = buffer_size / 2 - 1; | |||||
iocb.aio_iov = iov; | |||||
iocb.aio_iovcnt = 2; | |||||
ATF_REQUIRE(aio_writev(&iocb) == 0); | |||||
} else { | |||||
iocb.aio_buf = buffer[1]; | iocb.aio_buf = buffer[1]; | ||||
iocb.aio_nbytes = buffer_size; | iocb.aio_nbytes = buffer_size; | ||||
ATF_REQUIRE(aio_write(&iocb) == 0); | ATF_REQUIRE(aio_write(&iocb) == 0); | ||||
} | |||||
done = recv(s[0], buffer[0], buffer_size, MSG_WAITALL); | done = recv(s[0], buffer[0], buffer_size, MSG_WAITALL); | ||||
ATF_REQUIRE(done == buffer_size); | ATF_REQUIRE(done == buffer_size); | ||||
done = aio_waitcomplete(&iocbp, NULL); | done = aio_waitcomplete(&iocbp, NULL); | ||||
ATF_REQUIRE(iocbp == &iocb); | ATF_REQUIRE(iocbp == &iocb); | ||||
ATF_REQUIRE(done == buffer_size); | ATF_REQUIRE(done == buffer_size); | ||||
ATF_REQUIRE(memcmp(buffer[0], buffer[1], buffer_size) == 0); | ATF_REQUIRE(memcmp(buffer[0], buffer[1], buffer_size) == 0); | ||||
close(s[1]); | close(s[1]); | ||||
close(s[0]); | close(s[0]); | ||||
} | } | ||||
/* | /* | ||||
* This test ensures that aio_write() on a blocking socket of a "large" | |||||
* buffer does not return a short completion. | |||||
*/ | |||||
ATF_TC_WITHOUT_HEAD(aio_socket_blocking_short_write); | |||||
ATF_TC_BODY(aio_socket_blocking_short_write, tc) | |||||
{ | |||||
aio_socket_blocking_short_write_test(false); | |||||
} | |||||
/* | |||||
* Like aio_socket_blocking_short_write, but also tests that partially | |||||
* completed vectored sends can be retried correctly. | |||||
*/ | |||||
ATF_TC_WITHOUT_HEAD(aio_socket_blocking_short_write_vectored); | |||||
ATF_TC_BODY(aio_socket_blocking_short_write_vectored, tc) | |||||
{ | |||||
aio_socket_blocking_short_write_test(true); | |||||
} | |||||
/* | |||||
* This test verifies that cancelling a partially completed socket write | * This test verifies that cancelling a partially completed socket write | ||||
* returns a short write rather than ECANCELED. | * returns a short write rather than ECANCELED. | ||||
*/ | */ | ||||
ATF_TC_WITHOUT_HEAD(aio_socket_short_write_cancel); | ATF_TC_WITHOUT_HEAD(aio_socket_short_write_cancel); | ||||
ATF_TC_BODY(aio_socket_short_write_cancel, tc) | ATF_TC_BODY(aio_socket_short_write_cancel, tc) | ||||
{ | { | ||||
struct aiocb iocb, *iocbp; | struct aiocb iocb, *iocbp; | ||||
char *buffer[2]; | char *buffer[2]; | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | ATF_TC_BODY(aio_fsync_test, tc) | ||||
for (i = 0; i < nitems(buffers); i++) | for (i = 0; i < nitems(buffers); i++) | ||||
ATF_REQUIRE_MSG(buffers[i].done, | ATF_REQUIRE_MSG(buffers[i].done, | ||||
"AIO request %u did not complete", i); | "AIO request %u did not complete", i); | ||||
close(fd); | close(fd); | ||||
} | } | ||||
/* | |||||
* We shouldn't be able to DoS the system by setting iov_len to an insane | |||||
* value | |||||
*/ | |||||
ATF_TC_WITHOUT_HEAD(aio_writev_dos_iov_len); | |||||
ATF_TC_BODY(aio_writev_dos_iov_len, tc) | |||||
{ | |||||
struct aiocb aio; | |||||
const struct aiocb *const iocbs[] = {&aio}; | |||||
const char *wbuf = "Hello, world!"; | |||||
struct iovec iov[1]; | |||||
ssize_t len, r; | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
fd = open("testfile", O_RDWR | O_CREAT, 0600); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
len = strlen(wbuf); | |||||
iov[0].iov_base = __DECONST(void*, wbuf); | |||||
iov[0].iov_len = 1 << 30; | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 1; | |||||
r = aio_writev(&aio); | |||||
ATF_CHECK_EQ_MSG(0, r, "aio_writev returned %ld", r); | |||||
ATF_REQUIRE_EQ(0, aio_suspend(iocbs, 1, NULL)); | |||||
r = aio_return(&aio); | |||||
ATF_CHECK_EQ_MSG(-1, r, "aio_return returned %ld", r); | |||||
ATF_CHECK_MSG(errno == EFAULT || errno == EINVAL, | |||||
"aio_writev: %s", strerror(errno)); | |||||
close(fd); | |||||
} | |||||
/* | |||||
* We shouldn't be able to DoS the system by setting aio_iovcnt to an insane | |||||
* value | |||||
*/ | |||||
ATF_TC_WITHOUT_HEAD(aio_writev_dos_iovcnt); | |||||
ATF_TC_BODY(aio_writev_dos_iovcnt, tc) | |||||
{ | |||||
struct aiocb aio; | |||||
const char *wbuf = "Hello, world!"; | |||||
struct iovec iov[1]; | |||||
ssize_t len; | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
fd = open("testfile", O_RDWR | O_CREAT, 0600); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
len = strlen(wbuf); | |||||
iov[0].iov_base = __DECONST(void*, wbuf); | |||||
iov[0].iov_len = len; | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 1 << 30; | |||||
ATF_REQUIRE_EQ(-1, aio_writev(&aio)); | |||||
ATF_CHECK_EQ(EINVAL, errno); | |||||
close(fd); | |||||
} | |||||
ATF_TC_WITHOUT_HEAD(aio_writev_empty_file_poll); | |||||
ATF_TC_BODY(aio_writev_empty_file_poll, tc) | |||||
{ | |||||
struct aiocb aio; | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
fd = open("testfile", O_RDWR | O_CREAT, 0600); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iovcnt = 0; | |||||
ATF_REQUIRE_EQ(0, aio_writev(&aio)); | |||||
ATF_REQUIRE_EQ(0, suspend(&aio)); | |||||
close(fd); | |||||
} | |||||
ATF_TC_WITHOUT_HEAD(aio_writev_empty_file_signal); | |||||
ATF_TC_BODY(aio_writev_empty_file_signal, tc) | |||||
{ | |||||
struct aiocb aio; | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
fd = open("testfile", O_RDWR | O_CREAT, 0600); | |||||
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iovcnt = 0; | |||||
aio.aio_sigevent = *setup_signal(); | |||||
ATF_REQUIRE_EQ(0, aio_writev(&aio)); | |||||
ATF_REQUIRE_EQ(0, poll_signaled(&aio)); | |||||
close(fd); | |||||
} | |||||
// aio_writev and aio_readv should still work even if the iovcnt is greater | |||||
// than the number of buffered AIO operations permitted per process. | |||||
ATF_TC_WITH_CLEANUP(vectored_big_iovcnt); | |||||
ATF_TC_HEAD(vectored_big_iovcnt, tc) | |||||
{ | |||||
atf_tc_set_md_var(tc, "descr", | |||||
"Vectored AIO should still work even if the iovcnt is greater than " | |||||
"the number of buffered AIO operations permitted by the process"); | |||||
atf_tc_set_md_var(tc, "require.user", "root"); | |||||
} | |||||
ATF_TC_BODY(vectored_big_iovcnt, tc) | |||||
{ | |||||
struct aiocb aio; | |||||
struct iovec *iov; | |||||
ssize_t len, buflen; | |||||
char *buffer; | |||||
const char *oid = "vfs.aio.max_buf_aio"; | |||||
long seed; | |||||
int max_buf_aio; | |||||
int fd, i; | |||||
ssize_t sysctl_len = sizeof(max_buf_aio); | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
if (sysctlbyname(oid, &max_buf_aio, &sysctl_len, NULL, 0) == -1) | |||||
atf_libc_error(errno, "Failed to read %s", oid); | |||||
seed = random(); | |||||
buflen = 512 * (max_buf_aio + 1); | |||||
buffer = malloc(buflen); | |||||
aio_fill_buffer(buffer, buflen, seed); | |||||
iov = calloc(max_buf_aio + 1, sizeof(struct iovec)); | |||||
fd = aio_md_setup(); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
for (i = 0; i < max_buf_aio + 1; i++) { | |||||
iov[i].iov_base = &buffer[i * 512]; | |||||
iov[i].iov_len = 512; | |||||
} | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = max_buf_aio + 1; | |||||
if (aio_writev(&aio) < 0) | |||||
atf_tc_fail("aio_writev failed: %s", strerror(errno)); | |||||
len = poll(&aio); | |||||
if (len < 0) | |||||
atf_tc_fail("aio failed: %s", strerror(errno)); | |||||
if (len != buflen) | |||||
atf_tc_fail("aio short write (%jd)", (intmax_t)len); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = max_buf_aio + 1; | |||||
if (aio_readv(&aio) < 0) | |||||
atf_tc_fail("aio_readv failed: %s", strerror(errno)); | |||||
len = poll(&aio); | |||||
if (len < 0) | |||||
atf_tc_fail("aio failed: %s", strerror(errno)); | |||||
if (len != buflen) | |||||
atf_tc_fail("aio short read (%jd)", (intmax_t)len); | |||||
if (aio_test_buffer(buffer, buflen, seed) == 0) | |||||
atf_tc_fail("buffer mismatched"); | |||||
close(fd); | |||||
} | |||||
ATF_TC_CLEANUP(vectored_big_iovcnt, tc) | |||||
{ | |||||
aio_md_cleanup(); | |||||
} | |||||
ATF_TC_WITHOUT_HEAD(vectored_file_poll); | |||||
ATF_TC_BODY(vectored_file_poll, tc) | |||||
{ | |||||
aio_file_test(poll, NULL, true); | |||||
} | |||||
ATF_TC_WITH_CLEANUP(vectored_md_poll); | |||||
ATF_TC_HEAD(vectored_md_poll, tc) | |||||
{ | |||||
atf_tc_set_md_var(tc, "require.user", "root"); | |||||
} | |||||
ATF_TC_BODY(vectored_md_poll, tc) | |||||
{ | |||||
aio_md_test(poll, NULL, true); | |||||
} | |||||
ATF_TC_CLEANUP(vectored_md_poll, tc) | |||||
{ | |||||
aio_md_cleanup(); | |||||
} | |||||
ATF_TC_WITHOUT_HEAD(vectored_socket_poll); | |||||
ATF_TC_BODY(vectored_socket_poll, tc) | |||||
{ | |||||
aio_unix_socketpair_test(poll, NULL, true); | |||||
} | |||||
// aio_writev and aio_readv should still work even if the iov contains elements | |||||
// that aren't a multiple of the device's sector size, and even if the total | |||||
// amount if I/O _is_ a multiple of the device's sector size. | |||||
ATF_TC_WITH_CLEANUP(vectored_unaligned); | |||||
ATF_TC_HEAD(vectored_unaligned, tc) | |||||
{ | |||||
atf_tc_set_md_var(tc, "descr", | |||||
"Vectored AIO should still work even if the iov contains elements " | |||||
"that aren't a multiple of the sector size."); | |||||
atf_tc_set_md_var(tc, "require.user", "root"); | |||||
} | |||||
ATF_TC_BODY(vectored_unaligned, tc) | |||||
{ | |||||
struct aio_context ac; | |||||
struct aiocb aio; | |||||
struct iovec iov[3]; | |||||
ssize_t len, total_len; | |||||
int fd; | |||||
ATF_REQUIRE_KERNEL_MODULE("aio"); | |||||
ATF_REQUIRE_UNSAFE_AIO(); | |||||
/* | |||||
* Use a zvol with volmode=dev, so it will allow .d_write with | |||||
* unaligned uio. geom devices use physio, which doesn't allow that. | |||||
*/ | |||||
fd = aio_zvol_setup(); | |||||
aio_context_init(&ac, fd, fd, FILE_LEN); | |||||
/* Break the buffer into 3 parts: | |||||
* * A 4kB part, aligned to 4kB | |||||
* * Two other parts that add up to 4kB: | |||||
* - 256B | |||||
* - 4kB - 256B | |||||
*/ | |||||
iov[0].iov_base = ac.ac_buffer; | |||||
iov[0].iov_len = 4096; | |||||
iov[1].iov_base = (void*)((uintptr_t)iov[0].iov_base + iov[0].iov_len); | |||||
iov[1].iov_len = 256; | |||||
iov[2].iov_base = (void*)((uintptr_t)iov[1].iov_base + iov[1].iov_len); | |||||
iov[2].iov_len = 4096 - iov[1].iov_len; | |||||
total_len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len; | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = ac.ac_write_fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 3; | |||||
if (aio_writev(&aio) < 0) | |||||
arichardson: This test and `vectored_zvol_poll` appear to be failing in CI recently (https://ci.freebsd. | |||||
Done Inline ActionsNo, and I can't reproduce that failure myself. It might be a race condition in ZFS, or maybe for some other reason the zvol doesn't have the expected name. asomers: No, and I can't reproduce that failure myself. It might be a race condition in ZFS, or maybe… | |||||
atf_tc_fail("aio_writev failed: %s", strerror(errno)); | |||||
len = poll(&aio); | |||||
if (len < 0) | |||||
atf_tc_fail("aio failed: %s", strerror(errno)); | |||||
if (len != total_len) | |||||
atf_tc_fail("aio short write (%jd)", (intmax_t)len); | |||||
bzero(&aio, sizeof(aio)); | |||||
aio.aio_fildes = ac.ac_read_fd; | |||||
aio.aio_offset = 0; | |||||
aio.aio_iov = iov; | |||||
aio.aio_iovcnt = 3; | |||||
if (aio_readv(&aio) < 0) | |||||
atf_tc_fail("aio_readv failed: %s", strerror(errno)); | |||||
len = poll(&aio); | |||||
ATF_REQUIRE_MSG(aio_test_buffer(ac.ac_buffer, total_len, | |||||
ac.ac_seed) != 0, "aio_test_buffer: internal error"); | |||||
close(fd); | |||||
} | |||||
ATF_TC_CLEANUP(vectored_unaligned, tc) | |||||
{ | |||||
aio_zvol_cleanup(); | |||||
} | |||||
static void | |||||
aio_zvol_test(completion comp, struct sigevent *sev, bool vectored) | |||||
{ | |||||
struct aio_context ac; | |||||
int fd; | |||||
fd = aio_zvol_setup(); | |||||
aio_context_init(&ac, fd, fd, MD_LEN); | |||||
if (vectored) { | |||||
aio_writev_test(&ac, comp, sev); | |||||
aio_readv_test(&ac, comp, sev); | |||||
} else { | |||||
aio_write_test(&ac, comp, sev); | |||||
aio_read_test(&ac, comp, sev); | |||||
} | |||||
close(fd); | |||||
} | |||||
/* | |||||
* Note that unlike md, the zvol is not a geom device, does not allow unmapped | |||||
* buffers, and does not use physio. | |||||
*/ | |||||
ATF_TC_WITH_CLEANUP(vectored_zvol_poll); | |||||
ATF_TC_HEAD(vectored_zvol_poll, tc) | |||||
{ | |||||
atf_tc_set_md_var(tc, "require.user", "root"); | |||||
} | |||||
ATF_TC_BODY(vectored_zvol_poll, tc) | |||||
{ | |||||
aio_zvol_test(poll, NULL, true); | |||||
} | |||||
ATF_TC_CLEANUP(vectored_zvol_poll, tc) | |||||
{ | |||||
aio_zvol_cleanup(); | |||||
} | |||||
ATF_TP_ADD_TCS(tp) | ATF_TP_ADD_TCS(tp) | ||||
{ | { | ||||
ATF_TP_ADD_TC(tp, file_poll); | ATF_TP_ADD_TC(tp, file_poll); | ||||
ATF_TP_ADD_TC(tp, file_signal); | ATF_TP_ADD_TC(tp, file_signal); | ||||
ATF_TP_ADD_TC(tp, file_suspend); | ATF_TP_ADD_TC(tp, file_suspend); | ||||
ATF_TP_ADD_TC(tp, file_thread); | ATF_TP_ADD_TC(tp, file_thread); | ||||
ATF_TP_ADD_TC(tp, file_waitcomplete); | ATF_TP_ADD_TC(tp, file_waitcomplete); | ||||
Show All 22 Lines | ATF_TP_ADD_TCS(tp) | ||||
ATF_TP_ADD_TC(tp, md_suspend); | ATF_TP_ADD_TC(tp, md_suspend); | ||||
ATF_TP_ADD_TC(tp, md_thread); | ATF_TP_ADD_TC(tp, md_thread); | ||||
ATF_TP_ADD_TC(tp, md_waitcomplete); | ATF_TP_ADD_TC(tp, md_waitcomplete); | ||||
ATF_TP_ADD_TC(tp, aio_fsync_errors); | ATF_TP_ADD_TC(tp, aio_fsync_errors); | ||||
ATF_TP_ADD_TC(tp, aio_fsync_test); | ATF_TP_ADD_TC(tp, aio_fsync_test); | ||||
ATF_TP_ADD_TC(tp, aio_large_read_test); | ATF_TP_ADD_TC(tp, aio_large_read_test); | ||||
ATF_TP_ADD_TC(tp, aio_socket_two_reads); | ATF_TP_ADD_TC(tp, aio_socket_two_reads); | ||||
ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); | ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); | ||||
ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write_vectored); | |||||
ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); | ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); | ||||
ATF_TP_ADD_TC(tp, aio_writev_dos_iov_len); | |||||
ATF_TP_ADD_TC(tp, aio_writev_dos_iovcnt); | |||||
ATF_TP_ADD_TC(tp, aio_writev_empty_file_poll); | |||||
ATF_TP_ADD_TC(tp, aio_writev_empty_file_signal); | |||||
ATF_TP_ADD_TC(tp, vectored_big_iovcnt); | |||||
ATF_TP_ADD_TC(tp, vectored_file_poll); | |||||
ATF_TP_ADD_TC(tp, vectored_md_poll); | |||||
ATF_TP_ADD_TC(tp, vectored_zvol_poll); | |||||
ATF_TP_ADD_TC(tp, vectored_unaligned); | |||||
ATF_TP_ADD_TC(tp, vectored_socket_poll); | |||||
return (atf_no_error()); | return (atf_no_error()); | ||||
} | } |
This test and vectored_zvol_poll appear to be failing in CI recently (https://ci.freebsd.org/job/FreeBSD-main-amd64-test/19158/testReport/junit/sys.aio/aio_test/vectored_unaligned/). Any ideas why this could be happening?
I am not sure if it has ever succeeded in CI, most previous runs show it as skipped.