release/23.x: [Support][test] Fix OpenDirectoryAsFileForRead test on AIX and z/OS (#216241) - #216342
Merged
Conversation
Member
Author
|
@perry-ca What do you think about merging this PR to the release branch? |
|
@llvm/pr-subscribers-llvm-support Author: llvmbot ChangesBackport 828d2d7 Requested by: @amy-kwan Full diff: https://github.com/llvm/llvm-project/pull/216342.diff 1 Files Affected:
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());
|
Contributor
|
Could we get a review of whether this should go into the release branch? |
Member
|
The change is safe. I also did a very rough performance comparison on z/OS and saw a 5-15% performance improvement. We don't need this for z/OS in LLVM 23, but if there is a benefit for AIX (@hubert-reinterpretcast) I'd say go for it as the risk is low. |
hubert-reinterpretcast
approved these changes
Aug 21, 2026
hubert-reinterpretcast
left a comment
Member
There was a problem hiding this comment.
LGTM. The behaviour change is expected (and as can be seen, is not novel but is behaviour also seen under Windows).
…lvm#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. (cherry picked from commit 828d2d7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport 828d2d7
Requested by: @amy-kwan