Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libc/test/src/__support/File/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ if(NOT (TARGET libc.src.__support.threads.mutex) OR LIBC_TARGET_OS_IS_GPU)
return()
endif()

# TODO: Investigate the precommit bots' failures of this test and re-enable it.
# https://github.com/llvm/llvm-project/issues/128185.
set(file_test_unit_only "")
if(LIBC_TARGET_OS_IS_LINUX AND LLVM_LIBC_FULL_BUILD)
set(file_test_unit_only "UNIT_TEST_ONLY")
endif()

add_libc_test(
file_test
${file_test_unit_only}
SUITE
libc-support-tests
SRCS
Expand All @@ -23,6 +31,7 @@ add_libc_test(

add_libc_test(
platform_file_test
${file_test_unit_only}
SUITE
libc-support-tests
SRCS
Expand Down
4 changes: 4 additions & 0 deletions libc/test/src/__support/File/file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ StringFile *new_string_file(char *buffer, size_t buflen, int bufmode,
LIBC_NAMESPACE::File::mode_flags(mode));
}

// TODO: Investigate the precommit bots' failures of this test and re-enable it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use

#if 0
...
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

Google Test supports disabling tests by prefixing their name with DISABLED_. This is better than commenting out the code or using #if 0, as disabled tests are still compiled (and thus won't rot). We should consider implementing the same feature in libc's test framework.

Copy link
Contributor

Choose a reason for hiding this comment

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

We'd probably want that to be target dependent as well, there's a handful of places where I need to disable a test only on NVPTX for example.

// https://github.com/llvm/llvm-project/issues/128185.
#if 0
TEST(LlvmLibcFileTest, WriteOnly) {
const char data[] = "hello, file";
constexpr size_t FILE_BUFFER_SIZE = sizeof(data) * 3 / 2;
Expand Down Expand Up @@ -150,6 +153,7 @@ TEST(LlvmLibcFileTest, WriteOnly) {

ASSERT_EQ(f->close(), 0);
}
#endif

TEST(LlvmLibcFileTest, WriteLineBuffered) {
const char data[] = "hello\n file";
Expand Down
4 changes: 4 additions & 0 deletions libc/test/src/__support/File/platform_file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ LIBC_INLINE File *openfile(const char *file_name, const char *mode) {
return error_or_file.has_value() ? error_or_file.value() : nullptr;
}

// TODO: Investigate the precommit bots' failures of this test and re-enable it.
// https://github.com/llvm/llvm-project/issues/128185.
#if 0
TEST(LlvmLibcPlatformFileTest, CreateWriteCloseAndReadBack) {
constexpr char FILENAME[] = "testdata/create_write_close_and_readback.test";
File *file = openfile(FILENAME, "w");
Expand All @@ -40,6 +43,7 @@ TEST(LlvmLibcPlatformFileTest, CreateWriteCloseAndReadBack) {

ASSERT_EQ(file->close(), 0);
}
#endif

TEST(LlvmLibcPlatformFileTest, CreateWriteSeekAndReadBack) {
constexpr char FILENAME[] = "testdata/create_write_seek_and_readback.test";
Expand Down
Loading