memgraph/tests/unit/signal_handler.cpp

24 lines
543 B
C++
Raw Normal View History

2016-12-23 02:28:21 +08:00
#include "gtest/gtest.h"
#include <iostream>
#include <string>
#include <utility>
#include "utils/signals/handler.hpp"
2016-12-20 01:32:44 +08:00
#include "utils/stacktrace/stacktrace.hpp"
TEST(SignalHandler, SegmentationFaultTest) {
SignalHandler::register_handler(Signal::SegmentationFault, []() {
std::cout << "Segmentation Fault" << std::endl;
Stacktrace stacktrace;
std::cout << stacktrace.dump() << std::endl;
});
std::raise(SIGSEGV);
}
2016-12-23 02:28:21 +08:00
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
2016-12-23 02:28:21 +08:00
}