From 337d6066098bd1d78dfe33afccdcccc83a9be391 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 29 Dec 2024 16:53:02 -0800 Subject: aio test: add a test for IOV overrun --- src/core/aio_test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core') diff --git a/src/core/aio_test.c b/src/core/aio_test.c index a41f608d..f9663903 100644 --- a/src/core/aio_test.c +++ b/src/core/aio_test.c @@ -435,6 +435,23 @@ test_aio_busy(void) NUTS_ASSERT(!nng_aio_busy(aio)); nng_aio_free(aio); } +void +test_aio_scatter_gather_too_many(void) +{ + nng_aio *aio; + nng_iov iov[32]; + + NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); + + for (int i = 0; i < 32; i++) { + iov[i].iov_buf = "abc"; + iov[i].iov_len = 3; + } + + NUTS_FAIL(nng_aio_set_iov(aio, 32, iov), NNG_EINVAL); + + nng_aio_free(aio); +} NUTS_TESTS = { { "sleep", test_sleep }, @@ -453,5 +470,6 @@ NUTS_TESTS = { { "sleep loop", test_sleep_loop }, { "sleep cancel", test_sleep_cancel }, { "aio busy", test_aio_busy }, + { "scatter gather too many", test_aio_scatter_gather_too_many }, { NULL, NULL }, }; -- cgit v1.2.3-70-g09d2