|
@@ -12,6 +12,9 @@
|
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
+#include <sys/time.h>
|
|
|
+#include <sys/resource.h>
|
|
|
+
|
|
|
#include <server_common/portconfig.h>
|
|
|
#include <testutils/socket_request.h>
|
|
|
#include <testutils/mockups.h>
|
|
@@ -313,13 +316,22 @@ TEST_F(InstallListenAddressesDeathTest, inconsistent) {
|
|
|
// Make sure it actually kills the application (there should be an abort
|
|
|
// in this case)
|
|
|
EXPECT_DEATH({
|
|
|
- try {
|
|
|
- installListenAddresses(deathAddresses, store_, dnss_);
|
|
|
- } catch (...) {
|
|
|
- // Prevent exceptions killing the application, we need
|
|
|
- // to make sure it dies the real hard way
|
|
|
- };
|
|
|
- }, "");
|
|
|
+ /* Set rlimits so that no coredumps are created. As a new
|
|
|
+ process is forked to run this EXPECT_DEATH test, the rlimits
|
|
|
+ of the parent process that runs the other tests should be
|
|
|
+ unaffected. */
|
|
|
+ rlimit core_limit;
|
|
|
+ core_limit.rlim_cur = 0;
|
|
|
+ core_limit.rlim_max = 0;
|
|
|
+ EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
|
|
|
+
|
|
|
+ try {
|
|
|
+ installListenAddresses(deathAddresses, store_, dnss_);
|
|
|
+ } catch (...) {
|
|
|
+ // Prevent exceptions killing the application, we need
|
|
|
+ // to make sure it dies the real hard way
|
|
|
+ };
|
|
|
+ }, "");
|
|
|
}
|
|
|
|
|
|
// If we are unable to tell the boss we closed a socket, we abort, as we are
|
|
@@ -330,16 +342,25 @@ TEST_F(InstallListenAddressesDeathTest, cantClose) {
|
|
|
// Instruct it to fail on close
|
|
|
sock_requestor_.break_release_ = true;
|
|
|
EXPECT_DEATH({
|
|
|
- try {
|
|
|
- // Setting to empty will close all current sockets.
|
|
|
- // And thanks to the break_release_, the close will
|
|
|
- // throw, which will make it crash.
|
|
|
- installListenAddresses(empty, store_, dnss_);
|
|
|
- } catch (...) {
|
|
|
- // To make sure it is killed by abort, not by some
|
|
|
- // (unhandled) exception
|
|
|
- };
|
|
|
- }, "");
|
|
|
+ /* Set rlimits so that no coredumps are created. As a new
|
|
|
+ process is forked to run this EXPECT_DEATH test, the rlimits
|
|
|
+ of the parent process that runs the other tests should be
|
|
|
+ unaffected. */
|
|
|
+ rlimit core_limit;
|
|
|
+ core_limit.rlim_cur = 0;
|
|
|
+ core_limit.rlim_max = 0;
|
|
|
+ EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // Setting to empty will close all current sockets.
|
|
|
+ // And thanks to the break_release_, the close will
|
|
|
+ // throw, which will make it crash.
|
|
|
+ installListenAddresses(empty, store_, dnss_);
|
|
|
+ } catch (...) {
|
|
|
+ // To make sure it is killed by abort, not by some
|
|
|
+ // (unhandled) exception
|
|
|
+ };
|
|
|
+ }, "");
|
|
|
// And reset it back, so it can safely clean up itself.
|
|
|
sock_requestor_.break_release_ = false;
|
|
|
}
|