Skip to content

Conversation

@vonosmas
Copy link
Contributor

This reverts commit a93e55e and fixes build and test failures:

  • Proper include added to setvbuf_test.cpp
  • fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and are made more precise. This fixes inconsistencies between expectations in regular and GPU builds - ErrnoSetterMatcher is configured to omit errno matching on GPUs, as fgetc implementation on GPU doesn't set errno, in contrast to Linux.

This reverts commit a93e55e and fixes
build and test failures:

* Proper include added to setvbuf_test.cpp
* fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and
  are made more precise. This fixes inconsistencies between expectations
  in regular and GPU builds - ErrnoSetterMatcher is configured to omit
  errno matching on GPUs, as fgetc implementation on GPU doesn't set
  errno, in contrast to Linux.
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2025

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

Changes

This reverts commit a93e55e and fixes build and test failures:

  • Proper include added to setvbuf_test.cpp
  • fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and are made more precise. This fixes inconsistencies between expectations in regular and GPU builds - ErrnoSetterMatcher is configured to omit errno matching on GPUs, as fgetc implementation on GPU doesn't set errno, in contrast to Linux.

Patch is 26.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/143972.diff

14 Files Affected:

  • (modified) libc/docs/configure.rst (+1-1)
  • (modified) libc/test/src/stdio/CMakeLists.txt (+13)
  • (modified) libc/test/src/stdio/fdopen_test.cpp (+6-8)
  • (modified) libc/test/src/stdio/fgetc_test.cpp (+12-10)
  • (modified) libc/test/src/stdio/fgetc_unlocked_test.cpp (+12-10)
  • (modified) libc/test/src/stdio/fgets_test.cpp (+11-7)
  • (modified) libc/test/src/stdio/fileop_test.cpp (+5-15)
  • (modified) libc/test/src/stdio/fopencookie_test.cpp (+7-8)
  • (modified) libc/test/src/stdio/remove_test.cpp (+5-5)
  • (modified) libc/test/src/stdio/rename_test.cpp (+5-4)
  • (modified) libc/test/src/stdio/setvbuf_test.cpp (+5-4)
  • (modified) libc/test/src/stdio/unlocked_fileop_test.cpp (+3-4)
  • (modified) libc/test/src/stdlib/StrtolTest.h (-1)
  • (modified) libc/test/src/stdlib/strtold_test.cpp (-1)
diff --git a/libc/docs/configure.rst b/libc/docs/configure.rst
index 8d53390ae19bf..109412225634f 100644
--- a/libc/docs/configure.rst
+++ b/libc/docs/configure.rst
@@ -29,7 +29,7 @@ to learn about the defaults for your platform and target.
     - ``LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR``: Enable -fstack-protector-strong to defend against stack smashing attack.
     - ``LIBC_CONF_KEEP_FRAME_POINTER``: Keep frame pointer in functions for better debugging experience.
 * **"errno" options**
-    - ``LIBC_CONF_ERRNO_MODE``: The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, and LIBC_ERRNO_MODE_SYSTEM.
+    - ``LIBC_CONF_ERRNO_MODE``: The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, LIBC_ERRNO_MODE_SYSTEM, and LIBC_ERRNO_MODE_SYSTEM_INLINE.
 * **"general" options**
     - ``LIBC_ADD_NULL_CHECKS``: Add nullptr checks in the library's implementations to some functions for which passing nullptr is undefined behavior.
 * **"math" options**
diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt
index ce2171f19597b..4aa8b95880018 100644
--- a/libc/test/src/stdio/CMakeLists.txt
+++ b/libc/test/src/stdio/CMakeLists.txt
@@ -20,6 +20,7 @@ add_libc_test(
     libc.src.stdio.fread
     libc.src.stdio.fseek
     libc.src.stdio.fwrite
+    libc.test.UnitTest.ErrnoCheckingTest
 )
 
 add_libc_test(
@@ -68,6 +69,7 @@ add_libc_test(
     libc.src.stdio.fread
     libc.src.stdio.fwrite
     libc.src.stdio.setvbuf
+    libc.test.UnitTest.ErrnoCheckingTest
 )
 
 add_libc_test(
@@ -88,6 +90,7 @@ add_libc_test(
     libc.src.stdio.fread_unlocked
     libc.src.stdio.funlockfile
     libc.src.stdio.fwrite_unlocked
+    libc.test.UnitTest.ErrnoCheckingTest
 )
 
 add_libc_test(
@@ -109,6 +112,7 @@ add_libc_test(
     libc.src.stdio.fread
     libc.src.stdio.fseek
     libc.src.stdio.fwrite
+    libc.test.UnitTest.ErrnoCheckingTest
   LINK_LIBRARIES
     LibcMemoryHelpers
 )
@@ -438,6 +442,7 @@ if(${LIBC_TARGET_OS} STREQUAL "linux")
       libc.src.sys.stat.mkdirat
       libc.src.unistd.access
       libc.src.unistd.close
+      libc.test.UnitTest.ErrnoCheckingTest
   )
 
   add_libc_test(
@@ -452,6 +457,7 @@ if(${LIBC_TARGET_OS} STREQUAL "linux")
       libc.src.stdio.rename
       libc.src.unistd.access
       libc.src.unistd.close
+      libc.test.UnitTest.ErrnoCheckingTest
       libc.test.UnitTest.ErrnoSetterMatcher
   )
 
@@ -468,6 +474,7 @@ if(${LIBC_TARGET_OS} STREQUAL "linux")
       libc.src.stdio.fgets
       libc.src.stdio.fputs
       libc.src.unistd.close
+      libc.test.UnitTest.ErrnoCheckingTest
       libc.test.UnitTest.ErrnoSetterMatcher
   )
 endif()
@@ -488,6 +495,8 @@ add_libc_test(
     libc.src.stdio.fopen
     libc.src.stdio.fwrite
     libc.src.stdio.getc
+    libc.test.UnitTest.ErrnoCheckingTest
+    libc.test.UnitTest.ErrnoSetterMatcher
 )
 
 add_libc_test(
@@ -510,6 +519,8 @@ add_libc_test(
     libc.src.stdio.funlockfile
     libc.src.stdio.fwrite
     libc.src.stdio.getc_unlocked
+    libc.test.UnitTest.ErrnoCheckingTest
+    libc.test.UnitTest.ErrnoSetterMatcher
 )
 
 add_libc_test(
@@ -527,6 +538,8 @@ add_libc_test(
     libc.src.stdio.fgets
     libc.src.stdio.fopen
     libc.src.stdio.fwrite
+    libc.test.UnitTest.ErrnoCheckingTest
+    libc.test.UnitTest.ErrnoSetterMatcher
 )
 
 add_libc_test(
diff --git a/libc/test/src/stdio/fdopen_test.cpp b/libc/test/src/stdio/fdopen_test.cpp
index 104fc478b100e..b53184c30be36 100644
--- a/libc/test/src/stdio/fdopen_test.cpp
+++ b/libc/test/src/stdio/fdopen_test.cpp
@@ -9,20 +9,21 @@
 #include "src/stdio/fdopen.h"
 
 #include "hdr/fcntl_macros.h"
-#include "src/__support/libc_errno.h"
 #include "src/fcntl/open.h"
 #include "src/stdio/fclose.h"
 #include "src/stdio/fgets.h"
 #include "src/stdio/fputs.h"
 #include "src/unistd/close.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
 
 #include <sys/stat.h> // For S_IRWXU
 
-TEST(LlvmLibcStdioFdopenTest, WriteAppendRead) {
+using LlvmLibcStdioFdopenTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcStdioFdopenTest, WriteAppendRead) {
   using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
-  libc_errno = 0;
   constexpr const char *TEST_FILE_NAME = "testdata/write_read_append.test";
   auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
   int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU);
@@ -52,8 +53,7 @@ TEST(LlvmLibcStdioFdopenTest, WriteAppendRead) {
   ASSERT_ERRNO_SUCCESS();
 }
 
-TEST(LlvmLibcStdioFdopenTest, InvalidFd) {
-  libc_errno = 0;
+TEST_F(LlvmLibcStdioFdopenTest, InvalidFd) {
   constexpr const char *TEST_FILE_NAME = "testdata/invalid_fd.test";
   auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
   int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_TRUNC);
@@ -64,8 +64,7 @@ TEST(LlvmLibcStdioFdopenTest, InvalidFd) {
   ASSERT_TRUE(nullptr == fp);
 }
 
-TEST(LlvmLibcStdioFdopenTest, InvalidMode) {
-  libc_errno = 0;
+TEST_F(LlvmLibcStdioFdopenTest, InvalidMode) {
   constexpr const char *TEST_FILE_NAME = "testdata/invalid_mode.test";
   auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
   int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_RDONLY, S_IRWXU);
@@ -83,7 +82,6 @@ TEST(LlvmLibcStdioFdopenTest, InvalidMode) {
   auto *fp2 = LIBC_NAMESPACE::fdopen(fd, "w");
   ASSERT_ERRNO_EQ(EINVAL);
   ASSERT_TRUE(nullptr == fp2);
-  libc_errno = 0;
   LIBC_NAMESPACE::close(fd);
   ASSERT_ERRNO_SUCCESS();
 }
diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp
index 56bde5f0099a8..be2e50271b510 100644
--- a/libc/test/src/stdio/fgetc_test.cpp
+++ b/libc/test/src/stdio/fgetc_test.cpp
@@ -14,12 +14,15 @@
 #include "src/stdio/fopen.h"
 #include "src/stdio/fwrite.h"
 #include "src/stdio/getc.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
 
 #include "hdr/stdio_macros.h"
-#include "src/__support/libc_errno.h"
 
-class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
+using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
+
+class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::ErrnoCheckingTest {
 public:
   using GetcFunc = int(FILE *);
   void test_with_func(GetcFunc *func, const char *filename) {
@@ -27,29 +30,28 @@ class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
     ASSERT_FALSE(file == nullptr);
     constexpr char CONTENT[] = "123456789";
     constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1;
-    ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
+    ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file),
+                Succeeds(WRITE_SIZE));
     // This is a write-only file so reads should fail.
-    ASSERT_EQ(func(file), EOF);
+    ASSERT_THAT(func(file), Fails(EBADF, EOF));
     // This is an error and not a real EOF.
     ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
     ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-    libc_errno = 0;
 
-    ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+    ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
 
     file = LIBC_NAMESPACE::fopen(filename, "r");
     ASSERT_FALSE(file == nullptr);
 
     for (size_t i = 0; i < WRITE_SIZE; ++i) {
-      int c = func(file);
-      ASSERT_EQ(c, int('1' + i));
+      ASSERT_THAT(func(file), Succeeds(int('1' + i)));
     }
     // Reading more should return EOF but not set error.
-    ASSERT_EQ(func(file), EOF);
+    ASSERT_THAT(func(file), Succeeds(EOF));
     ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
     ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
 
-    ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+    ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
   }
 };
 
diff --git a/libc/test/src/stdio/fgetc_unlocked_test.cpp b/libc/test/src/stdio/fgetc_unlocked_test.cpp
index 90429ecf4e82b..bef9dafd3d87c 100644
--- a/libc/test/src/stdio/fgetc_unlocked_test.cpp
+++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp
@@ -17,12 +17,15 @@
 #include "src/stdio/funlockfile.h"
 #include "src/stdio/fwrite.h"
 #include "src/stdio/getc_unlocked.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
 
 #include "hdr/stdio_macros.h"
-#include "src/__support/libc_errno.h"
 
-class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
+using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
+
+class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::ErrnoCheckingTest {
 public:
   using GetcFunc = int(FILE *);
   void test_with_func(GetcFunc *func, const char *filename) {
@@ -30,31 +33,30 @@ class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
     ASSERT_FALSE(file == nullptr);
     constexpr char CONTENT[] = "123456789";
     constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1;
-    ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
+    ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file),
+                Succeeds(WRITE_SIZE));
     // This is a write-only file so reads should fail.
-    ASSERT_EQ(func(file), EOF);
+    ASSERT_THAT(func(file), Fails(EBADF, EOF));
     // This is an error and not a real EOF.
     ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
     ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-    libc_errno = 0;
 
-    ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+    ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
 
     file = LIBC_NAMESPACE::fopen(filename, "r");
     ASSERT_FALSE(file == nullptr);
 
     LIBC_NAMESPACE::flockfile(file);
     for (size_t i = 0; i < WRITE_SIZE; ++i) {
-      int c = func(file);
-      ASSERT_EQ(c, int('1' + i));
+      ASSERT_THAT(func(file), Succeeds(int('1' + i)));
     }
     // Reading more should return EOF but not set error.
-    ASSERT_EQ(func(file), EOF);
+    ASSERT_THAT(func(file), Succeeds(EOF));
     ASSERT_NE(LIBC_NAMESPACE::feof_unlocked(file), 0);
     ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(file), 0);
 
     LIBC_NAMESPACE::funlockfile(file);
-    ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+    ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
   }
 };
 
diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp
index abed3d4052939..ca8d4d4546635 100644
--- a/libc/test/src/stdio/fgets_test.cpp
+++ b/libc/test/src/stdio/fgets_test.cpp
@@ -12,11 +12,14 @@
 #include "src/stdio/fgets.h"
 #include "src/stdio/fopen.h"
 #include "src/stdio/fwrite.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
 
-#include "src/__support/libc_errno.h"
+using LlvmLibcFgetsTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
 
-TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
+TEST_F(LlvmLibcFgetsTest, WriteAndReadCharacters) {
   constexpr char FILENAME[] = "testdata/fgets.test";
   ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
   ASSERT_FALSE(file == nullptr);
@@ -29,15 +32,15 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
   char buff[8];
   char *output;
 
-  ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
+  ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file),
+              Succeeds(WRITE_SIZE));
   // This is a write-only file so reads should fail.
-  ASSERT_TRUE(LIBC_NAMESPACE::fgets(buff, 8, file) == nullptr);
+  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
   // This is an error and not a real EOF.
   ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
   ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-  libc_errno = 0;
 
-  ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+  ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
 
   file = LIBC_NAMESPACE::fopen(FILENAME, "r");
   ASSERT_FALSE(file == nullptr);
@@ -55,6 +58,7 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
   // This is also implementation defined.
   output = LIBC_NAMESPACE::fgets(buff, 0, file);
   ASSERT_TRUE(output == nullptr);
+  ASSERT_ERRNO_SUCCESS();
 #endif
 
   const char *output_arr[] = {
@@ -86,5 +90,5 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
   ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
   ASSERT_ERRNO_SUCCESS();
 
-  ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
+  ASSERT_THAT(LIBC_NAMESPACE::fclose(file), Succeeds());
 }
diff --git a/libc/test/src/stdio/fileop_test.cpp b/libc/test/src/stdio/fileop_test.cpp
index e624181c795b8..e097785832d56 100644
--- a/libc/test/src/stdio/fileop_test.cpp
+++ b/libc/test/src/stdio/fileop_test.cpp
@@ -17,17 +17,18 @@
 #include "src/stdio/fread.h"
 #include "src/stdio/fseek.h"
 #include "src/stdio/fwrite.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
 
 #include "hdr/stdio_macros.h"
-#include "src/__support/libc_errno.h"
 
+using LlvmLibcFILETest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::EQ;
 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::NE;
 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::returns;
 
-TEST(LlvmLibcFILETest, SimpleFileOperations) {
+TEST_F(LlvmLibcFILETest, SimpleFileOperations) {
   constexpr char FILENAME[] = "testdata/simple_operations.test";
   ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
   ASSERT_FALSE(file == nullptr);
@@ -41,7 +42,6 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
   ASSERT_THAT(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file),
               returns(EQ(size_t(0))).with_errno(NE(0)));
   ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(file);
   ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
@@ -72,7 +72,6 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
   ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file),
               returns(EQ(size_t(0))).with_errno(NE(0)));
   ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(file);
 
@@ -80,15 +79,12 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
   ASSERT_THAT(LIBC_NAMESPACE::fputs(CONTENT, file),
               returns(EQ(EOF)).with_errno(NE(0)));
   ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(file);
   ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
 
-  libc_errno = 0;
   ASSERT_THAT(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file),
               returns(EQ(size_t(0))).with_errno(NE(0)));
-  libc_errno = 0;
 
   ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
 
@@ -103,10 +99,8 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
   ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
 
   // This is not a readable file.
-  libc_errno = 0;
   ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file),
               returns(EQ(0)).with_errno(NE(0)));
-  libc_errno = 0;
 
   ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
 
@@ -121,21 +115,18 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
 
   // Check that the other functions correctly set libc_errno.
 
-  // libc_errno = 0;
   // ASSERT_NE(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0);
   // ASSERT_ERRNO_FAILURE();
 
-  // libc_errno = 0;
   // ASSERT_NE(LIBC_NAMESPACE::fclose(file), 0);
   // ASSERT_ERRNO_FAILURE();
 
-  // libc_errno = 0;
   // ASSERT_EQ(LIBC_NAMESPACE::fopen("INVALID FILE NAME", "r"),
   //           static_cast<FILE *>(nullptr));
   // ASSERT_ERRNO_FAILURE();
 }
 
-TEST(LlvmLibcFILETest, FFlush) {
+TEST_F(LlvmLibcFILETest, FFlush) {
   constexpr char FILENAME[] = "testdata/fflush.test";
   ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+");
   ASSERT_FALSE(file == nullptr);
@@ -156,7 +147,7 @@ TEST(LlvmLibcFILETest, FFlush) {
   ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
 }
 
-TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
+TEST_F(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
   using MyStruct = struct {
     char c;
     unsigned long long i;
@@ -165,7 +156,6 @@ TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
   constexpr size_t WRITE_NMEMB = sizeof(WRITE_DATA) / sizeof(MyStruct);
   constexpr char FILENAME[] = "testdata/fread_fwrite.test";
 
-  libc_errno = 0;
   FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
   ASSERT_FALSE(file == nullptr);
   ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file));
diff --git a/libc/test/src/stdio/fopencookie_test.cpp b/libc/test/src/stdio/fopencookie_test.cpp
index 03e1ac286b646..bcf5e674141a7 100644
--- a/libc/test/src/stdio/fopencookie_test.cpp
+++ b/libc/test/src/stdio/fopencookie_test.cpp
@@ -15,6 +15,7 @@
 #include "src/stdio/fread.h"
 #include "src/stdio/fseek.h"
 #include "src/stdio/fwrite.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
 #include "test/UnitTest/MemoryMatcher.h"
 #include "test/UnitTest/Test.h"
 
@@ -22,6 +23,7 @@
 #include "hdr/types/size_t.h"
 #include "src/__support/libc_errno.h"
 
+using LlvmLibcFOpenCookieTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
 using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
 
 struct StringStream {
@@ -88,7 +90,7 @@ int close_ss(void *cookie) {
 constexpr cookie_io_functions_t STRING_STREAM_FUNCS = {&read_ss, &write_ss,
                                                        &seek_ss, &close_ss};
 
-TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) {
+TEST_F(LlvmLibcFOpenCookieTest, ReadOnlyCookieTest) {
   constexpr char CONTENT[] = "Hello,readonly!";
   auto *ss = reinterpret_cast<StringStream *>(malloc(sizeof(StringStream)));
   ss->buf = reinterpret_cast<char *>(malloc(sizeof(CONTENT)));
@@ -115,7 +117,6 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) {
   ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f));
   ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
   ASSERT_ERRNO_FAILURE();
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(f);
   ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
@@ -124,7 +125,7 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) {
   free(ss);
 }
 
-TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) {
+TEST_F(LlvmLibcFOpenCookieTest, WriteOnlyCookieTest) {
   size_t INIT_BUFSIZE = 32;
   auto *ss = reinterpret_cast<StringStream *>(malloc(sizeof(StringStream)));
   ss->buf = reinterpret_cast<char *>(malloc(INIT_BUFSIZE));
@@ -149,7 +150,6 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) {
             LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f));
   ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
   ASSERT_ERRNO_EQ(EBADF);
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(f);
   ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
@@ -158,7 +158,7 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) {
   free(ss);
 }
 
-TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) {
+TEST_F(LlvmLibcFOpenCookieTest, AppendOnlyCookieTest) {
   constexpr char INITIAL_CONTENT[] = "1234567890987654321";
   constexpr char WRITE_DATA[] = "append";
   auto *ss = reinterpret_cast<StringStream *>(malloc(sizeof(StringStream)));
@@ -178,7 +178,6 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) {
   ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0));
   ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
   ASSERT_ERRNO_FAILURE();
-  libc_errno = 0;
 
   LIBC_NAMESPACE::clearerr(f);
   ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
@@ -192,7 +191,7 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) {
   free(ss);
 }
 
-TEST(LlvmLibcFOpenCookie, ReadUpdateCookieTest) {
+TEST_F(LlvmLibcFOpenCookieTest, ReadUpdateCookieTest) {
   const char INITIAL_CONTENT[] = "1234567890987654321";
   auto *ss = reinterpret_cast<StringStream *>(malloc(sizeof(StringStream)));
   ss->buf = reinterpret_cast<char *>(malloc(sizeof(INITIAL_CONTENT)));
@@ -223,7 +222,7 @@ TEST(LlvmLibcFOpenCookie, ReadUpdateCookieTest) {
   free(ss);
 }
 
-TEST(LlvmLibcFOpenCookie, WriteUpdateCookieTest) {
+TEST_F(LlvmLibcFOpenCookieTest, WriteUpdateCookieTest) {
   constexpr char WRITE_DATA[] = "hello, file";
   auto *ss = reinterpret_cast<StringStream *>(malloc(sizeof(StringStream)));
   ss->buf = reinterpret_cast<char *>(malloc(sizeof(WRITE_DATA)));
diff --git a/libc/test/src/stdio/remove_test.cpp b/libc/test/src/stdio/remove_test.cpp
index 84984e26398c0..296bff1f5dc15 100644
--...
[truncated]

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vonosmas vonosmas merged commit c609112 into llvm:main Jun 13, 2025
16 checks passed
@vonosmas vonosmas deleted the errno-checking-test-4 branch June 13, 2025 17:25
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg-asan running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/23849

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcMemsetTest.SizeSweep (3 ms)
Ran 1 tests.  PASS: 1  FAIL: 0
[938/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.rename_test.__unit__.__build__.dir/rename_test.cpp.o
[939/1223] Running unit test libc.test.src.string.memset_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcMemsetTest.SizeSweep
[       OK ] LlvmLibcMemsetTest.SizeSweep (1 ms)
Ran 1 tests.  PASS: 1  FAIL: 0
[940/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.setvbuf_test.__unit__.__build__.dir/setvbuf_test.cpp.o
[941/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=address -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/Test.h:37:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[       OK ] LlvmLibcMemsetTest.SizeSweep (3 ms)
Ran 1 tests.  PASS: 1  FAIL: 0
[938/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.rename_test.__unit__.__build__.dir/rename_test.cpp.o
[939/1223] Running unit test libc.test.src.string.memset_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcMemsetTest.SizeSweep
[       OK ] LlvmLibcMemsetTest.SizeSweep (1 ms)
Ran 1 tests.  PASS: 1  FAIL: 0
[940/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.setvbuf_test.__unit__.__build__.dir/setvbuf_test.cpp.o
[941/1223] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=address -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/Test.h:37:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-aarch64-ubuntu-fullbuild-dbg running on libc-aarch64-ubuntu while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/71/builds/24506

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcRoundToIntegerTest.SubnormalRange (315 ms)
Ran 3 tests.  PASS: 3  FAIL: 0
[429/951] Running unit test libc.test.src.stdbit.stdc_count_zeros_uc_test.__unit__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcStdcCountZerosUcTest.Zero
[       OK ] LlvmLibcStdcCountZerosUcTest.Zero (1 us)
[ RUN      ] LlvmLibcStdcCountZerosUcTest.Ones
[       OK ] LlvmLibcStdcCountZerosUcTest.Ones (1 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[430/951] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('nullptr_t' and 'nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/179/builds/23871

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcRoundToIntegerTest.InfinityAndNaN (8 us)
[ RUN      ] LlvmLibcRoundToIntegerTest.RoundNumbers
[       OK ] LlvmLibcRoundToIntegerTest.RoundNumbers (13 us)
[ RUN      ] LlvmLibcRoundToIntegerTest.SubnormalRange
[       OK ] LlvmLibcRoundToIntegerTest.SubnormalRange (2902 ms)
Ran 3 tests.  PASS: 3  FAIL: 0
[1166/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.unlocked_fileop_test.__unit__.__build__.dir/unlocked_fileop_test.cpp.o
[1167/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgetc_unlocked_test.__unit__.__build__.dir/fgetc_unlocked_test.cpp.o
[1168/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.setvbuf_test.__unit__.__build__.dir/setvbuf_test.cpp.o
[1169/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[       OK ] LlvmLibcRoundToIntegerTest.InfinityAndNaN (8 us)
[ RUN      ] LlvmLibcRoundToIntegerTest.RoundNumbers
[       OK ] LlvmLibcRoundToIntegerTest.RoundNumbers (13 us)
[ RUN      ] LlvmLibcRoundToIntegerTest.SubnormalRange
[       OK ] LlvmLibcRoundToIntegerTest.SubnormalRange (2902 ms)
Ran 3 tests.  PASS: 3  FAIL: 0
[1166/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.unlocked_fileop_test.__unit__.__build__.dir/unlocked_fileop_test.cpp.o
[1167/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgetc_unlocked_test.__unit__.__build__.dir/fgetc_unlocked_test.cpp.o
[1168/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.setvbuf_test.__unit__.__build__.dir/setvbuf_test.cpp.o
[1169/1228] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-gcc-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/23968

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fileop_test.cpp:20:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::Test::matchAndExplain(MatcherT&&, ValType, const char*, const char*, __llvm_libc_20_0_0_git::testing::internal::Location) [with MatcherT = __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<int>; ValType = long unsigned int]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fileop_test.cpp:102:3:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: warning: conversion from ‘long unsigned int’ to ‘int’ may change value [-Wconversion]
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
[1170/1224] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.strtoul_test.__unit__.__build__.dir/strtoul_test.cpp.o
[1171/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::Test::matchAndExplain(MatcherT&&, ValType, const char*, const char*, __llvm_libc_20_0_0_git::testing::internal::Location) [with MatcherT = __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>; ValType = char*]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot convert ‘char*’ to ‘std::nullptr_t’
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
      |                                    |
      |                                    char*
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note:   initializing argument 1 of ‘bool __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<T>::match(T) [with T = std::nullptr_t]’
  115 |   bool match(T got) {
      |              ~~^~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::internal::Comparator<T>::compare(T) [with T = std::nullptr_t]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:90:28:   required from ‘void __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<T>::explainError() [with T = std::nullptr_t]’
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:89:8:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   42 |       return actual >= expected;
      |              ~~~~~~~^~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:44:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   44 |       return actual > expected;
      |              ~~~~~~~^~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:46:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   46 |       return actual <= expected;
      |              ~~~~~~~^~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:48:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   48 |       return actual < expected;
      |              ~~~~~~~^~~~~~~~~~
[1172/1224] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.strtoll_test.__unit__.__build__.dir/strtoll_test.cpp.o
[1173/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fdopen_test.__unit__.__build__.dir/fdopen_test.cpp.o
[1174/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fopencookie_test.__unit__.__build__.dir/fopencookie_test.cpp.o
[1175/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgetc_unlocked_test.__unit__.__build__.dir/fgetc_unlocked_test.cpp.o
[1176/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.fgetc_test.__unit__.__build__
[1177/1224] Linking CXX executable libc/test/src/stdlib/libc.test.src.stdlib.strtoul_test.__unit__.__build__
[1178/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.setvbuf_test.__unit__.__build__
[1179/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.unlocked_fileop_test.__unit__.__build__
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fileop_test.cpp:20:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::Test::matchAndExplain(MatcherT&&, ValType, const char*, const char*, __llvm_libc_20_0_0_git::testing::internal::Location) [with MatcherT = __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<int>; ValType = long unsigned int]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fileop_test.cpp:102:3:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: warning: conversion from ‘long unsigned int’ to ‘int’ may change value [-Wconversion]
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
[1170/1224] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.strtoul_test.__unit__.__build__.dir/strtoul_test.cpp.o
[1171/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::Test::matchAndExplain(MatcherT&&, ValType, const char*, const char*, __llvm_libc_20_0_0_git::testing::internal::Location) [with MatcherT = __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>; ValType = char*]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot convert ‘char*’ to ‘std::nullptr_t’
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
      |                                    |
      |                                    char*
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note:   initializing argument 1 of ‘bool __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<T>::match(T) [with T = std::nullptr_t]’
  115 |   bool match(T got) {
      |              ~~^~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h: In instantiation of ‘bool __llvm_libc_20_0_0_git::testing::internal::Comparator<T>::compare(T) [with T = std::nullptr_t]’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:90:28:   required from ‘void __llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<T>::explainError() [with T = std::nullptr_t]’
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:89:8:   required from here
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   42 |       return actual >= expected;
      |              ~~~~~~~^~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:44:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   44 |       return actual > expected;
      |              ~~~~~~~^~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:46:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   46 |       return actual <= expected;
      |              ~~~~~~~^~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:48:21: error: ordered comparison of pointer with integer zero (‘std::nullptr_t’ and ‘std::nullptr_t’)
   48 |       return actual < expected;
      |              ~~~~~~~^~~~~~~~~~
[1172/1224] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.strtoll_test.__unit__.__build__.dir/strtoll_test.cpp.o
[1173/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fdopen_test.__unit__.__build__.dir/fdopen_test.cpp.o
[1174/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fopencookie_test.__unit__.__build__.dir/fopencookie_test.cpp.o
[1175/1224] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgetc_unlocked_test.__unit__.__build__.dir/fgetc_unlocked_test.cpp.o
[1176/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.fgetc_test.__unit__.__build__
[1177/1224] Linking CXX executable libc/test/src/stdlib/libc.test.src.stdlib.strtoul_test.__unit__.__build__
[1178/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.setvbuf_test.__unit__.__build__
[1179/1224] Linking CXX executable libc/test/src/stdio/libc.test.src.stdio.unlocked_fileop_test.__unit__.__build__

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building libc at step 10 "Add check check-libc-amdgcn-amd-amdhsa".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7308

Here is the relevant piece of the build log for the reference
Step 10 (Add check check-libc-amdgcn-amd-amdhsa) failure: test (failure)
...
[1505/2807] Linking CXX static library libc/test/include/liblibc.test.include.isnanl_test.__hermetic__.libc.a
[1506/2807] Linking CXX static library libc/test/include/liblibc.test.include.isinf_test.__hermetic__.libc.a
[1507/2807] Building CXX object libc/test/src/math/smoke/CMakeFiles/libc.test.src.math.smoke.f16divf_test.__hermetic__.__build__.dir/f16divf_test.cpp.o
[1508/2807] Building CXX object libc/test/src/math/smoke/CMakeFiles/libc.test.src.math.smoke.fdiv_test.__hermetic__.__build__.dir/fdiv_test.cpp.o
[1509/2807] Linking CXX static library libc/test/include/liblibc.test.include.isinff_test.__hermetic__.libc.a
[1510/2807] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.vsscanf_test.__hermetic__.__build__.dir/vsscanf_test.cpp.o
[1511/2807] Building CXX object libc/test/src/math/smoke/CMakeFiles/libc.test.src.math.smoke.fsubl_test.__hermetic__.__build__.dir/fsubl_test.cpp.o
[1512/2807] Linking CXX static library libc/test/include/liblibc.test.include.isfinite_test.__hermetic__.libc.a
[1513/2807] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.putc_test.__hermetic__.__build__.dir/putc_test.cpp.o
[1514/2807] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__hermetic__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__hermetic__.__build__.dir/fgets_test.cpp.o 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang++ --target=amdgcn-amd-amdhsa -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -D__LIBC_USE_FLOAT16_CONVERSION -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc -isystem /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa -O3 -DNDEBUG -UNDEBUG --target=amdgcn-amd-amdhsa -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT)" -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ffixed-point -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -Wno-multi-gpu -nogpulib -mcpu=native -flto -mcode-object-version=6 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__hermetic__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__hermetic__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__hermetic__.__build__.dir/fgets_test.cpp.o -c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/src/stdio/fgets_test.cpp
In file included from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/Test.h:37:
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_21_0_0_git::testing::Test::matchAndExplain<__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
   38 |   ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
      |   ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  511 |   LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
      |   ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  504 |   LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
      |                          ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:423:7: note: expanded from macro 'LIBC_TEST_SCAFFOLDING_'
  423 |   if (TEST)                                                                    \
      |       ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  115 |   bool match(T got) {
      |                ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
   42 |       return actual >= expected;
      |              ~~~~~~ ^  ~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/ErrnoSetterMatcher.h:120:25: note: in instantiation of member function '__llvm_libc_21_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
  120 |       return return_cmp.compare(actual_return);
      |                         ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                              ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_21_0_0_git::testing::Test::matchAndExplain<__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
   38 |   ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
      |   ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  511 |   LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
      |   ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-riscv64-debian-fullbuild-dbg running on libc-riscv64-debian while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/183/builds/14670

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN      ] LlvmLibcFOpenCookieTest.WriteOnlyCookieTest
[       OK ] LlvmLibcFOpenCookieTest.WriteOnlyCookieTest (15 us)
[ RUN      ] LlvmLibcFOpenCookieTest.AppendOnlyCookieTest
[       OK ] LlvmLibcFOpenCookieTest.AppendOnlyCookieTest (20 us)
[ RUN      ] LlvmLibcFOpenCookieTest.ReadUpdateCookieTest
[       OK ] LlvmLibcFOpenCookieTest.ReadUpdateCookieTest (15 us)
[ RUN      ] LlvmLibcFOpenCookieTest.WriteUpdateCookieTest
[       OK ] LlvmLibcFOpenCookieTest.WriteUpdateCookieTest (12 us)
Ran 5 tests.  PASS: 5  FAIL: 0
[781/1107] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('nullptr_t' and 'nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN      ] LlvmLibcFOpenCookieTest.WriteOnlyCookieTest
[       OK ] LlvmLibcFOpenCookieTest.WriteOnlyCookieTest (15 us)
[ RUN      ] LlvmLibcFOpenCookieTest.AppendOnlyCookieTest
[       OK ] LlvmLibcFOpenCookieTest.AppendOnlyCookieTest (20 us)
[ RUN      ] LlvmLibcFOpenCookieTest.ReadUpdateCookieTest
[       OK ] LlvmLibcFOpenCookieTest.ReadUpdateCookieTest (15 us)
[ RUN      ] LlvmLibcFOpenCookieTest.WriteUpdateCookieTest
[       OK ] LlvmLibcFOpenCookieTest.WriteUpdateCookieTest (12 us)
Ran 5 tests.  PASS: 5  FAIL: 0
[781/1107] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -std=gnu++17 -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'nullptr_t' with an lvalue of type 'char *'
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                                   ^~~~~
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  bool match(T got) {
               ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('nullptr_t' and 'nullptr_t')
      return actual >= expected;
             ~~~~~~ ^  ~~~~~~~~
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::Comparator<nullptr_t>::compare' requested here
      return return_cmp.compare(actual_return) &&
                        ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>::match' requested here
    return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
                             ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_20_0_0_git::testing::Test::matchAndExplain<__llvm_libc_20_0_0_git::testing::internal::ErrnoSetterMatcher<nullptr_t>, char *>' requested here
  ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
  ^
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
                         ^
In file included from /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:

vonosmas added a commit that referenced this pull request Jun 13, 2025
…"" (#144129)

Reverts #143972 - matcher seems to be pedantic for
fgets tests, reverting to verify and fix.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jun 13, 2025
…eckingTest."" (#144129)

Reverts llvm/llvm-project#143972 - matcher seems to be pedantic for
fgets tests, reverting to verify and fix.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 13, 2025

LLVM Buildbot has detected a new failure on builder libc-riscv32-qemu-yocto-fullbuild-dbg running on rv32gc-qemu-system while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/196/builds/9015

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
ninja: no work to do.
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.unlocked_fileop_test.__unit__.__build__.dir/unlocked_fileop_test.cpp.o
[2/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.remove_test.__unit__.__build__.dir/remove_test.cpp.o
[3/1053] Building CXX object libc/test/src/inttypes/CMakeFiles/libc.test.src.inttypes.strtoumax_test.__unit__.__build__.dir/strtoumax_test.cpp.o
[4/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.rename_test.__unit__.__build__.dir/rename_test.cpp.o
[5/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fdopen_test.__unit__.__build__.dir/fdopen_test.cpp.o
[6/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.setvbuf_test.__unit__.__build__.dir/setvbuf_test.cpp.o
[7/1053] Building CXX object libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o 
/usr/local/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -D_DEBUG -I/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc -isystem /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/build/libc/include -mabi=ilp32d -march=rv32imafdc --target=riscv32-unknown-linux-gnu --sysroot=/opt/riscv/sysroot --gcc-toolchain=/opt/riscv -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -std=gnu++17 --target=riscv32-unknown-linux-gnu -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ffixed-point -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -MD -MT libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -MF libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o.d -o libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fgets_test.__unit__.__build__.dir/fgets_test.cpp.o -c /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp
In file included from /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:15:
In file included from /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoCheckingTest.h:14:
In file included from /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37:
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:36: error: cannot initialize a parameter of type 'std::nullptr_t' with an lvalue of type 'char *'
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                                    ^~~~~
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_21_0_0_git::testing::Test::matchAndExplain<__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
   38 |   ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
      |   ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  511 |   LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
      |   ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  504 |   LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
      |                          ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:115:16: note: passing argument to parameter 'got' here
  115 |   bool match(T got) {
      |                ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:42:21: error: invalid operands to binary expression ('std::nullptr_t' and 'std::nullptr_t')
   42 |       return actual >= expected;
      |              ~~~~~~ ^  ~~~~~~~~
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/ErrnoSetterMatcher.h:122:25: note: in instantiation of member function '__llvm_libc_21_0_0_git::testing::internal::Comparator<std::nullptr_t>::compare' requested here
  122 |       return return_cmp.compare(actual_return) &&
      |                         ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:203:30: note: in instantiation of member function '__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>::match' requested here
  203 |     return testMatch(Matcher.match(Value), Matcher, ValueStr, MatcherStr, Loc);
      |                              ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:38:3: note: in instantiation of function template specialization '__llvm_libc_21_0_0_git::testing::Test::matchAndExplain<__llvm_libc_21_0_0_git::testing::internal::ErrnoSetterMatcher<std::nullptr_t>, char *>' requested here
   38 |   ASSERT_THAT(LIBC_NAMESPACE::fgets(buff, 8, file), Fails(EBADF, nullptr));
      |   ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:511:3: note: expanded from macro 'ASSERT_THAT'
  511 |   LIBC_TEST_MATCH_(MATCHER, MATCH, #MATCHER, #MATCH, return)
      |   ^
/home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:504:26: note: expanded from macro 'LIBC_TEST_MATCH_'
  504 |   LIBC_TEST_SCAFFOLDING_(matchAndExplain(MATCHER, MATCH, MATCHER_STR,          \
      |                          ^
In file included from /home/libcrv32buildbot/bbroot/libc-riscv32-qemu-yocto-fullbuild-dbg/llvm-project/libc/test/src/stdio/fgets_test.cpp:16:

tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…143972)

This reverts commit a93e55e and fixes
build and test failures:

* Proper include added to setvbuf_test.cpp
* fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and
are made more precise. This fixes inconsistencies between expectations
in regular and GPU builds - ErrnoSetterMatcher is configured to omit
errno matching on GPUs, as fgetc implementation on GPU doesn't set
errno, in contrast to Linux.
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…"" (llvm#144129)

Reverts llvm#143972 - matcher seems to be pedantic for
fgets tests, reverting to verify and fix.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
…143972)

This reverts commit a93e55e and fixes
build and test failures:

* Proper include added to setvbuf_test.cpp
* fgetc/fgetc_unlocked/fgets tests are ported to ErrnoSetterMatcher and
are made more precise. This fixes inconsistencies between expectations
in regular and GPU builds - ErrnoSetterMatcher is configured to omit
errno matching on GPUs, as fgetc implementation on GPU doesn't set
errno, in contrast to Linux.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
…"" (llvm#144129)

Reverts llvm#143972 - matcher seems to be pedantic for
fgets tests, reverting to verify and fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants