diff --git a/CMakeLists.txt b/CMakeLists.txt index a4be0d1..d6a8eca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,8 +146,8 @@ endif( Scarab_BOOST_COMPONENTS ) #message( STATUS "Boost components: ${Scarab_BOOST_COMPONENTS}" ) -# Boost (1.46 required for filesystem version 3) -find_package( Boost 1.46.0 REQUIRED COMPONENTS ${Scarab_BOOST_COMPONENTS} ) +# Boost (>=1.70 required for consistent provision of BoostConfig.cmake) +find_package( Boost 1.70.0 REQUIRED COMPONENTS ${Scarab_BOOST_COMPONENTS} ) # make sure dynamic linking is assumed for all boost libraries set( Boost_USE_STATIC_LIBS OFF ) set( Boost_USE_STATIC_RUNTIME OFF ) diff --git a/ScarabConfig.cmake.in b/ScarabConfig.cmake.in index 1bd1d3f..b30f1fc 100644 --- a/ScarabConfig.cmake.in +++ b/ScarabConfig.cmake.in @@ -7,7 +7,7 @@ get_filename_component( Scarab_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) # Find the dependencies include( CMakeFindDependencyMacro ) find_dependency( Boost 1.46 REQUIRED COMPONENTS @Scarab_BOOST_COMPONENTS@ ) -find_dependency( spdlog REQUIRED) +find_dependency( spdlog REQUIRED HINTS @spdlog_BINARY_DIR@ ) if( @Scarab_BUILD_CODEC_JSON@ ) #Scarab_BUILD_CODEC_JSON find_dependency( RapidJSON REQUIRED ) if(NOT TARGET rapidjson) diff --git a/VERSION b/VERSION index e891c9b..081fb66 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3 14 0 +3 14 1 diff --git a/changelog.md b/changelog.md index 3479499..7db8c6e 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,18 @@ Types of changes: Added, Changed, Deprecated, Removed, Fixed, Security ## [Unreleased] +## [3.14.1] - 2026-01-23 + +### Added + +- Python cancelation tests + +### Fixed + +- Give hint to find spdlog during build in the cmake config file +- Set CMake policy 167 to NEW + + ## [3.14.0] - 2026-01-19 ### Changed diff --git a/cmake/PackageBuilder.cmake b/cmake/PackageBuilder.cmake index a15cfaa..905aca2 100644 --- a/cmake/PackageBuilder.cmake +++ b/cmake/PackageBuilder.cmake @@ -13,6 +13,9 @@ cmake_policy( SET CMP0012 NEW ) # how if-statements work cmake_policy( SET CMP0042 NEW ) # rpath on mac os x cmake_policy( SET CMP0048 NEW ) # version in project() cmake_policy( SET CMP0115 NEW ) # source file extensions must be explicit +if( POLICY CMP0167 ) + cmake_policy( SET CMP0167 NEW ) # find_package(boost) uses config method only +endif() include ( PackageBuilderMacros ) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index a1544c6..d1b96be 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -48,6 +48,14 @@ if( Scarab_BUILD_PYTHON ) ) endif( Scarab_BUILD_AUTHENTICATION ) + if( Scarab_ENABLE_TESTING ) + add_definitions( -DBUILD_TESTING_PYBINDING ) + set( PYBINDING_HEADERFILES + ${PYBINDING_HEADERFILES} + ${dir}/testing_pybind.hh + ) + endif() + set( PYBINDING_PROJECT_LIBRARIES Scarab ) diff --git a/python/scarab_namespace_pybind.cc b/python/scarab_namespace_pybind.cc index 6056da2..8211fe2 100644 --- a/python/scarab_namespace_pybind.cc +++ b/python/scarab_namespace_pybind.cc @@ -27,6 +27,10 @@ #include "authentication_pybind.hh" #endif +#ifdef BUILD_TESTING_PYBINDING +#include "testing_pybind.hh" +#endif + PYBIND11_MODULE( scarab, scarab_mod ) { std::list< std::string > all_members; @@ -52,6 +56,10 @@ PYBIND11_MODULE( scarab, scarab_mod ) #ifdef BUILD_AUTH_PYBINDING // authentication all_members.splice( all_members.end(), scarab_pybind::export_authentication( scarab_mod ) ); +#endif +#ifdef BUILD_TESTING_PYBINDING + // testing + all_members.splice( all_members.end(), scarab_pybind::export_testing( scarab_mod ) ); #endif scarab_mod.attr( "__all__" ) = all_members; } diff --git a/python/testing_pybind.hh b/python/testing_pybind.hh new file mode 100644 index 0000000..3178896 --- /dev/null +++ b/python/testing_pybind.hh @@ -0,0 +1,88 @@ +#ifndef TESTING_PYBIND_HH_ +#define TESTING_PYBIND_HH_ + +#include "cancelable.hh" + +#include "pybind11/pybind11.h" + +namespace scarab_pybind +{ + class derived_cancelable : public scarab::cancelable + { + public: + derived_cancelable() : + scarab::cancelable() + {} + virtual ~derived_cancelable() {} + }; + + class second_derived_cancelable : public derived_cancelable + { + public: + second_derived_cancelable() : + derived_cancelable() + {} + virtual ~second_derived_cancelable() {} + }; + + class unbound_cancelable : public scarab::cancelable + { + public: + unbound_cancelable() : + scarab::cancelable() + {} + virtual ~unbound_cancelable() {} + }; + + class derived_unbound : public unbound_cancelable + { + public: + derived_unbound() : + unbound_cancelable() + {} + virtual ~derived_unbound() {} + }; + + class derived_shared : public scarab::cancelable + { + public: + derived_shared() : + scarab::cancelable() + {} + virtual ~derived_shared() {} + }; + + std::list< std::string > export_testing( pybind11::module& mod ) + { + std::list< std::string > all_items; + + all_items.push_back( "DerivedCancelable" ); + pybind11::classh< derived_cancelable, scarab::cancelable >( mod, "DerivedCancelable", "Class that derives from scarab::cancelable in the C++" ) + .def( pybind11::init<>() ) + + ; + + all_items.push_back( "SecondDerivedCancelable" ); + pybind11::classh< second_derived_cancelable, derived_cancelable, scarab::cancelable >( mod, "SecondDerivedCancelable", "Class that derives from scarab::cancelable in the C++" ) + .def( pybind11::init<>() ) + + ; + + all_items.push_back( "DerivedUnbound" ); + pybind11::classh< derived_unbound, scarab::cancelable >( mod, "DerivedUnbound", "Class that derives from scarab::cancelable in the C++" ) + .def( pybind11::init<>() ) + + ; + + all_items.push_back( "DerivedShared" ); + pybind11::classh< derived_shared, scarab::cancelable >( mod, "DerivedShared", "Class that derives from scarab::cancelable in the C++" ) + .def( pybind11::init<>() ) + + ; + + return all_items; + } + +} /* namespace scarab_pybind */ + +#endif /* TESTING_PYBIND_HH_ */ diff --git a/testing/python/test_cancelation.py b/testing/python/test_cancelation.py index da7f957..4a7f63e 100644 --- a/testing/python/test_cancelation.py +++ b/testing/python/test_cancelation.py @@ -6,6 +6,7 @@ def __init__(self): scarab.Cancelable.__init__(self) def test_cancel(): + print("Test flag: A") test = Tester() assert not test.is_canceled() test.cancel(0) diff --git a/testing/python/test_signal_handler.py b/testing/python/test_signal_handler.py index 8840d87..ad1a5a2 100644 --- a/testing/python/test_signal_handler.py +++ b/testing/python/test_signal_handler.py @@ -5,15 +5,53 @@ class Tester(scarab.Cancelable): def __init__(self): scarab.Cancelable.__init__(self) +class TesterDerived(Tester): + __test__ = False + def __init__(self): + Tester.__init__(self) + def test_cancelation(): + print("Test iteration C") + + cancel = scarab.Cancelable() + assert not cancel.is_canceled() + + cancel_derived = scarab.DerivedCancelable() + assert not cancel_derived.is_canceled() + + second_cancel_derived = scarab.SecondDerivedCancelable() + assert not second_cancel_derived.is_canceled() + + derived_unbound = scarab.DerivedUnbound() + assert not derived_unbound.is_canceled() + + shared_derived = scarab.DerivedShared() + assert not shared_derived.is_canceled() + test = Tester() assert not test.is_canceled() + test_derived = TesterDerived() + assert not test_derived.is_canceled() + sig_handler = scarab.SignalHandler(True) + sig_handler.add_cancelable(cancel) + sig_handler.add_cancelable(cancel_derived) + sig_handler.add_cancelable(second_cancel_derived) + sig_handler.add_cancelable(derived_unbound) + sig_handler.add_cancelable(shared_derived) sig_handler.add_cancelable(test) + sig_handler.add_cancelable(test_derived) sig_handler.cancel_all(0) + + assert cancel.is_canceled() + assert cancel_derived.is_canceled() + assert second_cancel_derived.is_canceled() + assert derived_unbound.is_canceled() + assert shared_derived.is_canceled() assert test.is_canceled() + assert test_derived.is_canceled() # automated join of waiting thread upon SignalHandler destruction