48#define MAX_PRIORITIES 10
164 "Test failed.\n", test_pattern->
test_exten, test_pattern->
context, (new_engine ?
"new" :
"old"));
180 "Test failed.\n", test_pattern->
test_exten, test_pattern->
context, (new_engine ?
"new" :
"old"));
190 static const char registrar[] =
"test_pbx";
192 static const char TEST_PATTERN[] =
"test_pattern";
193 static const char TEST_PATTERN_INCLUDE[] =
"test_pattern_include";
200 const char * context_string;
203 { TEST_PATTERN_INCLUDE, },
214 const char *outer_context;
215 const char *inner_context;
216 } context_includes[] = {
217 { TEST_PATTERN, TEST_PATTERN_INCLUDE },
229 [0] = { TEST_PATTERN,
"_2.",
NULL, 1, { 1 } },
230 [1] = { TEST_PATTERN,
"2000",
NULL, 1, { 1 } },
231 [2] = { TEST_PATTERN_INCLUDE,
"2000",
NULL, 1, { 2 } },
243 { TEST_PATTERN,
"2000",
NULL, 1, &
extens[1] },
244 { TEST_PATTERN,
"2000",
NULL, 2, &
extens[2] },
245 { TEST_PATTERN_INCLUDE,
"2000",
NULL, 2, &
extens[2] },
250 info->name =
"pattern_match_test";
251 info->category =
"/main/pbx/";
252 info->summary =
"Test pattern matching";
253 info->description =
"Create a context with a bunch of extensions within. Then attempt\n"
254 "to match some strings to the extensions.";
276 for (i = 0; i <
ARRAY_LEN(context_includes); ++i) {
278 context_includes[i].inner_context,
registrar)) {
280 context_includes[i].inner_context, context_includes[i].outer_context);
290 "Max is %d, but we requested %d. Test failed\n",
310 for (j = 0; j < 2; j++) {
330 info->name =
"RAISE_SEGV";
331 info->category =
"/DO_NOT_RUN/";
332 info->summary =
"RAISES SEGV!!! (will only be run if explicitly called)";
333 info->description =
"RAISES SEGV!!! (will only be run if explicitly called). "
334 "This test is mainly used for testing CI and tool failure scenarios.";
335 info->explicit_only = 1;
350 info->name =
"CALL_ASSERT";
351 info->category =
"/DO_NOT_RUN/";
352 info->summary =
"Calls ast_asert()!!! (will only be run if explicitly called)";
353 info->description =
"Calls ast_asert()!!! (will only be run if explicitly called). "
354 "This test is mainly used for testing CI and tool failure scenarios.";
355 info->explicit_only = 1;
370 info->name =
"CALL_BACKTRACE";
371 info->category =
"/DO_NOT_RUN/";
372 info->summary =
"Calls ast_log_backtrace()!!! (will only be run if explicitly called)";
373 info->description =
"Calls ast_log_backtrace()!!! (will only be run if explicitly called). "
374 "This test is mainly used for testing CI and tool failure scenarios.";
375 info->explicit_only = 1;
390 info->name =
"JUST_FAIL";
391 info->category =
"/TEST_PASS_FAIL/";
392 info->summary =
"Just fails";
393 info->description =
"Just fails. "
394 "This test is mainly used for testing CI and tool failure scenarios.";
395 info->explicit_only = 1;
409 info->name =
"JUST_PASS";
410 info->category =
"/TEST_PASS_FAIL/";
411 info->summary =
"Just passes";
412 info->description =
"Just passes. "
413 "This test is mainly used for testing CI and tool failure scenarios.";
414 info->explicit_only = 1;
Asterisk main include file. File version handling, generic pbx functions.
void ast_log_backtrace(void)
Log a backtrace of the current thread's execution stack to the Asterisk log.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
static struct ast_context * contexts
Core PBX routines and definitions.
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
int ast_context_add_include(const char *context, const char *include, const char *registrar)
Add a context include.
const char * ast_get_extension_cidmatch(struct ast_exten *e)
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
int pbx_set_extenpatternmatchnew(int newval)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context or ANY context if NULL)
struct ast_exten * pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
const char * ast_get_extension_name(struct ast_exten *exten)
static void * cleanup(void *unused)
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
an extension to add to our context
const int num_priorities
Number of priorities.
const char * exten
Extension pattern.
const char * context
Context.
const int priorities[MAX_PRIORITIES]
The priorities to register.
const char * cid
CID match.
const struct exten_info * exten
Expected extension match.
const int priority
The priority to find.
const char * test_cid
Test CID match.
const char * context
Test context.
const char * test_exten
Test extension number.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
static int test_exten(const struct pbx_test_pattern *test_pattern, struct ast_test *test, int new_engine)
static int load_module(void)
static int unload_module(void)
AST_TEST_DEFINE(pattern_match_test)