]> git.pond.sub.org Git - empserver/commit - src/lib/update/prepare.c
tests: Make update robust against variations in PRNG use
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Jun 2016 12:36:15 +0000 (14:36 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:56 +0000 (19:59 +0200)
commit876d061875f7907185f2e38cba63e0e5171389c1
tree4b985432abb880f2f0e9f0dd7cd5cf8fda79757e
parentc8e2a02d2f6ac3ecf63aca1cdacf5f49db24ddf4
tests: Make update robust against variations in PRNG use

Tests need repeatable pseudo-random numbers to yield repeatable
results.  Commit 73f1ac8 (v4.3.33) reseeds the PRNG with the count of
commands right before executing a command when running_test_suite is
on.  This doesn't help the update: whenever update code exercised by a
test is changed to consume fewer or more PRNs, all subsequent users
get different numbers regardless.  The ensuing test result changes are
extremely tedious to review.

To address this problem, reseed the PRNG in the update's two most
important loops with the iteration count when running_test_suite.
This way, the effect of perturbing the PRN sequence lasts only until
the next iteration.

There are many more loops, but reseeding in all of them seems
impractical.

Perturbs test results across the board.  Hopefully, that'll happen
less frequently now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
16 files changed:
src/lib/update/prepare.c
src/lib/update/sect.c
tests/smoke/04/01-1
tests/smoke/05/01-1
tests/smoke/06/01-1
tests/smoke/07/01-1
tests/smoke/08/08-8
tests/smoke/10/08-8
tests/smoke/11/08-8
tests/smoke/12/08-8
tests/smoke/13/08-8
tests/smoke/14/08-8
tests/smoke/final.xdump
tests/smoke/journal.log
tests/update/final.xdump
tests/update/journal.log