blob: dc271ad5137d748d68345a6c359d8890dcb2547b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include <library/cpp/testing/gtest/gtest.h>
#include <util/system/compiler.h>
#include <util/system/backtrace.h>
#include <util/stream/str.h>
Y_FORCE_INLINE
TString InlinedFunction_866a4407b28483588033f95add111d() {
TStringStream out;
FormatBackTrace(&out);
return out.Str();
}
Y_NO_INLINE
TString Function_3e15a2d04c8613ae64833c5407dd98() {
return InlinedFunction_866a4407b28483588033f95add111d();
}
Y_NO_INLINE
TString NotInlinedFunction_3c7dbf1e3b2b71819241cb5ad2b142() {
return Function_3e15a2d04c8613ae64833c5407dd98();
}
namespace NTestNamespace {
Y_NO_INLINE
TString NamespacedFunction() {
return InlinedFunction_866a4407b28483588033f95add111d();
}
}
using namespace ::testing;
TEST(dwarf_backtrace_should, handle_inlines) {
const TString backtrace = NotInlinedFunction_3c7dbf1e3b2b71819241cb5ad2b142();
EXPECT_THAT(
backtrace,
HasSubstr("InlinedFunction_866a4407b28483588033f95add111d")
);
EXPECT_THAT(
backtrace,
HasSubstr("backtrace_ut.cpp:9:0 in InlinedFunction")
);
EXPECT_THAT(
backtrace,
HasSubstr("Function_3e15a2d04c8613ae64833c5407dd98")
);
}
TEST(dwarf_backtrace_should, handle_namespaces) {
EXPECT_THAT(
NTestNamespace::NamespacedFunction(),
HasSubstr("NTestNamespace::NamespacedFunction")
);
}
|