Project
Loading...
Searching...
No Matches
test_RuntimeError.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <catch_amalgamated.hpp>
15#include <unistd.h>
16#include <execinfo.h>
17
18TEST_CASE("TestRuntimeError")
19{
20 try {
24 REQUIRE(strncmp(err.what, "foo", 3) == 0);
25#ifdef DPL_ENABLE_BACKTRACE
26 backtrace_symbols_fd(err.backtrace, err.maxBacktrace, STDERR_FILENO);
27#endif
28 }
29
30 try {
31 throw o2::framework::runtime_error_f("foo %d", 1);
34 REQUIRE(strncmp(err.what, "foo", 3) == 0);
35#ifdef DPL_ENABLE_BACKTRACE
36 backtrace_symbols_fd(err.backtrace, err.maxBacktrace, STDERR_FILENO);
37 o2::framework::BacktraceHelpers::demangled_backtrace_symbols(err.backtrace, err.maxBacktrace, STDERR_FILENO);
38#endif
39 }
40}
RuntimeErrorRef runtime_error(const char *)
RuntimeError & error_from_ref(RuntimeErrorRef)
RuntimeErrorRef runtime_error_f(const char *,...)
static void demangled_backtrace_symbols(void **backtrace, unsigned int total, int fd)
TEST_CASE("TestRuntimeError")