-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve test reproducibility #1195
Improve test reproducibility #1195
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
If you could just change the doxygen format then it is mergeable IMO
d626376
to
1d572b1
Compare
src/aliceVision/numeric/numeric.hpp
Outdated
* In order to introduce variation in test execution, ALICEVISION_TEST_RANDOM_SEED environment | ||
* variable can be set to an integer value. | ||
*/ | ||
void makeRandomOperationsReproducibleInTests(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to remove the "inTests" from the generic function name:
void makeRandomOperationsReproducibleInTests(); | |
void makeRandomOperationsReproducible(); |
Even if it's only used in tests for now, it is not specific to unit tests in itself.
Same for the env var: ALICEVISION_TEST_RANDOM_SEED
=> ALICEVISION_RANDOM_SEED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that's correct. Fixed now, thanks.
Many tests call Vec*::Random() and similar functions from Eigen, which make the tests not reproducible. This is problematic, because the tests become unstable and even if some of them sometimes fail indicating a problem, it's hard to debug and fix the failure as the exact conditions of the failing test are not known. Initializing random number generators to a static seed fixes the issue.
1d572b1
to
ace04e0
Compare
requested changes have been done
Many tests call Vec*::Random() and similar functions from Eigen, which make the tests not reproducible. This is problematic, because the tests become unstable and even if some of them sometimes fail indicating a problem, it's hard to debug and fix the failure as the exact conditions of the failing test are not known. Initializing random number generators to a static seed fixes the issue.
In order to introduce variation in test execution,
ALICEVISION_TEST_RANDOM_SEED
environment variable can be set to an integer value. This effectively allows to keep the previous behavior, because this value can be set to a different integer on each test execution.