2016-12-16 20:56:36 +08:00
|
|
|
#define CATCH_CONFIG_MAIN
|
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "utils/signals/handler.hpp"
|
2016-12-20 01:32:44 +08:00
|
|
|
#include "utils/stacktrace/stacktrace.hpp"
|
2016-12-16 20:56:36 +08:00
|
|
|
|
2016-12-20 01:32:44 +08:00
|
|
|
TEST_CASE("SignalHandler Segmentation Fault Test")
|
|
|
|
{
|
|
|
|
SignalHandler::register_handler(Signal::SegmentationFault, []() {
|
|
|
|
std::cout << "Segmentation Fault" << std::endl;
|
|
|
|
Stacktrace stacktrace;
|
|
|
|
std::cout << stacktrace.dump() << std::endl;
|
|
|
|
});
|
2016-12-16 20:56:36 +08:00
|
|
|
|
2016-12-20 01:32:44 +08:00
|
|
|
std::raise(SIGSEGV);
|
2016-12-16 20:56:36 +08:00
|
|
|
}
|