Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
eb23a705
Commit
eb23a705
authored
Sep 23, 2015
by
Francis Dupont
Browse files
[4065] Added unit test
parent
c270a430
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/util/threads/tests/thread_unittest.cc
View file @
eb23a705
...
...
@@ -21,6 +21,8 @@
#include
<gtest/gtest.h>
#include
<signal.h>
// This file tests the Thread class. It's hard to test an actual thread is
// started, but we at least check the function is run and exceptions are
// propagated as they should.
...
...
@@ -106,4 +108,20 @@ TEST(ThreadTest, exception) {
}
}
void
getSignalMask
(
sigset_t
*
mask
)
{
pthread_sigmask
(
SIG_SETMASK
,
0
,
mask
);
}
// Verify that all signals are blocked
TEST
(
ThreadTest
,
sigmask
)
{
sigset_t
mask
;
sigemptyset
(
&
mask
);
Thread
thread
(
boost
::
bind
(
getSignalMask
,
&
mask
));
ASSERT_NO_THROW
(
thread
.
wait
());
EXPECT_EQ
(
1
,
sigismember
(
&
mask
,
SIGHUP
));
EXPECT_EQ
(
1
,
sigismember
(
&
mask
,
SIGINT
));
EXPECT_EQ
(
1
,
sigismember
(
&
mask
,
SIGTERM
));
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment