[asterisk-commits] dlee: branch 10-digiumphones r376309 - in /branches/10-digiumphones: ./ inclu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 15 16:58:54 CST 2012


Author: dlee
Date: Thu Nov 15 16:58:49 2012
New Revision: 376309

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376309
Log:
Migrate hashtest/hashtest2 to be unit tests.

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

Added:
    branches/10-digiumphones/tests/test_astobj2_thrash.c
      - copied unchanged from r376306, branches/1.8/tests/test_astobj2_thrash.c
    branches/10-digiumphones/tests/test_hashtab_thrash.c
      - copied unchanged from r376306, branches/1.8/tests/test_hashtab_thrash.c
Removed:
    branches/10-digiumphones/utils/hashtest.c
    branches/10-digiumphones/utils/hashtest2.c
Modified:
    branches/10-digiumphones/   (props changed)
    branches/10-digiumphones/include/asterisk/hashtab.h
    branches/10-digiumphones/utils/Makefile
    branches/10-digiumphones/utils/utils.xml

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10-digiumphones/include/asterisk/hashtab.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/hashtab.h?view=diff&rev=376309&r1=376308&r2=376309
==============================================================================
--- branches/10-digiumphones/include/asterisk/hashtab.h (original)
+++ branches/10-digiumphones/include/asterisk/hashtab.h Thu Nov 15 16:58:49 2012
@@ -23,6 +23,9 @@
  * \brief Generic (perhaps overly so) hashtable implementation
  * \ref AstHash
  */
+
+#include "asterisk/lock.h"
+
 /*! \page AstHash Hash Table support in Asterisk
 
 A hash table is a structure that allows for an exact-match search

Modified: branches/10-digiumphones/utils/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/utils/Makefile?view=diff&rev=376309&r1=376308&r2=376309
==============================================================================
--- branches/10-digiumphones/utils/Makefile (original)
+++ branches/10-digiumphones/utils/Makefile Thu Nov 15 16:58:49 2012
@@ -88,7 +88,7 @@
 	rm -f *.s *.i
 	rm -f md5.c strcompat.c ast_expr2.c ast_expr2.h ast_expr2f.c pbx_ael.c pval.c hashtab.c lock.c
 	rm -f aelparse.c aelbison.c conf2ael
-	rm -f utils.c strings.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
+	rm -f utils.c strings.c threadstorage.c sha1.c astobj2.c refcounter
 	rm -f db1-ast/.*.d
 	@$(MAKE) -C db1-ast clean
 
@@ -175,11 +175,6 @@
 	$(ECHO_PREFIX) echo "   [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
 	$(CMD_PREFIX) cp "$<" "$@"
 
-hashtest2.o: _ASTCFLAGS+=-O0
-hashtest2: hashtest2.o md5.o lock.o utils.o strings.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
-
-hashtest: hashtest.o md5.o hashtab.o lock.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
-hashtest.o: _ASTCFLAGS+=-O0
 
 refcounter: refcounter.o md5.o hashtab.o lock.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
 refcounter.o: _ASTCFLAGS+=-O0

Modified: branches/10-digiumphones/utils/utils.xml
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/utils/utils.xml?view=diff&rev=376309&r1=376308&r2=376309
==============================================================================
--- branches/10-digiumphones/utils/utils.xml (original)
+++ branches/10-digiumphones/utils/utils.xml Thu Nov 15 16:58:49 2012
@@ -32,14 +32,6 @@
 	<defaultenabled>no</defaultenabled>
 	<support_level>extended</support_level>
   </member>
-  <member name="hashtest">
-	<defaultenabled>no</defaultenabled>
-	<support_level>extended</support_level>
-  </member>
-  <member name="hashtest2">
-	<defaultenabled>no</defaultenabled>
-	<support_level>extended</support_level>
-  </member>
   <member name="muted">
 	<defaultenabled>no</defaultenabled>
 	<support_level>extended</support_level>




More information about the asterisk-commits mailing list