aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Cochard <olivier@FreeBSD.org>2025-10-07 21:45:35 +0000
committerOlivier Cochard <olivier@FreeBSD.org>2025-10-07 21:56:23 +0000
commit2e09ec72417c6c2927185f4d63faea9ac7926c2b (patch)
treed22eaddcd8758439b7616f7835a168648e571939
parente7e7bf757acef3d4e41a6e22f7d04b3df08834cc (diff)
tests/aio: Add support for larger max_buf_aio to vectored_big_iovcnt test
Fix a test failure that occurs when max_buf_aio exceeds 31, as the calculated buffer size exceeds the 16 KB memory disk device. Increase the MD device size to 1 MB to prevent truncation. Rename MD_LEN to DEVICE_IO_LEN for clarity and add a more descriptive error message. Reviewed by: asomers Approved by: asomers Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D52914
-rw-r--r--tests/sys/aio/aio_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c
index b9f8e7062203..def8a9d548d6 100644
--- a/tests/sys/aio/aio_test.c
+++ b/tests/sys/aio/aio_test.c
@@ -775,7 +775,7 @@ ATF_TC_BODY(pipe_waitcomplete, tc)
aio_pipe_test(waitcomplete, NULL);
}
-#define MD_LEN GLOBAL_MAX
+#define DEVICE_IO_LEN GLOBAL_MAX
#define MDUNIT_LINK "mdunit_link"
static int
@@ -794,7 +794,7 @@ aio_md_setup(void)
mdio.md_version = MDIOVERSION;
mdio.md_type = MD_MALLOC;
mdio.md_options = MD_AUTOUNIT | MD_COMPRESS;
- mdio.md_mediasize = GLOBAL_MAX;
+ mdio.md_mediasize = 1024 * 1024; /* 1 MB, enough for max_buf_aio up to 2047 */
mdio.md_sectorsize = 512;
strlcpy(buf, __func__, sizeof(buf));
mdio.md_label = buf;
@@ -856,7 +856,7 @@ aio_md_test(completion comp, struct sigevent *sev, bool vectored)
int fd;
fd = aio_md_setup();
- aio_context_init(&ac, fd, fd, MD_LEN);
+ aio_context_init(&ac, fd, fd, DEVICE_IO_LEN);
if (vectored) {
aio_writev_test(&ac, comp, sev);
aio_readv_test(&ac, comp, sev);
@@ -1846,7 +1846,9 @@ ATF_TC_BODY(vectored_big_iovcnt, tc)
atf_tc_fail("aio failed: %s", strerror(errno));
if (len != buflen)
- atf_tc_fail("aio short write (%jd)", (intmax_t)len);
+ atf_tc_fail("aio short write: got %jd, expected: %jd "
+ "(max_buf_aio=%d, iovcnt=%zu)",
+ (intmax_t)len, (intmax_t)buflen, max_buf_aio, aio.aio_iovcnt);
bzero(&aio, sizeof(aio));
aio.aio_fildes = fd;
@@ -1995,7 +1997,7 @@ aio_zvol_test(completion comp, struct sigevent *sev, bool vectored,
int fd;
fd = aio_zvol_setup(unique);
- aio_context_init(&ac, fd, fd, MD_LEN);
+ aio_context_init(&ac, fd, fd, DEVICE_IO_LEN);
if (vectored) {
aio_writev_test(&ac, comp, sev);
aio_readv_test(&ac, comp, sev);