summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-05-24 14:50:56 -0600
committerGeorge Joseph <gjoseph@digium.com>2017-05-24 14:56:14 -0600
commit65898c3af82e2d780a48d9d50d3b1c952c208a89 (patch)
tree92235fde577cdf951a62489c06ec6947e957f0cf /tests
parent1bddf1efc342a44f08e2f2d40f70f070b4ac542e (diff)
unittests: Add a unit test that causes a SEGV and...
...that can only be run by explicitly calling it with 'test execute category /DO_NOT_RUN/ name RAISE_SEGV' This allows us to more easily test CI and debugging tools that should do certain things when asterisk coredumps. To allow this a new member was added to the ast_test_info structure named 'explicit_only'. If set by a test, the test will be skipped during a 'test execute all' or 'test execute category ...'. Change-Id: Ia3a11856aae4887df9a02b6b081cc777b36eb6ed
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pbx.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_pbx.c b/tests/test_pbx.c
index bb5d8e871..acf7484c1 100644
--- a/tests/test_pbx.c
+++ b/tests/test_pbx.c
@@ -323,8 +323,29 @@ cleanup:
return res;
}
+AST_TEST_DEFINE(segv)
+{
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "RAISE_SEGV";
+ info->category = "/DO_NOT_RUN/";
+ info->summary = "RAISES SEGV!!! (will only be run if explicitly called)";
+ info->description = "RAISES SEGV!!! (will only be run if explicitly called). "
+ "This test is mainly used for testing CI and tool failure scenarios.";
+ info->explicit_only = 1;
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+ raise(SIGSEGV);
+
+ return AST_TEST_FAIL;
+}
+
static int unload_module(void)
{
+ AST_TEST_UNREGISTER(segv);
AST_TEST_UNREGISTER(pattern_match_test);
return 0;
}
@@ -332,6 +353,7 @@ static int unload_module(void)
static int load_module(void)
{
AST_TEST_REGISTER(pattern_match_test);
+ AST_TEST_REGISTER(segv);
return AST_MODULE_LOAD_SUCCESS;
}