[llvm] 828d2d7 - [Support][test] Fix OpenDirectoryAsFileForRead test on AIX and z/OS (#216241)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 08:33:48 PDT 2026
Author: Daniel Chen
Date: 2026-08-14T11:33:43-04:00
New Revision: 828d2d7fb65a9cd5946b347ad5173e3bdb21387d
URL: https://github.com/llvm/llvm-project/commit/828d2d7fb65a9cd5946b347ad5173e3bdb21387d
DIFF: https://github.com/llvm/llvm-project/commit/828d2d7fb65a9cd5946b347ad5173e3bdb21387d.diff
LOG: [Support][test] Fix OpenDirectoryAsFileForRead test on AIX and z/OS (#216241)
Commit 9c7ba7b1d12e ("[AIX][SystemZ][Support] Check if file is dir on
open instead of read") moved the `fstat`/`EISDIR` check from
`readNativeFile()` to `openNativeFileForRead()` on AIX and z/OS. This
means `openNativeFileForRead()` now returns `EISDIR` immediately on
those
platforms, but the test `FileSystemTest.OpenDirectoryAsFileForRead` was
not updated to match, causing it to fail at the
`ASSERT_THAT_EXPECTED(FD, Succeeded())` assertion.
Add a `#elif defined(_AIX) || defined(__MVS__)` branch to the test that
expects the error to be returned from `openNativeFileForRead()` rather
than from `readNativeFile()`, consistent with the behavior introduced by
that commit.
Added:
Modified:
llvm/unittests/Support/Path.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index b63ab426bb080..31599f6152e92 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -2040,7 +2040,7 @@ TEST_F(FileSystemTest, SetLastAccessAndModificationTimeDirectory) {
TEST_F(FileSystemTest, OpenDirectoryAsFileForRead) {
std::string Buf(5, '?');
Expected<fs::file_t> FD = fs::openNativeFileForRead(TestDirectory);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(_AIX) || defined(__MVS__)
EXPECT_EQ(errorToErrorCode(FD.takeError()), errc::is_a_directory);
#else
ASSERT_THAT_EXPECTED(FD, Succeeded());
More information about the llvm-commits
mailing list