Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost: fixed stacktrace_windbg* components, improved stacktrace test. #7281

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions recipes/boost/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1565,10 +1565,10 @@ def filter_transform_module_libraries(names):
self.cpp_info.components["stacktrace_noop"].defines.append("BOOST_STACKTRACE_USE_NOOP")

if self.settings.os == "Windows":
self.cpp_info.components["stacktrace_windb"].defines.append("BOOST_STACKTRACE_USE_WINDBG")
self.cpp_info.components["stacktrace_windb"].system_libs.extend(["ole32", "dbgeng"])
self.cpp_info.components["stacktrace_windb_cached"].defines.append("BOOST_STACKTRACE_USE_WINDBG_CACHED")
self.cpp_info.components["stacktrace_windb_cached"].system_libs.extend(["ole32", "dbgeng"])
self.cpp_info.components["stacktrace_windbg"].defines.append("BOOST_STACKTRACE_USE_WINDBG")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

self.cpp_info.components["stacktrace_windbg"].system_libs.extend(["ole32", "dbgeng"])
self.cpp_info.components["stacktrace_windbg_cached"].defines.append("BOOST_STACKTRACE_USE_WINDBG_CACHED")
self.cpp_info.components["stacktrace_windbg_cached"].system_libs.extend(["ole32", "dbgeng"])
elif tools.is_apple_os(self.settings.os) or self.settings.os == "FreeBSD":
self.cpp_info.components["stacktrace"].defines.append("BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED")

Expand Down
74 changes: 61 additions & 13 deletions recipes/boost/all/test_package/stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,96 @@ static const char *stacktrace_impls[] = {
"windbg_cached",
};

int main() {
int res = 0;
bool check_used_defined()
{
bool success = true;
#if TEST_STACKTRACE_IMPL == TEST_STACKTRACE_ADDR2LINE
# if !defined(BOOST_STACKTRACE_USE_ADDR2LINE)
std::cerr << "testing stacktrace_addr2line but BOOST_STACKTRACE_USE_ADDR2LINE not defined\n";
success = false;
# endif
#endif
#if TEST_STACKTRACE_IMPL == TEST_STACKTRACE_BACKTRACE
# if !defined(BOOST_STACKTRACE_USE_BACKTRACE)
std::cerr << "testing stacktrace_backtrace but BOOST_STACKTRACE_USE_BACKTRACE not defined\n";
success = false;
# endif
#endif
#if TEST_STACKTRACE_IMPL == TEST_STACKTRACE_NOOP
# if !defined(BOOST_STACKTRACE_USE_NOOP)
std::cerr << "testing stacktrace_noop but BOOST_STACKTRACE_USE_NOOP not defined\n";
success = false;
# endif
#endif
#if TEST_STACKTRACE_IMPL == TEST_STACKTRACE_WINDBG
# if !defined(BOOST_STACKTRACE_USE_WINDBG)
std::cerr << "testing stacktrace_windbg but BOOST_STACKTRACE_USE_WINDBG not defined\n";
success = false;
# endif
#endif
#if TEST_STACKTRACE_IMPL == TEST_STACKTRACE_WINDBG_CACHED
# if !defined(BOOST_STACKTRACE_USE_WINDBG_CACHED)
std::cerr << "testing stacktrace_windbg_cached but BOOST_STACKTRACE_USE_WINDBG_CACHED not defined\n";
success = false;
# endif
#endif
return success;
}

#if !defined TEST_STACKTRACE_IMPL
std::cerr << "TEST_STACKTRACE_IMPL not defined!\n";
res = 1;
#else
std::cerr << "Testing stacktrace_" << stacktrace_impls[TEST_STACKTRACE_IMPL-1] << "...\n";
bool check_unused_undefined()
{
bool success = true;
# if defined(BOOST_STACKTRACE_USE_ADDR2LINE)
# if TEST_STACKTRACE_IMPL != TEST_STACKTRACE_ADDR2LINE
std::cerr << "BOOST_STACKTRACE_USE_ADDR2LINE defined but not testing stacktrace_addr2line\n";
res = 1;
success = false;
# endif
# if !defined(BOOST_STACKTRACE_ADDR2LINE_LOCATION)
std::cerr << "error: BOOST_STACKTRACE_ADDR2LINE_LOCATION not defined\n";
res = 1;
success = false;
# endif
# endif
# if defined(BOOST_STACKTRACE_USE_BACKTRACE)
# if TEST_STACKTRACE_IMPL != TEST_STACKTRACE_BACKTRACE
std::cerr << "BOOST_STACKTRACE_USE_BACKTRACE defined but not testing stacktrace_backtrace\n";
res = 1;
success = false;
# endif
# endif
# if defined(BOOST_STACKTRACE_USE_NOOP)
# if TEST_STACKTRACE_IMPL != TEST_STACKTRACE_NOOP
std::cerr << "BOOST_STACKTRACE_USE_NOOP defined but not testing stacktrace_noop\n";
res = 1;
success = false;
# endif
# endif
# if defined(BOOST_STACKTRACE_USE_WINDBG)
# if TEST_STACKTRACE_IMPL != TEST_STACKTRACE_WINDBG
std::cerr << "BOOST_STACKTRACE_USE_WINDBG defined but not testing stacktrace_windbg\n";
res = 1;
success = false;
# endif
# endif
# if defined(BOOST_STACKTRACE_USE_WINDBG_CACHED)
# if TEST_STACKTRACE_IMPL != TEST_STACKTRACE_WINDBG_CACHED
std::cerr << "BOOST_STACKTRACE_USE_WINDBG_CACHED defined but not testing stacktrace_windbg_cached\n";
res = 1;
success = false;
# endif
# endif
return success;
}

int main() {
int res = 0;

#if !defined TEST_STACKTRACE_IMPL
std::cerr << "TEST_STACKTRACE_IMPL not defined!\n";
res = 1;
#else
std::cerr << "Testing stacktrace_" << stacktrace_impls[TEST_STACKTRACE_IMPL-1] << "...\n";
if (!check_unused_undefined()) {
res = 1;
}
if (!check_used_defined()) {
res = 1;
}
#endif
f1();
return res;
Expand Down