Skip to content

Commit 7d0b7b2

Browse files
DanielCChenzhangweize9-cyber
authored andcommitted
[Support][test] Fix OpenDirectoryAsFileForRead test on AIX and z/OS (llvm#216241)
Commit 9c7ba7b ("[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.
1 parent 89eaa23 commit 7d0b7b2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

llvm/unittests/Support/Path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ TEST_F(FileSystemTest, SetLastAccessAndModificationTimeDirectory) {
20402040
TEST_F(FileSystemTest, OpenDirectoryAsFileForRead) {
20412041
std::string Buf(5, '?');
20422042
Expected<fs::file_t> FD = fs::openNativeFileForRead(TestDirectory);
2043-
#ifdef _WIN32
2043+
#if defined(_WIN32) || defined(_AIX) || defined(__MVS__)
20442044
EXPECT_EQ(errorToErrorCode(FD.takeError()), errc::is_a_directory);
20452045
#else
20462046
ASSERT_THAT_EXPECTED(FD, Succeeded());

0 commit comments

Comments
 (0)