Skip to content

Commit a7198c4

Browse files
boomanaiden154github-actions[bot]
authored andcommitted
Automerge: [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.
2 parents 451f0e8 + 0346e57 commit a7198c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libc/test/src/sys/random/linux/getrandom_test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ using LlvmLibcGetRandomTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
1919
TEST_F(LlvmLibcGetRandomTest, InvalidFlag) {
2020
LIBC_NAMESPACE::cpp::array<char, 10> buffer;
2121
ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1),
22-
Fails(EINVAL));
22+
Fails<ssize_t>(EINVAL));
2323
}
2424

2525
TEST_F(LlvmLibcGetRandomTest, InvalidBuffer) {
26-
ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0), Fails(EFAULT));
26+
ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0),
27+
Fails<ssize_t>(EFAULT));
2728
}
2829

2930
TEST_F(LlvmLibcGetRandomTest, ReturnsSize) {

0 commit comments

Comments
 (0)