]> git.pond.sub.org Git - empserver/commit
tests: Make robust against variations in PRNG use
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 13 Jan 2014 19:24:37 +0000 (20:24 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 19 Jan 2014 09:09:17 +0000 (10:09 +0100)
commit73f1ac8a2c005f6876cc11e59808d8bde5db7491
treec6f4e3ce6b249fe3d4b7932f5b39fe7f54f6ec4a
parent6c0a1fcb1e16c9ca96f9340f373c0a91e5a0adca
tests: Make robust against variations in PRNG use

Tests need repeatable pseudorandom numbers to yield repeatable
results.  We seed the pseudorandom number generator with a fixed value
(emp_server -R) to make it produce the same sequence of numbers every
time.  But whenever code exercised by a test is changed to consume
fewer or more of them, all subsequent users get different numbers
regardless.  The ensuing test result changes are extremely tedious to
review.

To address this problem, reseed the PRNG with the count of commands
right before executing a command when running_test_suite is on.  This
way, the effect of perturbing the PRN sequence lasts only until the
next command.

Note that the next command could be another player's.  Doesn't matter.

Adding or removing commands now upsets the PRN sequence even for
commands that don't consume PRNs.  The next commit will take care of
that.

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

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/player/dispatch.c
tests/fire/final.xdump
tests/fire/journal.log
tests/smoke/final.xdump
tests/smoke/journal.log