summaryrefslogtreecommitdiff
path: root/tests/test_astobj2_thrash.c
AgeCommit message (Collapse)Author
2016-10-25test_astobj2_thrash: Fix multithreaded issuesGeorge Joseph
The test uses 4 threads to grow, count, lookup and shrink 15K objects in a container. If there's only 1 execution engine available, the test will complete in <50ms. If each threads gets its own execution engine, the test may timeout after 60 seconds because the count thread does a locked ao2_callback on the whole container in a tight loop with only a sched_yield to give up time. The lock contention makes the test execution times wildly variable and mostly timeout. 2 execution engines are OK, 3 results in about 33% failure rate and >=4 causes a 80% failure rate. To fix, the sched_yield was changed to a usleep(500). Also, the number of buckets specified for the container was an even number so that was changed to the next prime number greater than (MAX_HASH_ENTRIES / 100). That's 151 currently. Change-Id: I50cd2344161ea61bfe4b96d2a29a6ccf88385c77
2014-07-22Fix more dev-mode build issuesKinsey Moore
........ Merged revisions 419129 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 419162 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 419163 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16Migrate hashtest/hashtest2 to be unit tests.David M. Lee
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. (closes issue ASTERISK-20505) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2189/ ........ Merged revisions 376306 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376315 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376339 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376341 65c4cc65-6c06-0410-ace0-fbb531ad65f3