From fe146fa123a8965b8d8f0f3f2d89f8e9fad8e677 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Sun, 4 Sep 2016 23:51:30 +0000 Subject: Add test proving that this did not work. Must set/unset terminate_handler. But that will be tomorrow. --- .../exception_classes/silenceuncaught_test.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 vespalib/src/tests/exception_classes/silenceuncaught_test.cpp (limited to 'vespalib/src/tests/exception_classes/silenceuncaught_test.cpp') diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp new file mode 100644 index 00000000000..7f6ae20ded9 --- /dev/null +++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp @@ -0,0 +1,26 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include +#include +#include + +using namespace vespalib; + +TEST("that uncaught exception causes exitcode 1") { + SlaveProc proc("./vespalib_caught_uncaught_app uncaught"); + proc.wait(); + EXPECT_LESS(proc.getExitCode(), 0); +} + +TEST("that uncaught silenced exception causes exitcode 66") { + SlaveProc proc("./vespalib_caught_uncaught_app silenced_and_uncaught"); + proc.wait(); + EXPECT_EQUAL(proc.getExitCode(), 66); +} + +TEST("that caught silenced exception causes exitcode 0") { + SlaveProc proc("./vespalib_caught_uncaught_app silenced_and_caught"); + proc.wait(); + EXPECT_EQUAL(proc.getExitCode(), 0); +} + +TEST_MAIN_WITH_PROCESS_PROXY() { TEST_RUN_ALL(); } -- cgit v1.2.3