[libc-commits] [libc] 0346e57 - [libc][NFC] Fix Implicit Conversion Warning in getrandom Test (#155732)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 27 20:58:28 PDT 2025
Author: Aiden Grossman
Date: 2025-08-27T20:58:24-07:00
New Revision: 0346e57f796b37884e4a339f4d39d8245b5f4cc0
URL: https://github.com/llvm/llvm-project/commit/0346e57f796b37884e4a339f4d39d8245b5f4cc0
DIFF: https://github.com/llvm/llvm-project/commit/0346e57f796b37884e4a339f4d39d8245b5f4cc0.diff
LOG: [libc][NFC] Fix Implicit Conversion Warning in getrandom Test (#155732)
getrandom returns a ssize_t, but the error codes are defined as
integers. We need to use the builtin cast in the Fails matcher to ensure
that everything is the same type.
clang will warn about this in a bootstrapping build. Originally found in
\#155627.
Added:
Modified:
libc/test/src/sys/random/linux/getrandom_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/sys/random/linux/getrandom_test.cpp b/libc/test/src/sys/random/linux/getrandom_test.cpp
index 70ecfbf80f12b..249942d89230c 100644
--- a/libc/test/src/sys/random/linux/getrandom_test.cpp
+++ b/libc/test/src/sys/random/linux/getrandom_test.cpp
@@ -19,11 +19,12 @@ using LlvmLibcGetRandomTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
TEST_F(LlvmLibcGetRandomTest, InvalidFlag) {
LIBC_NAMESPACE::cpp::array<char, 10> buffer;
ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1),
- Fails(EINVAL));
+ Fails<ssize_t>(EINVAL));
}
TEST_F(LlvmLibcGetRandomTest, InvalidBuffer) {
- ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0), Fails(EFAULT));
+ ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0),
+ Fails<ssize_t>(EFAULT));
}
TEST_F(LlvmLibcGetRandomTest, ReturnsSize) {
More information about the libc-commits
mailing list