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

Rigorous automated testing #118

Open
10 tasks
Tracked by #120
JackKelly opened this issue Mar 27, 2024 · 0 comments
Open
10 tasks
Tracked by #120

Rigorous automated testing #118

JackKelly opened this issue Mar 27, 2024 · 0 comments
Labels
testing_benchmarking_CI Automatically ensuring the code behaves

Comments

@JackKelly
Copy link
Owner

JackKelly commented Mar 27, 2024

Ideas from Jon Gjenset's talk Towards Impeccable Rust at Rust Nation UK 2024 on Wednesday 27th March 2024:

Automatically check for memory leaks and UB

Chaos testing

"Anything that can go wrong will go wrong (and at the worst possible time)."

Useful crates:

  • turmoil (for async code: change the order in which Futures are polled)
  • shuttle (for sync code)
  • Chaos testing input values: quickcheck or proptest. Try random inputs, and ensure the code still behaves(!)
  • cargo-mutants: logic chaos. Alters your code (e.g. changing x+1 to x-1) and ensures tests fail.

Exhaustive testing

Useful crates:

  • Loom: Tries all possible and distinguishable concurrent executions. Tries all ways that threads could interleave execution order. This testing can take hours to run. It only works well for relatively simple systems (otherwise the number of permutations explodes).
  • Kani: Analyses your code to find the specific values that exercise many different conditional branches. e.g. if you have if x == 4000 { foo() } else { bar() } then Kani will figure out that the only two important values for x are 4000 and anything other than 4000.

Related

@JackKelly JackKelly added the testing_benchmarking_CI Automatically ensuring the code behaves label Mar 27, 2024
@JackKelly JackKelly moved this to Todo in light-speed-io Mar 27, 2024
This was referenced Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing_benchmarking_CI Automatically ensuring the code behaves
Projects
Status: Todo
Development

No branches or pull requests

1 participant