memgraph/tests/unit/signal_handler.cpp

24 lines
543 B
C++

#include "gtest/gtest.h"
#include <iostream>
#include <string>
#include <utility>
#include "utils/signals/handler.hpp"
#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);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}