summaryrefslogtreecommitdiff
path: root/main/test.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-11-21 18:33:16 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-11-21 18:33:16 +0000
commit4ccf2c7aa5e8be4a7f38170c3e7a3d1fa5beed9c (patch)
tree3cd809184b0d4490e359f6f23a32a8071f092880 /main/test.c
parentcc01a794631bcd794ff84dd31f466562c9464f3e (diff)
Add red-black tree container type to astobj2.
* Add red-black tree container type. * Add CLI command "astobj2 container dump <name>" * Added ao2_container_dump() so the container could be dumped by other modules for debugging purposes. * Changed ao2_container_stats() so it can be used by other modules like ao2_container_check() for debugging purposes. * Updated the unit tests to check red-black tree containers. (closes issue ASTERISK-19970) Reported by: rmudgett Tested by: rmudgett Review: https://reviewboard.asterisk.org/r/2110/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/test.c')
-rw-r--r--main/test.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/main/test.c b/main/test.c
index 16973ba1e..b5c3d7d5d 100644
--- a/main/test.c
+++ b/main/test.c
@@ -100,6 +100,27 @@ static int test_insert(struct ast_test *test);
static struct ast_test *test_remove(ast_test_cb_t *cb);
static int test_cat_cmp(const char *cat1, const char *cat2);
+void ast_test_debug(struct ast_test *test, const char *fmt, ...)
+{
+ struct ast_str *buf = NULL;
+ va_list ap;
+
+ buf = ast_str_create(128);
+ if (!buf) {
+ return;
+ }
+
+ va_start(ap, fmt);
+ ast_str_set_va(&buf, 0, fmt, ap);
+ va_end(ap);
+
+ if (test->cli) {
+ ast_cli(test->cli->fd, "%s", ast_str_buffer(buf));
+ }
+
+ ast_free(buf);
+}
+
int __ast_test_status_update(const char *file, const char *func, int line,
struct ast_test *test, const char *fmt, ...)
{