Asterisk - The Open Source Telephony Project
18.5.0
|
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 (lock_test) | |
AST_TEST_DEFINE (cleanup_order) | |
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 More... | |
static void | test_lock (struct test_struct *test) |
lock callback function More... | |
static struct test_struct * | test_ref (struct test_struct *test) |
ref callback function More... | |
static void | test_unlock (struct test_struct *test) |
unlock callback function More... | |
static void | test_unref (struct test_struct *test) |
unref callback function More... | |
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 = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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 = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
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 | ( | 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, indicator, sip_to_pjsip::info(), lock, lock_it(), LOG_ERROR, SCOPED_LOCK, test, TEST_EXECUTE, TEST_INIT, the_lock, and unlock_it().
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, sip_to_pjsip::info(), lock, LOG_ERROR, NULL, RAII_VAR, SCOPED_LOCK, test, TEST_EXECUTE, TEST_INIT, test_iterator_next(), test_lock(), test_ref(), test_unlock(), and test_unref().
|
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, and indicator.
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, test, 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, test_struct::locked, and test_struct::reffed.
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, test_struct::locked, test_struct::reffed, and 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, test_struct::locked, and test_struct::reffed.
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, test_struct::locked, and test_struct::reffed.
Referenced by AST_TEST_DEFINE().
|
static |
|
static |
Definition at line 49 of file test_scoped_lock.c.
References ast_mutex_unlock, and indicator.
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.
|
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_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().