I’m writing a small library that wraps a number of system functions (currently on Mac OS X) using FFI.
One of them calls proc_kmsgbuf() in libproc.c
I have it working, and wrote a small unit test for it. But as this function can only be called with root permissions it fails with “Operation not permitted” in errno.
If I run “sudo cargo test” it passes.
What is the correct way to go about testing such functions, if there is a recommended way?