Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
24318aac
Commit
24318aac
authored
8 years ago
by
Jenkins2
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "unittests: Add a unit test that causes a SEGV and..."
parents
d6992daa
08edd54c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/asterisk/test.h
+8
-0
8 additions, 0 deletions
include/asterisk/test.h
main/test.c
+2
-2
2 additions, 2 deletions
main/test.c
tests/test_pbx.c
+22
-0
22 additions, 0 deletions
tests/test_pbx.c
with
32 additions
and
2 deletions
include/asterisk/test.h
+
8
−
0
View file @
24318aac
...
...
@@ -241,6 +241,14 @@ struct ast_test_info {
* \note The description must not end with a newline.
*/
const
char
*
description
;
/*!
* \brief Only run if explicitly named
*
* \details
* Run this test only if it's explicitly named on the command line.
* Do NOT run it as part of an execute category or execute all command.
*/
unsigned
int
explicit_only
;
};
#ifdef TEST_FRAMEWORK
...
...
This diff is collapsed.
Click to expand it.
main/test.c
+
2
−
2
View file @
24318aac
...
...
@@ -344,7 +344,7 @@ static int test_execute_multiple(const char *name, const char *category, struct
execute
=
0
;
switch
(
mode
)
{
case
TEST_CATEGORY
:
if
(
!
test_cat_cmp
(
test
->
info
.
category
,
category
))
{
if
(
!
test_cat_cmp
(
test
->
info
.
category
,
category
)
&&
!
test
->
info
.
explicit_only
)
{
execute
=
1
;
}
break
;
...
...
@@ -354,7 +354,7 @@ static int test_execute_multiple(const char *name, const char *category, struct
}
break
;
case
TEST_ALL
:
execute
=
1
;
execute
=
!
test
->
info
.
explicit_only
;
}
if
(
execute
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/test_pbx.c
+
22
−
0
View file @
24318aac
...
...
@@ -321,8 +321,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
;
}
...
...
@@ -330,6 +351,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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment