Named Lock unit tests.
More...
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Named 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 |
|
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ AST_TEST_DEFINE()
AST_TEST_DEFINE |
( |
named_lock_test |
| ) |
|
Definition at line 58 of file test_named_lock.c.
References ao2_lock, ao2_trylock, ao2_unlock, ast_named_lock_get, ast_named_lock_put, AST_NAMED_LOCK_TYPE_MUTEX, ast_pthread_create, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvdiff_ms(), ast_tvnow(), sip_to_pjsip::info(), lock_thread(), NULL, TEST_EXECUTE, and TEST_INIT.
65 struct timeval start_time;
70 info->name =
"named_lock_test";
71 info->category =
"/main/lock/";
72 info->summary =
"Named Lock test";
74 "Tests that named locks operate as expected";
87 ast_test_validate_cleanup(
test, lock1 !=
NULL, res, fail);
90 ast_test_validate_cleanup(
test, lock2 !=
NULL, res, fail);
123 ast_test_validate_cleanup(
test, duration > 1500 && duration < 3500, res, fail);
132 pthread_join(thread1,
NULL);
133 pthread_join(thread2,
NULL);
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_test_status_update(a, b, c...)
static void * lock_thread(void *data)
#define ast_pthread_create(a, b, c, d)
#define ast_named_lock_get(lock_type, keyspace, key)
Geta named lock handle.
#define ast_named_lock_put(lock)
Put a named lock handle away.
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ lock_thread()
static void* lock_thread |
( |
void * |
data | ) |
|
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Named 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 |
◆ ast_module_info