[libc-commits] [libc] [libc] Fix fprintf_test assuming specific errnos. (PR #166479)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Nov 4 16:50:12 PST 2025


https://github.com/michaelrj-google updated https://github.com/llvm/llvm-project/pull/166479

>From 905de5c35827e0f04d1ed04991aae797e0ce9488 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Wed, 5 Nov 2025 00:48:04 +0000
Subject: [PATCH] [libc] Fix fprintf_test assuming specific errnos.

The patch #166382 fixed most of these, but missed the fprintf_test ones.
---
 libc/test/src/stdio/fprintf_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/src/stdio/fprintf_test.cpp b/libc/test/src/stdio/fprintf_test.cpp
index 1b35a09645939..2cea7f554ce38 100644
--- a/libc/test/src/stdio/fprintf_test.cpp
+++ b/libc/test/src/stdio/fprintf_test.cpp
@@ -83,7 +83,7 @@ TEST(LlvmLibcFPrintfTest, WriteToFile) {
   written =
       LIBC_NAMESPACE::fprintf(file, "Writing to a read only file should fail.");
   EXPECT_LT(written, 0);
-  ASSERT_ERRNO_EQ(EBADF);
+  ASSERT_ERRNO_FAILURE();
 
   ASSERT_EQ(printf_test::fclose(file), 0);
 }
@@ -100,7 +100,7 @@ TEST(LlvmLibcFPrintfTest, NullPtrCheck) {
   int ret =
       LIBC_NAMESPACE::fprintf(file, "hello %n", static_cast<int *>(nullptr));
   EXPECT_LT(ret, 0);
-  ASSERT_ERRNO_EQ(EINVAL);
+  ASSERT_ERRNO_FAILURE();
 
   ASSERT_EQ(printf_test::fclose(file), 0);
 }



More information about the libc-commits mailing list