darfink / region-rs

A cross-platform virtual memory API written in Rust
https://darfink.github.io/region-rs/
MIT License
119 stars 23 forks source link

feat: isolated tests #13

Closed darfink closed 3 years ago

darfink commented 3 years ago

Historically, the majority of tests have been dependent on the alloc_pages utility function. This has been troublesome due to it not being able to generate adjacent pages with specific page permissions. Therefore protect was used, rendering the utility function self-reliant on the crate itself, therefore not isolating the test fixture from the implementation.

This commit introduces an implementation of alloc_pages that is not dependent on the library itself. This is achieved by identifying a region with enough memory available, and allocating one page at a time with the expected properties.