Skip to content

Commit

Permalink
Use cpptrace library
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Sep 2, 2024
1 parent 13781df commit 1849baa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: conan config
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
- name: conan install
run: conan install . --output-folder=build --build=never
run: conan install . --output-folder=build --build=missing

- name: cache
uses: actions/cache@v4
Expand Down
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def requirements(self):
if self.options.get_safe("with_pdf2htmlEX"):
self.requires("pdf2htmlex/0.18.8.rc1-20240814-git")
self.requires("fontconfig/2.15.0-odr")
self.requires("cpptrace/0.7.0")
if self.options.get_safe("with_wvWare"):
self.requires("wvware/1.2.9")

Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ target_link_libraries(odr_test

if(WITH_PDF2HTMLEX)
target_link_libraries(odr_test PRIVATE pdf2htmlex::pdf2htmlex)
find_package(cpptrace REQUIRED)
target_link_libraries(odr_test PRIVATE cpptrace::cpptrace)
endif(WITH_PDF2HTMLEX)
if(WITH_WVWARE)
target_link_libraries(odr_test PRIVATE wvware::wvware)
Expand Down
12 changes: 6 additions & 6 deletions test/src/pdf2htmlEX_wrapper_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <filesystem>
#include <iostream>
#include <optional>
#include <stacktrace>
#include <cpptrace/from_current.hpp>
#include <string>

#include <gtest/gtest.h>
Expand Down Expand Up @@ -50,19 +50,19 @@ TEST_P(pdf2htmlEXWrapperTests, html) {
}

std::cout << "Calling pdf2htmlEX_wrapper" << std::endl << std::flush;
try {
std::this_thread::set_capture_stacktraces_at_throw();
CPPTRACE_TRY {
Html html = odr::internal::html::pdf2htmlEX_wrapper(
test_file.path, output_path, config, password);
std::cout << "Returned from pdf2htmlEX_wrapper" << std::endl << std::flush;
for (const HtmlPage &html_page : html.pages()) {
EXPECT_TRUE(fs::is_regular_file(html_page.path));
EXPECT_LT(0, fs::file_size(html_page.path));
}
} catch (...) {
} CPPTRACE_CATCH (...) {
std::cerr << "Exception in pdf2htmlEX_wrapper!" << std::endl;
std::cerr << std::stacktrace::from_current_exception() << std::endl << std::flush;

cpptrace::from_current_exception().print();
std::cerr << std::flush;
std::cout << std::flush;
throw std::runtime_error("Unexpected error");
}
std::cerr << "End of test" << std::endl << std::flush;
Expand Down

0 comments on commit 1849baa

Please sign in to comment.