[asterisk-dev] [Code Review] Migrates hashtest/hashtest2 to be unit tests
Mark Michelson
reviewboard at asterisk.org
Wed Nov 14 10:53:40 CST 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2189/#review7388
-----------------------------------------------------------
Ship it!
The tests themselves look good. The only worrying part is the timeouts involved. If we start seeing test failures in the testsuite due to timeouts, we may have to bump it up some.
- Mark
On Nov. 13, 2012, 10:07 a.m., David Lee wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2189/
> -----------------------------------------------------------
>
> (Updated Nov. 13, 2012, 10:07 a.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> Both hashtest and hashtest2 are manual testing apps that thrash hash
> tables (hashtab and ao2 containers, respectively), by spinning up
> several threads that randomly insert, delete, lookup and iterate over
> the hash table. If the app doesn't crash, the hash table probably passes
> the test. Those utils are not a part of the typical Asterisk build, so
> they do not usually get compiled. This all makes them less that useful.
>
> This patch removes those manual test programs and replaces them with
> Asterisk unit test modules (test_{hashtab,astobj2}_thrash.so). It also
> attempts to make the tests more deterministic.
>
> * Rather than spinning up some number of threads that operate on the
> hash table randomly, spin up four threads that concurrenly add,
> remove, lookup and iterate over the hash table.
> * Each thread checks the state of the hash table both during and after
> execution, and indicates a test failure if things are not as expected.
> * Each thread times out after 60 seconds to prevent deadlocking the unit
> test run.
>
>
> This addresses bug ASTERISK-20505.
> https://issues.asterisk.org/jira/browse/ASTERISK-20505
>
>
> Diffs
> -----
>
> /branches/1.8/include/asterisk/hashtab.h 376195
> /branches/1.8/tests/test_astobj2_thrash.c PRE-CREATION
> /branches/1.8/tests/test_hashtab_thrash.c PRE-CREATION
> /branches/1.8/utils/Makefile 376195
> /branches/1.8/utils/hashtest.c 376195
> /branches/1.8/utils/hashtest2.c 376195
> /branches/1.8/utils/utils.xml 376195
>
> Diff: https://reviewboard.asterisk.org/r/2189/diff
>
>
> Testing
> -------
>
> Tests run and pass on OS X and 64-bit Ubuntu 12.10.
>
> If I disable 'do_locking' on the hashtab and rerun the test, the test fails (surprisingly, it does not segfault).
>
> If I turn down the test timeout to 1 second, the tests all time out.
>
>
> Thanks,
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121114/6b16bdf5/attachment.htm>
More information about the asterisk-dev
mailing list