【发布时间】:2016-01-06 12:53:34
【问题描述】:
我有一个使用 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 秒,应用程序在第二个时崩溃),模拟器应用程序崩溃,但尚未找到原因。
【问题讨论】:
-
"Unexpected format:" 很可能不是来自 CMake/CTest。请仔细检查环境。
-
在测试期间,我正在将一些资源转移到 iOS 模拟器,这可能是问题所在,ctest 的 ios 模拟器有限制吗?
标签: c++ ios cmake googletest ctest