Tests and RNG
cxl000 at hotmail.com
cxl000 at hotmail.com
Fri Feb 24 00:25:21 EST 2006
Derek Atkins wrote:
>Unfortunately there's just no good way to do this.. There's no
>way to record the initial random seed after-the-fact, because
>it's actually initialized in libqof (in guid.c, in fact). Also,
>there's just not a good infrastructure to set an initial random
>seed for the tests during the standard "make check" sequence.
>
>
>Many tests do have a commented-out srand(1) to re-inialize the RNG
>in order to make a deterministic test. However, /most/ of the
>time the bugs we find through the RNG are bugs in the test, not
>bugs in the code being tested.
>
>-derek
>
>
My thinking was that it would be fairly easy to instrument the test (or
qof) to log the initial seed and thus have it reported when the test
failed and having the seed available would enable a developer to
reproduce the problem which then makes it easier to find the root cause
be it in the test code or application code.
If you re-initialize the RNG in the test and log this value then testing
could be a simple as hardcode the seen for debugging purposes.
However if it is not considered worthwhile I'll not send patches. ;-)
Regards,
Chris
More information about the gnucash-devel
mailing list