]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/ceph_assert.cc: Disable core files 66334/head
authorBob Ham <bham12@bloomberg.net>
Thu, 10 Apr 2025 12:24:22 +0000 (12:24 +0000)
committerJoseph Mundackal <joseph.j.mundackal@gmail.com>
Thu, 20 Nov 2025 13:20:43 +0000 (08:20 -0500)
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 <bham12@bloomberg.net>
test/ceph_assert.cc: Update line numbers

Signed-off-by: Bob Ham <bham12@bloomberg.net>
(cherry picked from commit 430a9aad5538f7f2e7aa0595220b4cae78d252a3)

src/test/ceph_assert.cc

index 63d3c3f0f176aec08e4aba01f263a8215340d764..ddbba5155261ce71c8e3fbef11a4cc333ceb9eed 100644 (file)
@@ -1,6 +1,8 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
+#include <sys/time.h>
+#include <sys/resource.h>
 #include <fmt/format.h>
 
 #include "common/ceph_argparse.h"
 
 #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();