Skip to content

Commit

Permalink
aio test: add a test for IOV overrun
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Dec 30, 2024
1 parent e277439 commit 7d43656
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/aio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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 },
};

0 comments on commit 7d43656

Please sign in to comment.