libs
libuavcan
libuavcan
test
test_main.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3
*/
4
5
#include <gtest/gtest.h>
6
#include <
uavcan/build_config.hpp
>
7
#include <cstdio>
8
#include <cstdlib>
9
#include <execinfo.h>
10
#include <signal.h>
11
#include <unistd.h>
12
13
static
void
sigsegv_handler
(
int
sig)
14
{
15
const
int
BacktraceSize = 32;
16
void
* array[BacktraceSize];
17
const
int
size = backtrace(array, BacktraceSize);
18
19
std::fprintf(
stderr
,
"SIGNAL %d RECEIVED; STACKTRACE:\n"
, sig);
20
backtrace_symbols_fd(array, size, STDERR_FILENO);
21
std::exit(1);
22
}
23
24
int
main
(
int
argc,
char
**argv)
25
{
26
signal(SIGSEGV,
sigsegv_handler
);
27
28
#ifndef UAVCAN_CPP_VERSION
29
# error UAVCAN_CPP_VERSION
30
#endif
31
#if UAVCAN_CPP_VERSION == UAVCAN_CPP17
32
std::cout <<
"C++17"
<< std::endl;
33
#elif UAVCAN_CPP_VERSION == UAVCAN_CPP14
34
std::cout <<
"C++14"
<< std::endl;
35
#elif UAVCAN_CPP_VERSION == UAVCAN_CPP11
36
std::cout <<
"C++11"
<< std::endl;
37
#elif UAVCAN_CPP_VERSION == UAVCAN_CPP03
38
std::cout <<
"C++03"
<< std::endl;
39
#else
40
std::cout <<
"(unknown)"
<< std::endl;
41
#endif
42
43
::testing::InitGoogleTest(&argc, argv);
44
return
RUN_ALL_TESTS();
45
}
main
int main(int argc, char **argv)
Definition:
test_main.cpp:24
test.stderr
stderr
Definition:
dsdl/test.py:6
sigsegv_handler
static void sigsegv_handler(int sig)
Definition:
test_main.cpp:13
build_config.hpp
uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:03