首页 > 解决方案 > 谷歌UT失败

问题描述

[----------] 2 tests from VideoMgrTest
[Blast] Log directory is: C:\ProgramData\VMware\VMware Blast
[ RUN      ] VideoMgrTest.createVideoMgr
unknown file: error: SEH exception with code 0xc0000005 thrown in TearDown().
[  FAILED  ] VideoMgrTest.createVideoMgr (1 ms)
[ RUN      ] VideoMgrTest.getFBAddress
unknown file: error: SEH exception with code 0x5 thrown in the test body.
 [  FAILED  ] VideoMgrTest.getFBAddress (3 ms)
[----------] 2 tests from VideoMgrTest (8 ms total)

[----------] Global test environment tear-down
[==========] 10 tests from 4 test cases ran. (226 ms total)
[  PASSED  ] 8 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] VideoMgrTest.createVideoMgr
[  FAILED  ] VideoMgrTest.getFBAddress

我在 Google UT 中遇到了失败。我提供了如下给出的函数定义。Ita 因 SEG 异常而失败。我知道访问被拒绝,但我不知道正在访问什么

void VideoMgrTest::TearDown()
{
VideoProducerInstance::DestroyInstance();
mVideoMgr = NULL;
}

标签: unit-testinggoogletest

解决方案


运行时异常很难确定,不幸的是,您提供的代码片段不足以提供任何帮助。

如果您使用 Visual Studio 来运行您的单元测试(例如使用google 测试适配器插件),请记住您可以调试这些测试并且您可以启用运行时执行的捕获(默认情况下不会捕获它们)。在这里给出的类似问题的答案可能对您有所帮助。

无论如何,如果我不得不猜测,我怀疑空指针的访问是你麻烦的根源。


推荐阅读