Skip to content

Commit

Permalink
[libc][minor] Fix assertion in LlvmLibcFILETest.SimpleFileOperations (l…
Browse files Browse the repository at this point in the history
…lvm#126109)

The file descriptor of the first opened file is not necessarily 3, so we
change the assertion so that it's >= 0 (i.e. not an error.)

Fixes llvm#126106
  • Loading branch information
alanzhao1 authored Feb 6, 2025
1 parent 02fa340 commit 4c8acbd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libc/test/src/stdio/fileop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
constexpr char FILENAME[] = "testdata/simple_operations.test";
::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
ASSERT_EQ(LIBC_NAMESPACE::fileno(file), 3);
ASSERT_GE(LIBC_NAMESPACE::fileno(file), 0);
constexpr char CONTENT[] = "1234567890987654321";
ASSERT_EQ(sizeof(CONTENT) - 1,
LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT) - 1, file));
Expand Down

0 comments on commit 4c8acbd

Please sign in to comment.