Skip to content

Commit

Permalink
Fix madvise tests harder
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Sep 29, 2023
1 parent 76963d6 commit ab20cbc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static void set_page_values_nonzero(int* p) {
int main(void) {
int* page;
void* fixed_area;
int ret;
page_size = sysconf(_SC_PAGESIZE);

fixed_area =
Expand Down Expand Up @@ -58,9 +59,12 @@ int main(void) {
test_assert(count_page_zeroes(page) == PAGE_ZEROES);

set_page_values_nonzero(page);
test_assert(0 == madvise(page, page_size, MADV_DONTNEED_LOCKED) ||
errno == EINVAL);
test_assert(count_page_zeroes(page) == PAGE_ZEROES);
ret = madvise(page, page_size, MADV_DONTNEED_LOCKED);
if (ret) {
test_assert(errno == EINVAL);
} else {
test_assert(count_page_zeroes(page) == PAGE_ZEROES);
}

atomic_puts("EXIT-SUCCESS");

Expand Down

0 comments on commit ab20cbc

Please sign in to comment.