Speed up crypto library unit tests#466
Closed
kaczmarczyck wants to merge 1 commit intogoogle:developfrom
Closed
Conversation
Collaborator
Author
|
Similar to #465 , the coverage report only changed in that it correctly handles libraries/persistent_store/src/store.rs now. |
ia0
reviewed
Apr 26, 2022
Member
ia0
left a comment
There was a problem hiding this comment.
I understand the motivation for this, but I'm not sure this is the right solution at the moment. Here are some thoughts:
- We want tests to be fast. This PR does it.
- We want to thoroughly test the crypto. This PR reverts some of this. It would be fine if we had fuzzing. (Those test targets are essentially fuzzing targets.)
I see 2 options if we want to address desktop tests running time:
- This PR followed by crypto fuzzing in a short time span.
- Remove crypto tests from desktop tests (the tests still run on github workflows), take time to add crypto fuzzing, finally this PR (or even just delete the tests that are subsumed by fuzzing, unit tests should be concrete cases, not loops).
| @@ -1005,7 +1005,10 @@ pub mod test { | |||
| fn test_scalar_base_mul_is_scalar_mul_generator() { | |||
| let gen = precomputed(0, 0); | |||
| // TODO: more scalars | |||
Member
There was a problem hiding this comment.
Maybe remove those TODOs? Since the PR does the opposite.
| for i in 0..512 { | ||
| for j in i..512 { | ||
| for i in (0..512).step_by(16) { | ||
| for j in (i..512).step_by(16) { |
Member
There was a problem hiding this comment.
Why step 16 here? The idea of the test is to test slices of different sizes. I would use 3 and 5 (or 13 and 17 if we want bigger numbers)
Collaborator
Author
|
Closed for #467. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Local testing (
run_desktop_tests.sh) is unnecessarily slow, in part because of the slow unit tests in the crypto library. Some unit tests took over a minute to complete.This PR reduces the number of iterations for these tests. No test should take longer than a second.
--report-timehelps finding slow tests. This PR is a 50x reduction in CPU load for these tests.Before:
After: