为什么Google Test不打印堆栈跟踪或文件名? [英] Why does Google Test not print a stack trace or file name?

查看:159
本文介绍了为什么Google Test不打印堆栈跟踪或文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Google Test和Google Mock并将诊断级别设置为信息"时,会收到如下消息:

When I use Google Test and Google Mock, with diagnostic level set to "info", I get messages like this:

Uninteresting mock function call - taking default action specified at:
src/pkgtest/test_Foo.cpp:216:
    Function call: GetBar()
          Returns: 4-byte object <00-00 00-00>
Stack trace:

Uninteresting mock function call - taking default action specified at:
src/pkgtest/test_Foo.cpp:126:
    Function call: GetBaz()
          Returns: {}
Stack trace:
unknown file: Failure
C++ exception with description "Uninteresting mock function call - returning default value.
    Function call: CreateGrille(@0x7fff6a557050 { 16-byte object <80-D8 BB-01 00-00 00-00 70-D8 BB-01 00-00 00-00> })
    The mock function has no default action set, and its return type has no default value set." thrown in the test body.

我在互联网上找不到有关Google Test/Mock无法打印堆栈跟踪或声称未知文件"的原因的任何信息.我需要怎么做才能教它如何正确转储堆栈跟踪?

I cannot find anything on the internet about why Google Test/Mock won't print a stack trace, or claims "unknown file". What do I need to do to teach it how to properly dump a stack trace?

(如果有区别,我正在Linux上使用g ++ 4.9.)

(I'm on Linux using g++ 4.9, if that makes a difference.)

推荐答案

根据塞缪尔·本扎肯(Samuel Benzaquen):

According to Samuel Benzaquen:

gTest不包括堆栈展开器.您必须提供自己的. 您可以在include/gtest/internal/custom/gtest.h中通过定义 GTEST_OS_STACK_TRACE_GETTER_宏以指向 OsStackTraceGetterInterface.

gTest doesn't include a stack unwinder. You have to provide your own. You can do this in include/gtest/internal/custom/gtest.h by defining the GTEST_OS_STACK_TRACE_GETTER_ macro to point an implementation of OsStackTraceGetterInterface.

https://groups.google.com/d/msg/googletestframework/WMJuxAE7y-A/3FjexkRpEQAJ

这篇关于为什么Google Test不打印堆栈跟踪或文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆