gpt4 book ai didi

c++ - 有没有办法在使用宏定义的 Boost 测试框架中忽略 SIGCHLD?

转载 作者:太空狗 更新时间:2023-10-29 23:17:07 25 4
gpt4 key购买 nike

我有这样一个问题:我的 C++ 代码需要启动然后终止子进程。一切正常,但是当我尝试使用 Boost.Test 为它编写测试时,测试失败了

unknown location(0): fatal error in "test_sync": child was killed; pid: 7787; uid: 1000; exit value: 9

这是因为 Boost 将杀死 child 视为失败。它可以通过使用 --catch_system_errors=no 命令行选项开始测试来解决,但我不喜欢这个解决方案,因为我想要的只是忽略 SIGCHLD。更多,我想在编译时不传递任何命令行选项。一个宏定义就可以了,但是

BOOST_TEST_IGNORE_SIGCHLD

不适合我。它只是没有效果。

我正在使用 boost-1.53​​.0。

最佳答案

John Zwinck 在评论中回答了我的问题:Comments here suggest BOOST_TEST_IGNORE_SIGCHLD must be defined during the compilation of the Boost test library itself

在应用程序编译期间似乎没有办法实现它。

关于c++ - 有没有办法在使用宏定义的 Boost 测试框架中忽略 SIGCHLD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20145840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com