Asterisk - The Open Source Telephony Project GIT-master-b023714
|
SCOPED_LOCK unit tests. More...
#include "asterisk.h"
#include "asterisk/test.h"
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | test_struct |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (cleanup_order) | |
AST_TEST_DEFINE (lock_test) | |
static int | load_module (void) |
static void | lock_it (ast_mutex_t *lock) |
static struct test_struct * | test_iterator_next (struct ao2_iterator *iter) |
wrapper for ao2_iterator_next | |
static void | test_lock (struct test_struct *test) |
lock callback function | |
static struct test_struct * | test_ref (struct test_struct *test) |
ref callback function | |
static void | test_unlock (struct test_struct *test) |
unlock callback function | |
static void | test_unref (struct test_struct *test) |
unref callback function | |
static int | unload_module (void) |
static void | unlock_it (ast_mutex_t *lock) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SCOPED_LOCK test module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_test * | current_test |
static int | indicator |
static ast_mutex_t | the_lock = AST_MUTEX_INIT_VALUE |
SCOPED_LOCK unit tests.
Definition in file test_scoped_lock.c.
|
static |
Definition at line 283 of file test_scoped_lock.c.
|
static |
Definition at line 283 of file test_scoped_lock.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 283 of file test_scoped_lock.c.
AST_TEST_DEFINE | ( | cleanup_order | ) |
Definition at line 197 of file test_scoped_lock.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_container_alloc_hash, ao2_iterator_destroy(), ao2_iterator_init(), ao2_link, ast_log, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, container, current_test, lock, LOG_ERROR, NULL, RAII_VAR, SCOPED_LOCK, TEST_EXECUTE, TEST_INIT, test_iterator_next(), test_lock(), test_ref(), test_unlock(), and test_unref().
AST_TEST_DEFINE | ( | lock_test | ) |
Definition at line 55 of file test_scoped_lock.c.
References ast_log, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, current_test, indicator, lock, lock_it(), LOG_ERROR, SCOPED_LOCK, TEST_EXECUTE, TEST_INIT, the_lock, and unlock_it().
|
static |
Definition at line 276 of file test_scoped_lock.c.
References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.
|
static |
Definition at line 43 of file test_scoped_lock.c.
References ast_mutex_lock, indicator, and lock.
Referenced by AST_TEST_DEFINE().
|
static |
wrapper for ao2_iterator_next
Grabs the next item in the container and replaces the ref acquired from ao2_iterator_next() with a call to test_ref().
Definition at line 179 of file test_scoped_lock.c.
References ao2_iterator_next, ao2_ref, NULL, and test_ref().
Referenced by AST_TEST_DEFINE().
|
static |
lock callback function
Locks the object passed in. Only sets the locked flag if the object is reffed. This allows us to check that locking is always occurring after reffing.
Definition at line 115 of file test_scoped_lock.c.
References ao2_lock, ast_test_status_update, and current_test.
Referenced by AST_TEST_DEFINE().
|
static |
ref callback function
Refs the object passed in. Only sets the reffed flag if the object is not locked. This allows us to ensure that reffing always occurs before locking.
Definition at line 147 of file test_scoped_lock.c.
References ao2_ref, ast_test_status_update, and current_test.
Referenced by AST_TEST_DEFINE(), and test_iterator_next().
|
static |
unlock callback function
Unlocks the object passed in. Only clears the locked flag if the object is still reffed. This allows us to ensure that unlocking is always occurring before unreffing.
Definition at line 131 of file test_scoped_lock.c.
References ao2_unlock, ast_test_status_update, and current_test.
Referenced by AST_TEST_DEFINE().
|
static |
unref callback function
Unrefs the object passed in. Only sets the unreffed flag if the object is not locked. This allows us to ensure that unreffing always occurs after unlocking.
Definition at line 164 of file test_scoped_lock.c.
References ao2_ref, ast_test_status_update, and current_test.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 269 of file test_scoped_lock.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 49 of file test_scoped_lock.c.
References ast_mutex_unlock, indicator, and lock.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 283 of file test_scoped_lock.c.
|
static |
Definition at line 283 of file test_scoped_lock.c.
|
static |
Definition at line 40 of file test_scoped_lock.c.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), test_lock(), test_ref(), test_unlock(), and test_unref().
|
static |
Definition at line 39 of file test_scoped_lock.c.
Referenced by acf_odbc_read(), AST_TEST_DEFINE(), cli_odbc_read(), hfp_parse_cind(), hfp_parse_cind_indicator(), hfp_parse_cind_test(), lock_it(), realtime_multi_odbc(), realtime_odbc(), and unlock_it().
|
static |
Definition at line 41 of file test_scoped_lock.c.
Referenced by AST_TEST_DEFINE().