blob: 0d29a461b000a4fc1e32f62a8394ba4c5be4cc12 (
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
|
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <library/cpp/yt/backtrace/backtrace.h>
#include <library/cpp/yt/backtrace/cursors/libunwind/libunwind_cursor.h>
namespace NYT::NBacktrace {
namespace {
////////////////////////////////////////////////////////////////////////////////
#ifdef SYMBOLIZED_BUILD
using ::testing::ContainsRegex;
std::string GetStackTrace()
{
std::array<const void*, 1> buffer;
NBacktrace::TLibunwindCursor cursor;
auto backtrace = GetBacktrace(
&cursor,
TMutableRange(buffer),
/*framesToSkip*/ 0);
return SymbolizeBacktrace(backtrace);
}
TEST(TStackTrace, Format)
{
ASSERT_THAT(
GetStackTrace(),
ContainsRegex(
"^ 1\\. 0x[0-9a-f]+ in NYT::NBacktrace::\\(anonymous namespace\\)::GetStackTrace.* "
"at .+/library/cpp/yt/backtrace/symbolizers/dwarf/unittests/backtrace_ut.cpp:[0-9]+\\n"));
}
#endif
////////////////////////////////////////////////////////////////////////////////
} // namespace
} // namespace NYT::NBacktrace
|