introduces a unit test helper function test_with_proot().
After this we can write unit tests for each system call to test if syscall translation is correct.
test_with_proot() starts a regular proot-rs event loop and runs our tracee function, we can place some syscall in tracee function to simulate a normal tracee program.
In addition, I extended the struct Proot by adding a Fn field to hold a callback function. In this callback function, we are able to check the internal state of proot-rs (e.g. by some assert!() statements).
Of course, all of the above are controlled by conditional compilation and are only enabled in unit tests.
This PR is purely test-related:
test_with_proot()
.After this we can write unit tests for each system call to test if syscall translation is correct.
test_with_proot()
starts a regular proot-rs event loop and runs our tracee function, we can place some syscall in tracee function to simulate a normal tracee program. In addition, I extended thestruct Proot
by adding aFn
field to hold a callback function. In this callback function, we are able to check the internal state of proot-rs (e.g. by someassert!()
statements). Of course, all of the above are controlled by conditional compilation and are only enabled in unit tests.