git: bcd9c0cfb622 - stable/14 - getentropy tests: Update after commit 473681a1a506da
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Apr 2025 01:57:24 UTC
The branch stable/14 has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=bcd9c0cfb62287b4df4bb030fb56e8a96d30e102 commit bcd9c0cfb62287b4df4bb030fb56e8a96d30e102 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-01-19 16:17:05 +0000 Commit: Enji Cooper <ngie@FreeBSD.org> CommitDate: 2025-04-01 01:52:46 +0000 getentropy tests: Update after commit 473681a1a506da - Use GETENTROPY_MAX instead of hard-coding the value. - Check for EINVAL instead of EIO Fixes: 473681a1a506 ("libc: Fix getentropy POSIX 2024 conformance issues") (cherry picked from commit c5056a3931b41a803a24b89400d38d5c5f843612) --- lib/libc/tests/gen/getentropy_test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libc/tests/gen/getentropy_test.c b/lib/libc/tests/gen/getentropy_test.c index 156d3a94a7de..6ac9d5678ea6 100644 --- a/lib/libc/tests/gen/getentropy_test.c +++ b/lib/libc/tests/gen/getentropy_test.c @@ -28,6 +28,7 @@ #include <sys/param.h> #include <errno.h> +#include <limits.h> #include <signal.h> #include <unistd.h> @@ -62,13 +63,13 @@ ATF_TC_BODY(getentropy_sizes, tc) char buf[512]; ATF_REQUIRE_EQ(getentropy(buf, sizeof(buf)), -1); - ATF_REQUIRE_EQ(errno, EIO); - ATF_REQUIRE_EQ(getentropy(buf, 257), -1); - ATF_REQUIRE_EQ(errno, EIO); + ATF_REQUIRE_EQ(errno, EINVAL); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX + 1), -1); + ATF_REQUIRE_EQ(errno, EINVAL); /* Smaller sizes always succeed: */ - ATF_REQUIRE_EQ(getentropy(buf, 256), 0); - ATF_REQUIRE_EQ(getentropy(buf, 128), 0); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX), 0); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX / 2), 0); ATF_REQUIRE_EQ(getentropy(buf, 0), 0); }