Commit eb23a705 authored by Francis Dupont's avatar Francis Dupont
Browse files

[4065] Added unit test

parent c270a430
......@@ -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));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment