IMPALA-4239: fix buffer pool test failures in release build Gtest's ASSERT_DEBUG_DEATH macro has peculiar semantics where in debug builds it executes the code in a forked process, so it has no visible side-effects, but in release builds it executes the code as normal. This makes it difficult to write death tests that work in both debug and release builds. To avoid this problem, update our wrapper macro to omit the code in release builds (where we can't actually test DCHECKs anyway).
Change-Id: Ia560e702ecac2d29dc72f444645d5a91743c95e3 Reviewed-on: http://gerrit.cloudera.org:8080/4596 Reviewed-by: Alex Behm <[email protected]> Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/08636ace Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/08636ace Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/08636ace Branch: refs/heads/master Commit: 08636ace0f1f569a4256b598685dd8e5fdda0d87 Parents: a9b9933 Author: Tim Armstrong <[email protected]> Authored: Mon Oct 3 08:57:50 2016 -0700 Committer: Internal Jenkins <[email protected]> Committed: Thu Oct 6 00:23:30 2016 +0000 ---------------------------------------------------------------------- be/src/testutil/death-test-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/08636ace/be/src/testutil/death-test-util.h ---------------------------------------------------------------------- diff --git a/be/src/testutil/death-test-util.h b/be/src/testutil/death-test-util.h index d84b374..8522b61 100644 --- a/be/src/testutil/death-test-util.h +++ b/be/src/testutil/death-test-util.h @@ -24,11 +24,21 @@ // Wrapper around gtest's ASSERT_DEBUG_DEATH that prevents coredumps and minidumps // being generated as the result of the death test. +#ifndef NDEBUG #define IMPALA_ASSERT_DEBUG_DEATH(fn, msg) \ do { \ ScopedCoredumpDisabler disable_coredumps; \ ASSERT_DEBUG_DEATH(fn, msg); \ } while (false); +#else +// Gtest's ASSERT_DEBUG_DEATH macro has peculiar semantics where in debug builds it +// executes the code in a forked process, so it has no visible side-effects, but in +// release builds it executes the code as normal. This makes it difficult to write +// death tests that work in both debug and release builds. To avoid this problem, update +// our wrapper macro to simply omit the death test expression in release builds, where we +// can't actually test DCHECKs anyway. +#define IMPALA_ASSERT_DEBUG_DEATH(fn, msg) +#endif namespace impala {
