Project

General

Profile

Actions

Bug #41159

open

TableFormatter doesn't work for a single column

Added by David Zafman over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
David Zafman
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Adding the code below to src/test/common/test_tableformatter.cc dumps core upon flush().

TEST(tableformatter, singlecolumn)
{
  std::stringstream sout;
  TableFormatter formatter;
  formatter.dump_int("int", 1);
  formatter.dump_int("int", 2);
  formatter.flush(sout);

  std::string cmp = "" 
  "+------+\n" 
  "| int  |\n" 
  "+------+\n" 
  "| 1    |\n" 
  "+------+\n" 
  "| 2    |\n" 
  "+------+\n";
  EXPECT_EQ(cmp, sout.str());
}
$ bin/unittest_tableformatter
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from tableformatter
[ RUN      ] tableformatter.singlecolumn
Segmentation fault (core dumped)
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from tableformatter
[ RUN      ] tableformatter.singlecolumn

Program received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:315
315     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:315
#1  0x00007fffed2110bd in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007fffed21142a in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007fffee92b4e0 in ceph::TableFormatter::flush (this=0x7fffffffd7e0, os=...) at /home/dzafman/ceph/src/common/Formatter.cc:618
#4  0x00005555555dea8e in tableformatter_singlecolumn_Test::TestBody (this=0x555555887af0) at /home/dzafman/ceph/src/test/common/test_tableformatter.cc:16
#5  0x0000555555627db3 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (object=0x555555887af0, method=&virtual testing::Test::TestBody(),
    location=0x55555563c3db "the test body") at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2439
#6  0x0000555555621117 in testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=0x555555887af0, method=&virtual testing::Test::TestBody(),
    location=0x55555563c3db "the test body") at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2475
#7  0x00005555555fdfe6 in testing::Test::Run (this=0x555555887af0) at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2514
#8  0x00005555555fe965 in testing::TestInfo::Run (this=0x5555558e07e0) at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2690
#9  0x00005555555ff071 in testing::TestSuite::Run (this=0x5555558de160) at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2822
#10 0x000055555560aae9 in testing::internal::UnitTestImpl::RunAllTests (this=0x5555558c77c0) at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:5332
#11 0x00005555556291d4 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x5555558c77c0,
    method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x55555560a6d0 <testing::internal::UnitTestImpl::RunAllTests()>,
    location=0x55555563ce18 "auxiliary test code (environments or event listeners)") at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2439
#12 0x0000555555622237 in testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x5555558c77c0,
    method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x55555560a6d0 <testing::internal::UnitTestImpl::RunAllTests()>,
    location=0x55555563ce18 "auxiliary test code (environments or event listeners)") at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:2475
#13 0x00005555556093d7 in testing::UnitTest::Run (this=0x55555586d4e0 <testing::UnitTest::GetInstance()::instance>)
    at /home/dzafman/ceph/src/googletest/googletest/src/gtest.cc:4920
#14 0x00005555555e0de9 in RUN_ALL_TESTS () at /home/dzafman/ceph/src/googletest/googletest/include/gtest/gtest.h:2472
#15 0x00005555555e0d77 in main (argc=1, argv=0x7fffffffdf58) at /home/dzafman/ceph/src/googletest/googlemock/src/gmock_main.cc:63

No data to display

Actions

Also available in: Atom PDF