boost单元测试框架使用clang和libc ++中止

时间:2012-10-04 17:57:29

标签: c++ unit-testing boost clang libc++

我正在使用:

SLES 11 x86_64

使用以下内容编译

Boost 1.51.0 : ./b2 toolset = clang cxxflags =“ - stdlib = libc ++ -std = c ++ 11”linkflags =“ - stdlib = libc ++”

来自svn的

clang (大约两个弱者)

来自svn的

libc ++ (几乎是最新的)

测试在结束时中止(SIGABORT):

./unitTest
Running 3 test cases...
ModelTest.cpp(28): error in "GameField_added_correctly": check objects.size() == std::size_t{1} failed [0 != 1]
ModelTest.cpp(37): error in "Spaceship_added_correctly": check objects.size() == std::size_t{1} failed [0 != 1]
ModelTest.cpp(52): error in "Spaceship_out_of_GameField_is_demolished_after_tick": check objects.size() == std::size_t{2} failed [0 != 2]
ModelTest.cpp(59): error in "Spaceship_out_of_GameField_is_demolished_after_tick": check objects.size() == std::size_t{1} failed [0 != 1]

Aborted

这是一个非常有趣的回溯:

Program received signal SIGABRT, Aborted.
0x00007ffff7183945 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
        in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
#0  0x00007ffff7183945 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff7184f21 in *__GI_abort () at abort.c:92
#2  0x00007ffff796020f in std::uncaught_exception () at ../src/exception.cpp:110
#3  0x00007ffff7968784 in std::__1::basic_ostream<char>::sentry::~sentry (this=0x7fffffffcd18) at ../include/ostream:243
#4  0x000000000042a348 in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) ()
#5  0x000000000042b85f in boost::unit_test::results_reporter::make_report(boost::unit_test::report_level, unsigned long) ()
#6  0x0000000000431e22 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) ()
#7  0x00007ffff716fbc6 in __libc_start_main (main=0x432110 <main>, argc=1, ubp_av=0x7fffffffced8, init=0x45d380 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffcec8) at libc-start.c:226
#8  0x0000000000405ec9 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)

想要打印测试结果时失败。所有测试用例都通过时也会发生同样的情况。 可以看出,在std :: ostream被破坏期间,有一个异常。 奇怪的是,std :: uncaught_exception不是来自libc ++内联命名空间(__1)。

你们之前有没有遇到过类似的问题?可能有什么不对?

更新: libcxx中可能存在的错误: http://llvm.org/bugs/show_bug.cgi?id=13669

0 个答案:

没有答案