diff options
| author | Gustavo Kissel <kisselgustavo@gmail.com> | 2026-11-23 16:30:36 -0300 |
|---|---|---|
| committer | Gustavo Kissel <kisselgustavo@gmail.com> | 2026-11-23 16:30:36 -0300 |
| commit | 61c95045e45e77b9ceb9340b487a0b6ed4f1cbd3 (patch) | |
| tree | 32d1a6c807f4babf98f8c3f5956751ba01609939 /runtime/test/xmem_test.cpp | |
| parent | b170ab90eee8c085ae3a62cee9aa70884b8b1552 (diff) | |
test(xmem): multi-page unmap across views, remap inside a live run, freed page refused
The coverage gaps isfcrctfs listed on #7584.
Diffstat (limited to 'runtime/test/xmem_test.cpp')
| -rw-r--r-- | runtime/test/xmem_test.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/test/xmem_test.cpp b/runtime/test/xmem_test.cpp index 256718b88..0ea007595 100644 --- a/runtime/test/xmem_test.cpp +++ b/runtime/test/xmem_test.cpp | |||
| @@ -480,10 +480,23 @@ void test_long_run(const PhysicalApi& api) { | |||
| 480 | if (i != 10) kept &= page_holds(window + i * kPage64k, static_cast<uint32_t>(i + 1)); | 480 | if (i != 10) kept &= page_holds(window + i * kPage64k, static_cast<uint32_t>(i + 1)); |
| 481 | } | 481 | } |
| 482 | check(kept, "every other page of the run keeps its contents"); | 482 | check(kept, "every other page of the run keeps its contents"); |
| 483 | // Several pages across the boundary of two capped views unmap together; the pages on both sides stay. | ||
| 484 | check(api.map(window + 1000 * kPage64k, 50, nullptr) == window + 1000 * kPage64k && | ||
| 485 | reserved_only(window + 1000 * kPage64k) && reserved_only(window + 1049 * kPage64k), | ||
| 486 | "a multi-page range across two views unmaps"); | ||
| 487 | check(page_holds(window + 999 * kPage64k, 1000u) && page_holds(window + 1050 * kPage64k, 1051u), | ||
| 488 | "the pages on both sides of it keep their contents"); | ||
| 489 | // Mapping other pages over the middle of a live run replaces just those pages. | ||
| 490 | check(api.map(window + 500 * kPage64k, 3, &pages[600]) == window + 500 * kPage64k && | ||
| 491 | page_holds(window + 500 * kPage64k, 601u) && page_holds(window + 502 * kPage64k, 603u), | ||
| 492 | "pages mapped over the middle of a live run replace it there"); | ||
| 493 | check(page_holds(window + 499 * kPage64k, 500u) && page_holds(window + 503 * kPage64k, 504u), | ||
| 494 | "and the run's pages around them keep their contents"); | ||
| 483 | check(api.map(window, kPages, nullptr) == window && reserved_only(window) && | 495 | check(api.map(window, kPages, nullptr) == window && reserved_only(window) && |
| 484 | reserved_only(window + (kPages - 1) * kPage64k), | 496 | reserved_only(window + (kPages - 1) * kPage64k), |
| 485 | "the whole run unmaps"); | 497 | "the whole run unmaps"); |
| 486 | check(api.free_pages(kPages, pages.data()) == TRUE, "the long run's pages are freed"); | 498 | check(api.free_pages(kPages, pages.data()) == TRUE, "the long run's pages are freed"); |
| 499 | check(api.map(window, 1, pages.data()) == nullptr && reserved_only(window), "a freed page does not map again"); | ||
| 487 | } | 500 | } |
| 488 | 501 | ||
| 489 | void test_placeholders(const PhysicalApi& api) { | 502 | void test_placeholders(const PhysicalApi& api) { |