我有一个使用 googletest 实现的 c++ 测试类,所以它完美地传递了 Xcode,输出如下:
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from test_fixture
[ RUN ] test_fixture.test_name
[ OK ] test_fixture.test_name (65609 ms)
[----------] 1 test from test_fixture (65609 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (65609 ms total)
[ PASSED ] 1 test.
但是,当我尝试使用ctest
命令在终端上运行相同的测试时,它会给出一个奇怪的错误Unexpected format:
,输出如下:
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from test_fixture
[ RUN ] test_fixture.test_name
Unexpected format: [ RUN ] test_fixture.test_name (it is always printing the above line)
<end of output>
Test time = 29.72 sec
对于 Xcode 和 ctest,使用相同的 iOS 模拟器,我不明白为什么测试输出给出的结论是“失败”或“通过”。我已经搜索了很多该错误,但找不到任何合理的答案,所以请帮忙。
更新:
原来 ios 模拟器工具ios-sim
对运行时间超过 30 秒的应用程序有问题(我尝试了一个 googletest 类,该类具有三个空函数,它们之间有 15 秒的延迟,应用程序在第二个时崩溃),模拟器崩溃该应用程序,但还没有找到原因。