11// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
22// vim: ts=8 sw=2 sts=2 expandtab
33
4+ #include < sys/time.h>
5+ #include < sys/resource.h>
46#include < fmt/format.h>
57
68#include " common/ceph_argparse.h"
1214
1315#include " gtest/gtest.h"
1416
15- static void non_supressed_assert_line16 () {
16- ceph_assert (42 == 41 ); // LINE16
17+ static void non_supressed_assert_line18 () {
18+ ceph_assert (42 == 41 ); // LINE18
1719}
18- static void supressed_assert_line19 () {
19- ceph_assert (42 == 40 ); // LINE19
20+ static void supressed_assert_line21 () {
21+ ceph_assert (42 == 40 ); // LINE21
2022}
21- static void supressed_assertf_line22 () {
22- ceph_assertf (42 == 39 , " FAILED ceph_assertf" ); // LINE22
23+ static void supressed_assertf_line24 () {
24+ ceph_assertf (42 == 39 , " FAILED ceph_assertf" ); // LINE24
2325}
24- static void non_supressed_assertf_line25 () {
25- ceph_assertf (42 == 38 , " FAILED ceph_assertf" ); // LINE25
26+ static void non_supressed_assertf_line27 () {
27+ ceph_assertf (42 == 38 , " FAILED ceph_assertf" ); // LINE27
2628}
2729
2830TEST (CephAssertDeathTest, ceph_assert_supresssions) {
29- ASSERT_DEATH (non_supressed_assert_line16 (), " FAILED ceph_assert" );
30- supressed_assert_line19 ();
31- supressed_assertf_line22 ();
32- ASSERT_DEATH (non_supressed_assertf_line25 (), " FAILED ceph_assertf" );
31+ ASSERT_DEATH (non_supressed_assert_line18 (), " FAILED ceph_assert" );
32+ supressed_assert_line21 ();
33+ supressed_assertf_line24 ();
34+ ASSERT_DEATH (non_supressed_assertf_line27 (), " FAILED ceph_assertf" );
3335}
3436
3537int main (int argc, char **argv) {
38+ // Disable core files
39+ const struct rlimit rlim = { 0 , 0 };
40+ setrlimit (RLIMIT_CORE, &rlim);
3641
3742 auto args = argv_to_vec (argc, argv);
3843 auto cct = global_init (
@@ -44,7 +49,7 @@ int main(int argc, char **argv) {
4449 g_ceph_context->_conf .set_val (
4550 " ceph_assert_supresssions" ,
4651 fmt::format (
47- " {}:{}, {}:{}" , __FILE__, /* LINE19 */ 19 , __FILE__, /* LINE22 */ 22 ));
52+ " {}:{}, {}:{}" , __FILE__, /* LINE21 */ 21 , __FILE__, /* LINE24 */ 24 ));
4853 common_init_finish (g_ceph_context);
4954 testing::InitGoogleTest (&argc, argv);
5055 return RUN_ALL_TESTS ();
0 commit comments