Skip to content
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion ScarabConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3 14 0
3 14 1
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions cmake/PackageBuilder.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down
8 changes: 8 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down
8 changes: 8 additions & 0 deletions python/scarab_namespace_pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
88 changes: 88 additions & 0 deletions python/testing_pybind.hh
Original file line number Diff line number Diff line change
@@ -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_ */
1 change: 1 addition & 0 deletions testing/python/test_cancelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
38 changes: 38 additions & 0 deletions testing/python/test_signal_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down