diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-04 23:51:30 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-04 23:51:30 +0000 |
commit | fe146fa123a8965b8d8f0f3f2d89f8e9fad8e677 (patch) | |
tree | 94403c7b917a4ae6c593dae0f518b4499be4b853 /vespalib/src/tests/exception_classes/silenceuncaught_test.cpp | |
parent | a34c6e774c8cd4365fbbe093e5d0d8c71904a9e1 (diff) |
Add test proving that this did not work. Must set/unset terminate_handler. But that will be tomorrow.
Diffstat (limited to 'vespalib/src/tests/exception_classes/silenceuncaught_test.cpp')
-rw-r--r-- | vespalib/src/tests/exception_classes/silenceuncaught_test.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/util/exception.h> +#include <vespa/vespalib/util/slaveproc.h> + +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(); } |