rust-random / getrandom

A small cross-platform library for retrieving random data from (operating) system source
Apache License 2.0
264 stars 166 forks source link

Cleanup Custom Tests #473

Closed josephlr closed 2 weeks ago

josephlr commented 3 weeks ago

This moves the tests for the custom RNG registration into custom.rs. It also:

Split out from #471 CC @briansmith

josephlr commented 2 weeks ago

@newpavlov @briansmith PTAL. I moved the custom.rs tests back to being an integration test, so both supported and unsupported platforms are now tested without changing the cfg_if! in lib.rs.

This looks fine to me, but I am not sure we need to specifically test that custom implementations do not overwrite the default backends.

Also, I have an alternative proposal. I think we can do the following:

I think its important to test that:

This will eliminate the weird juggling around RDRAND and will allow us to test a custom implementation on standard Linux targets. Using cfg(test) will ensure that the testing branches will not escape outside of this crate.

I agree that RDRAND has some weird juggling, but that's probably best left for discussion in #476