diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 4e69e57a..f6fba27b 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: include: -# - { os: ubuntu-24.04, compiler: clang-18 } + - { os: ubuntu-24.04, compiler: clang-18 } - { os: ubuntu-24.04, compiler: gcc-14 } # - { os: macos-13, compiler: clang-14 } # - { os: macos-14, compiler: armv8-clang-14 } @@ -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=missing -s build_type=Debug + run: conan install . --output-folder=build --build=never - name: cache uses: actions/cache@v4 @@ -68,7 +68,7 @@ jobs: cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=install -DODR_TEST=ON @@ -79,15 +79,15 @@ jobs: cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DODR_TEST=ON - name: build - run: cmake --build build --config Debug + run: cmake --build build --config Release - name: install - run: cmake --build build --target install --config Debug + run: cmake --build build --target install --config Release - name: upload binaries to github uses: actions/upload-artifact@v4 @@ -96,7 +96,7 @@ jobs: path: | install build/test/odr_test - build/test/Debug/odr_test.exe + build/test/Release/odr_test.exe docker: if: false @@ -163,7 +163,7 @@ jobs: fail-fast: false matrix: include: -# - { os: ubuntu-24.04, compiler: clang-18 } + - { os: ubuntu-24.04, compiler: clang-18 } - { os: ubuntu-24.04, compiler: gcc-14 } # - { os: macos-13, compiler: clang-14 } # - { os: macos-14, compiler: armv8-clang-14 } @@ -208,11 +208,11 @@ jobs: - name: fix artifact permissions if: runner.os == 'Windows' - run: chmod +x build/test/Debug/odr_test.exe + run: chmod +x build/test/Release/odr_test.exe - name: test if: runner.os == 'Windows' working-directory: build/test - run: ./Debug/odr_test.exe + run: ./Release/odr_test.exe - name: tidy public test outputs run: python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output diff --git a/CMakeLists.txt b/CMakeLists.txt index 18411767..1288f7d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(odr LANGUAGES C CXX) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/test/src/pdf2htmlEX_wrapper_test.cpp b/test/src/pdf2htmlEX_wrapper_test.cpp index 40a1d032..a8bd701a 100644 --- a/test/src/pdf2htmlEX_wrapper_test.cpp +++ b/test/src/pdf2htmlEX_wrapper_test.cpp @@ -1,7 +1,7 @@ -#include #include #include #include +#include #include #include @@ -20,17 +20,6 @@ namespace fs = std::filesystem; using pdf2htmlEXWrapperTests = ::testing::TestWithParam; -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); @@ -62,6 +51,7 @@ TEST_P(pdf2htmlEXWrapperTests, html) { std::cout << "Calling pdf2htmlEX_wrapper" << std::endl << std::flush; try { + std::this_thread::set_capture_stacktraces_at_throw(true); Html html = odr::internal::html::pdf2htmlEX_wrapper( test_file.path, output_path, config, password); std::cout << "Returned from pdf2htmlEX_wrapper" << std::endl << std::flush; @@ -69,21 +59,11 @@ TEST_P(pdf2htmlEXWrapperTests, html) { EXPECT_TRUE(fs::is_regular_file(html_page.path)); EXPECT_LT(0, fs::file_size(html_page.path)); } - } catch (const std::exception &e) { - std::cerr << "Exception in pdf2htmlEX_wrapper: " << std::endl - << e.what() << std::endl - << std::flush; - print_backtrace(); - throw e; - } catch (const std::string &e) { - std::cerr << "Exception in pdf2htmlEX_wrapper: " << std::endl - << e << std::endl - << std::flush; - print_backtrace(); - throw e; } catch (...) { - std::cerr << "Exception in pdf2htmlEX_wrapper!" << std::endl << std::flush; - print_backtrace(); + std::stacktrace trace = std::stacktrace::from_current_exception(); + std::cerr << "Exception in pdf2htmlEX_wrapper!" << std::endl; + std::cerr << trace << std::endl << std::flush; + throw std::runtime_error("Unexpected error"); } std::cerr << "End of test" << std::endl << std::flush;