-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test LlvmLibcFILETest.SimpleFileOperations fails due to file descriptor assertion #126106
Comments
@llvm/issue-subscribers-libc Author: Alan Zhao (alanzhao1)
Repro steps:
Result:
Looking at the code the test opens a file and assert that its file descriptor is equal to the hardcoded value 3. This seems to be a brittle assertion as it makes assumptions about the test's process environment. |
@llvm/issue-subscribers-bug Author: Alan Zhao (alanzhao1)
Repro steps:
Result:
Looking at the code the test opens a file and assert that its file descriptor is equal to the hardcoded value 3. This seems to be a brittle assertion as it makes assumptions about the test's process environment. |
Perhaps that ASSERT_EQ should be an ASSERT_GE? stdin, stdout, and stderr should be 0, 1, 2. If the test harness has other files open when that test is run, then perhaps a newly created file isn't necessarily 3. |
Yeah, that seems reasonable. I'll create that PR in a sec. |
The file descriptor of the first opened file is not necessarily 3, so we change the assertion so that it's >= 3 (i.e. not 0, 1, 2, or -1 which correspond to stdin, stdout, stderr, or error respectively.) Fixes llvm#126106
…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
Repro steps:
I ran this test on Linux.
I have 0d7ee52 checked out (though the bug is present in earlier commits.)
Result:
Looking at the code the test opens a file and assert that its file descriptor is equal to the hardcoded value 3. This seems to be a brittle assertion as it makes assumptions about the test's process environment.
The text was updated successfully, but these errors were encountered: