Uh oh!
There was an error while loading. Please reload this page.
Cleanup Custom Tests - #473
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
// in lib.rscfg_if!{if #[cfg(all(test, test_rdrand))]{mod lazy;
#[path = "rdrand.rs"]mod imp;} else if #[cfg(all(test, test_custom, feature = "custom"))]{use custom as imp;} else if #[cfg( ... ))]{// ...}}// in tests module:register_custom_getrandom!(mock_rng);#[cfg(not(all(feature = "custom", test_custom)))]#[test]fnmock_rng_is_not_used(){// ..}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.
971e0ee to
195e2bfCompare@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
I think its important to test that:
My concern with changing the
I agree that RDRAND has some weird juggling, but that's probably best left for discussion in #476 |
briansmith
left a comment
There was a problem hiding this comment.
This makes a lot more sense to me. Just a couple comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This marks the `tests/custom.rs` test as requiring the `"custom"` feature. It also: - Simplifies the registered custom RNG - Makes sure the custom RNG _is not_ used on supported platforms - Makes sure the custom RNG _is_ used on unsupported platforms Signed-off-by: Joe Richey <joerichey@google.com>
This moves the tests for the custom RNG registration into custom.rs. It also: - Simplifies the registered custom RNG - Makes sure the custom RNG _is not_ used on supported platforms - Makes sure the custom RNG _is_ used on unsupported platforms
This moves the tests for the custom RNG registration into custom.rs. It also:
Split out from #471 CC @briansmith