From 94ff3fc5563cae814fb9eeb2de7178805cd0b938 Mon Sep 17 00:00:00 2001 From: Bob Ham Date: Thu, 10 Apr 2025 12:24:22 +0000 Subject: [PATCH] test/ceph_assert.cc: Disable core files Without this, core files are produced which subsequently cause failures in other tests, specifically smoke.sh and safe-to-destroy.sh. Fixes: bfa83df6d33ee2238f1389ca4518592b5c4fb267 Signed-off-by: Bob Ham test/ceph_assert.cc: Update line numbers Signed-off-by: Bob Ham (cherry picked from commit 430a9aad5538f7f2e7aa0595220b4cae78d252a3) --- src/test/ceph_assert.cc | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/test/ceph_assert.cc b/src/test/ceph_assert.cc index 63d3c3f0f176..ddbba5155261 100644 --- a/src/test/ceph_assert.cc +++ b/src/test/ceph_assert.cc @@ -1,6 +1,8 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#include +#include #include #include "common/ceph_argparse.h" @@ -12,27 +14,30 @@ #include "gtest/gtest.h" -static void non_supressed_assert_line16() { - ceph_assert(42 == 41); // LINE16 +static void non_supressed_assert_line18() { + ceph_assert(42 == 41); // LINE18 } -static void supressed_assert_line19() { - ceph_assert(42 == 40); // LINE19 +static void supressed_assert_line21() { + ceph_assert(42 == 40); // LINE21 } -static void supressed_assertf_line22() { - ceph_assertf(42 == 39, "FAILED ceph_assertf"); // LINE22 +static void supressed_assertf_line24() { + ceph_assertf(42 == 39, "FAILED ceph_assertf"); // LINE24 } -static void non_supressed_assertf_line25() { - ceph_assertf(42 == 38, "FAILED ceph_assertf"); // LINE25 +static void non_supressed_assertf_line27() { + ceph_assertf(42 == 38, "FAILED ceph_assertf"); // LINE27 } TEST(CephAssertDeathTest, ceph_assert_supresssions) { - ASSERT_DEATH(non_supressed_assert_line16(), "FAILED ceph_assert"); - supressed_assert_line19(); - supressed_assertf_line22(); - ASSERT_DEATH(non_supressed_assertf_line25(), "FAILED ceph_assertf"); + ASSERT_DEATH(non_supressed_assert_line18(), "FAILED ceph_assert"); + supressed_assert_line21(); + supressed_assertf_line24(); + ASSERT_DEATH(non_supressed_assertf_line27(), "FAILED ceph_assertf"); } int main(int argc, char **argv) { + // Disable core files + const struct rlimit rlim = { 0, 0 }; + setrlimit(RLIMIT_CORE, &rlim); auto args = argv_to_vec(argc, argv); auto cct = global_init( @@ -44,7 +49,7 @@ int main(int argc, char **argv) { g_ceph_context->_conf.set_val( "ceph_assert_supresssions", fmt::format( - "{}:{}, {}:{}", __FILE__, /* LINE19 */19, __FILE__, /* LINE22 */22)); + "{}:{}, {}:{}", __FILE__, /* LINE21 */21, __FILE__, /* LINE24 */24)); common_init_finish(g_ceph_context); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -- 2.47.3