diff options
Diffstat (limited to 'vespalib/src/tests/exception_classes/silenceuncaught_test.cpp')
-rw-r--r-- | vespalib/src/tests/exception_classes/silenceuncaught_test.cpp | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp index 6c757b00af6..a15e9327d16 100644 --- a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp +++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp @@ -1,7 +1,7 @@ // Copyright Yahoo. 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/child_process.h> +#include <vespa/vespalib/process/process.h> using namespace vespalib; @@ -14,27 +14,23 @@ using namespace vespalib; #endif TEST("that uncaught exception causes negative exitcode.") { - ChildProcess proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught"); - proc.wait(); - EXPECT_LESS(proc.getExitCode(), 0); + Process proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught"); + EXPECT_LESS(proc.join(), 0); } TEST("that uncaught silenced exception causes exitcode 66") { - ChildProcess proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught"); - proc.wait(); - EXPECT_EQUAL(proc.getExitCode(), 66); + Process proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught"); + EXPECT_EQUAL(proc.join(), 66); } TEST("that caught silenced exception followed by an uncaught causes negative exitcode.") { - ChildProcess proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught"); - proc.wait(); - EXPECT_LESS(proc.getExitCode(), 0); + Process proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught"); + EXPECT_LESS(proc.join(), 0); } TEST("that caught silenced exception causes exitcode 0") { - ChildProcess proc("exec ./vespalib_caught_uncaught_app silenced_and_caught"); - proc.wait(); - EXPECT_EQUAL(proc.getExitCode(), 0); + Process proc("exec ./vespalib_caught_uncaught_app silenced_and_caught"); + EXPECT_EQUAL(proc.join(), 0); } #ifndef __SANITIZE_ADDRESS__ @@ -42,23 +38,20 @@ TEST("that caught silenced exception causes exitcode 0") { // setrlimit with RLIMIT_AS is broken on Darwin #else TEST("that mmap within limits are fine cause exitcode 0") { - ChildProcess proc("exec ./vespalib_mmap_app 150000000 10485760 1"); - proc.wait(); - EXPECT_EQUAL(proc.getExitCode(), 0); + Process proc("exec ./vespalib_mmap_app 150000000 10485760 1"); + EXPECT_EQUAL(proc.join(), 0); } TEST("that mmap beyond limits cause negative exitcode.") { - ChildProcess proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10"); - proc.wait(); - EXPECT_LESS(proc.getExitCode(), 0); + Process proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10"); + EXPECT_LESS(proc.join(), 0); } TEST("that mmap beyond limits with set VESPA_SILENCE_CORE_ON_OOM cause exitcode 66.") { - ChildProcess proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10"); - proc.wait(); - EXPECT_EQUAL(proc.getExitCode(), 66); + Process proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10"); + EXPECT_EQUAL(proc.join(), 66); } #endif #endif -TEST_MAIN_WITH_PROCESS_PROXY() { TEST_RUN_ALL(); } +TEST_MAIN() { TEST_RUN_ALL(); } |