-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackward-stacktrace.h
More file actions
26 lines (22 loc) · 964 Bytes
/
backward-stacktrace.h
File metadata and controls
26 lines (22 loc) · 964 Bytes
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
#pragma once
#include "backward.hpp"
#include "gtest/gtest.h"
namespace backward_stacktrace {
// Do set-up and tear-down at the test program level.
// When RUN_ALL_TESTS() is called, it first calls the
// SetUp() method of the environment object, then runs
// the tests if there was no fatal failures, and finally
// calls TearDown() of the environment object. If there
// was any failure - a simple helper class
// `backward::SignalHandling` will register this for us
// and print out consistent stacktrace.
// (check_line_length skip)
// https://github.com/YOU-i-Labs/googletest/blob/master/googletest/docs/V1_7_AdvancedGuide.md#global-set-up-and-tear-down
class BackwardStackTrace : public ::testing::Environment {
private:
// A simple helper class that registers for you the most
// common signals and other callbacks to segfault,
// hardware exception, un-handled exception etc.
backward::SignalHandling sh;
};
} // namespace backward_stacktrace