Skip to content

Commit

Permalink
Update error catcher in pdf2htmlEX Wrapper tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Sep 2, 2024
1 parent 7a67883 commit 4c6c075
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/src/pdf2htmlEX_wrapper_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ namespace fs = std::filesystem;

using pdf2htmlEXWrapperTests = ::testing::TestWithParam<std::string>;

static void print_backtrace() {
void *array[10];
int size = backtrace(array, 10);
char **symbols = backtrace_symbols(array, size);
for (int i = 0; i < size; i++) {
std::cerr << symbols[i] << std::endl;
}
free(symbols);
std::cerr << std::flush;
}

TEST_P(pdf2htmlEXWrapperTests, html) {
const std::string test_file_path = GetParam();
const TestFile test_file = TestData::test_file(test_file_path);
Expand Down Expand Up @@ -62,18 +73,12 @@ TEST_P(pdf2htmlEXWrapperTests, html) {
std::cerr << "Exception in pdf2htmlEX_wrapper: " << std::endl
<< e.what() << std::endl
<< std::flush;

void *array[10];
int size = backtrace(array, 10);
char **symbols = backtrace_symbols(array, size);
for (int i = 0; i < size; i++) {
std::cerr << symbols[i] << std::endl;
}
free(symbols);
std::cerr << std::flush;
sleep(2);

print_backtrace();
throw e;
} catch (...) {
std::cerr << "Exception in pdf2htmlEX_wrapper!" << std::endl << std::flush;
print_backtrace();
throw std::runtime_error("Unexpected error");
}
std::cerr << "End of test" << std::endl << std::flush;
}
Expand Down

0 comments on commit 4c6c075

Please sign in to comment.