test: make crypto.timingSafeEqual test less flaky
Checklist
-
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
crypto
Description of change
WIP; do not merge.
The crypto.timingSafeEqual
test still seems to be a bit flaky. This makes a few changes to the test:
- Separates the basic usage and the benchmarking into different tests
- Moves the timing-sensitive benchmark function into a separate module, and reparses the module on every iteration of the loop to avoid shared state between timing measurements.
If this doesn't work, an alternative would be to start a separate child process for each individual timing measurement, which would completely avoid shared state between measurements (although it would also probably make the test much more CPU-intensive).
/cc @trott
Refs: #8040, #8203, #8304