Skip to content
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

Hardcode random seed used for wpimath tests #7381

Open
calcmogul opened this issue Nov 12, 2024 · 1 comment
Open

Hardcode random seed used for wpimath tests #7381

calcmogul opened this issue Nov 12, 2024 · 1 comment
Labels
component: wpimath Math library type: fix Iterations on existing features or infrastructure.

Comments

@calcmogul
Copy link
Member

calcmogul commented Nov 12, 2024

The tests often use physics sim classes that inject measurement noise. We should hardcode the random seed so the tests are deterministic. This will eliminate a source of test flakiness we've been seeing.

The seed could probably be set in wpimath/src/test/native/cpp/main.cpp before the tests are run.

@calcmogul calcmogul added component: wpimath Math library type: fix Iterations on existing features or infrastructure. labels Nov 12, 2024
@rzblue
Copy link
Member

rzblue commented Nov 12, 2024

Is there any reason not to hardcode the seed across the board (ie, not just for tests)?

Either way, this requires a refactor of how noise is generated for the sim classes- the pseudorandom generator would need to be retained with the class instance rather than being recreated with a random seed each update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpimath Math library type: fix Iterations on existing features or infrastructure.
Projects
None yet
Development

No branches or pull requests

2 participants