-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
[libc] remove fragile test from mincore #74026
Merged
Merged
Conversation
This file contains 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
@llvm/pr-subscribers-libc Author: Schrodinger ZHU Yifan (SchrodingerZhu) ChangesFull diff: https://github.com/llvm/llvm-project/pull/74026.diff 1 Files Affected:
diff --git a/libc/test/src/sys/mman/linux/mincore_test.cpp b/libc/test/src/sys/mman/linux/mincore_test.cpp
index 655fd8631af89a2..1b0ed157483eb02 100644
--- a/libc/test/src/sys/mman/linux/mincore_test.cpp
+++ b/libc/test/src/sys/mman/linux/mincore_test.cpp
@@ -41,23 +41,13 @@ static char *aligned_addr(void *addr, size_t alignment) {
TEST(LlvmLibcMincoreTest, InvalidVec) {
size_t page_size = static_cast<size_t>(LIBC_NAMESPACE::sysconf(_SC_PAGESIZE));
- void *addr = LIBC_NAMESPACE::mmap(nullptr, 5 * page_size, PROT_READ,
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, page_size, PROT_READ,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_NE(addr, MAP_FAILED);
- // Since we allocated 5 pages, we can find an aligned boundary after which
- // there are at least 4 pages
char *aligned = aligned_addr(addr, page_size);
- libc_errno = 0;
int res = LIBC_NAMESPACE::mincore(aligned, 1, nullptr);
EXPECT_THAT(res, Fails(EFAULT, -1));
- void *area = LIBC_NAMESPACE::mmap(nullptr, page_size, PROT_READ | PROT_WRITE,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- EXPECT_NE(area, MAP_FAILED);
- unsigned char *ptr = static_cast<unsigned char *>(area) + page_size - 3;
- res = LIBC_NAMESPACE::mincore(aligned, 4 * page_size, ptr);
- EXPECT_THAT(res, Fails(EFAULT, -1));
- EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, 5 * page_size), Succeeds());
- EXPECT_THAT(LIBC_NAMESPACE::munmap(area, page_size), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, page_size), Succeeds());
}
TEST(LlvmLibcMincoreTest, UnalignedAddr) {
|
@nickdesaulniers it turns out to be unstable to test vec with insufficient length. I think we may just remove that test. |
SchrodingerZhu
changed the title
[libc] remove fragile test for mincore
[libc] remove fragile test from mincore
Dec 1, 2023
lntue
approved these changes
Dec 1, 2023
SchrodingerZhu
added a commit
to SchrodingerZhu/llvm-project
that referenced
this pull request
Dec 4, 2023
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.
No description provided.