Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Functions | Variables
test_threadpool.c File Reference

threadpool unit tests More...

#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/lock.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/test.h"
#include "asterisk/threadpool.h"

Go to the source code of this file.

Data Structures

struct  complex_task_data
 
struct  simple_task_data
 
struct  test_listener_data
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
 AST_TEST_DEFINE (threadpool_push)
 
 AST_TEST_DEFINE (threadpool_initial_threads)
 
 AST_TEST_DEFINE (threadpool_thread_creation)
 
 AST_TEST_DEFINE (threadpool_thread_destruction)
 
 AST_TEST_DEFINE (threadpool_thread_timeout)
 
 AST_TEST_DEFINE (threadpool_thread_timeout_thrash)
 
 AST_TEST_DEFINE (threadpool_one_task_one_thread)
 
 AST_TEST_DEFINE (threadpool_one_thread_one_task)
 
 AST_TEST_DEFINE (threadpool_one_thread_multiple_tasks)
 
 AST_TEST_DEFINE (threadpool_auto_increment)
 
 AST_TEST_DEFINE (threadpool_max_size)
 
 AST_TEST_DEFINE (threadpool_reactivation)
 
 AST_TEST_DEFINE (threadpool_task_distribution)
 
 AST_TEST_DEFINE (threadpool_more_destruction)
 
 AST_TEST_DEFINE (threadpool_serializer)
 
 AST_TEST_DEFINE (threadpool_serializer_dupe)
 
static int complex_task (void *data)
 
static struct complex_task_datacomplex_task_data_alloc (void)
 
static void complex_task_data_free (struct complex_task_data *ctd)
 
static int has_complex_started (struct complex_task_data *ctd)
 
static enum ast_test_result_state listener_check (struct ast_test *test, struct ast_threadpool_listener *listener, int task_pushed, int was_empty, int num_tasks, int num_active, int num_idle, int empty_notice)
 
static int load_module (void)
 
static void poke_worker (struct complex_task_data *ctd)
 
static int simple_task (void *data)
 
static struct simple_task_datasimple_task_data_alloc (void)
 
static void simple_task_data_free (struct simple_task_data *std)
 
static struct test_listener_datatest_alloc (void)
 
static void test_emptied (struct ast_threadpool *pool, struct ast_threadpool_listener *listener)
 
static void test_shutdown (struct ast_threadpool_listener *listener)
 
static void test_state_changed (struct ast_threadpool *pool, struct ast_threadpool_listener *listener, int active_threads, int idle_threads)
 
static void test_task_pushed (struct ast_threadpool *pool, struct ast_threadpool_listener *listener, int was_empty)
 
static int unload_module (void)
 
static enum ast_test_result_state wait_for_completion (struct ast_test *test, struct simple_task_data *std)
 
static enum ast_test_result_state wait_for_complex_completion (struct complex_task_data *ctd)
 
static int wait_for_complex_start (struct complex_task_data *ctd)
 
static enum ast_test_result_state wait_for_empty_notice (struct ast_test *test, struct test_listener_data *tld)
 
static void wait_for_task_pushed (struct ast_threadpool_listener *listener)
 
static enum ast_test_result_state wait_until_thread_state (struct ast_test *test, struct test_listener_data *tld, int num_active, int num_idle)
 
static enum ast_test_result_state wait_until_thread_state_task_pushed (struct ast_test *test, struct test_listener_data *tld, int num_active, int num_idle, int num_tasks)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "threadpool 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_infoast_module_info = &__mod_info
 
static const struct ast_threadpool_listener_callbacks test_callbacks
 

Detailed Description

threadpool unit tests

Author
Mark Michelson mmich.nosp@m.elso.nosp@m.n@dig.nosp@m.ium..nosp@m.com

Definition in file test_threadpool.c.