Unverified Commit bbb8db04 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #1492

Use the new project structure for caf_core
parents 52fdb196 e94bfd34
...@@ -67,162 +67,159 @@ caf_add_component( ...@@ -67,162 +67,159 @@ caf_add_component(
HEADERS HEADERS
${CAF_CORE_HEADERS} ${CAF_CORE_HEADERS}
SOURCES SOURCES
src/abstract_actor.cpp caf/abstract_actor.cpp
src/abstract_channel.cpp caf/abstract_channel.cpp
src/abstract_group.cpp caf/abstract_group.cpp
src/action.cpp caf/action.cpp
src/actor.cpp caf/actor.cpp
src/actor_addr.cpp caf/actor_addr.cpp
src/actor_clock.cpp caf/actor_clock.cpp
src/actor_companion.cpp caf/actor_companion.cpp
src/actor_config.cpp caf/actor_config.cpp
src/actor_control_block.cpp caf/actor_control_block.cpp
src/actor_ostream.cpp caf/actor_ostream.cpp
src/actor_pool.cpp caf/actor_pool.cpp
src/actor_profiler.cpp caf/actor_profiler.cpp
src/actor_proxy.cpp caf/actor_proxy.cpp
src/actor_registry.cpp caf/actor_registry.cpp
src/actor_system.cpp caf/actor_system.cpp
src/actor_system_config.cpp caf/actor_system_config.cpp
src/async/batch.cpp caf/async/batch.cpp
src/async/consumer.cpp caf/async/consumer.cpp
src/async/execution_context.cpp caf/async/execution_context.cpp
src/async/producer.cpp caf/async/producer.cpp
src/attachable.cpp caf/attachable.cpp
src/behavior.cpp caf/behavior.cpp
src/binary_deserializer.cpp caf/binary_deserializer.cpp
src/binary_serializer.cpp caf/binary_serializer.cpp
src/blocking_actor.cpp caf/blocking_actor.cpp
src/chrono.cpp caf/chrono.cpp
src/config_option.cpp caf/config_option.cpp
src/config_option_adder.cpp caf/config_option_adder.cpp
src/config_option_set.cpp caf/config_option_set.cpp
src/config_value.cpp caf/config_value.cpp
src/config_value_reader.cpp caf/config_value_reader.cpp
src/config_value_writer.cpp caf/config_value_writer.cpp
src/decorator/sequencer.cpp caf/decorator/sequencer.cpp
src/default_attachable.cpp caf/default_attachable.cpp
src/deserializer.cpp caf/deserializer.cpp
src/detail/abstract_worker.cpp caf/detail/abstract_worker.cpp
src/detail/abstract_worker_hub.cpp caf/detail/abstract_worker_hub.cpp
src/detail/atomic_ref_counted.cpp caf/detail/atomic_ref_counted.cpp
src/detail/base64.cpp caf/detail/base64.cpp
src/detail/behavior_impl.cpp caf/detail/behavior_impl.cpp
src/detail/behavior_stack.cpp caf/detail/behavior_stack.cpp
src/detail/blocking_behavior.cpp caf/detail/blocking_behavior.cpp
src/detail/config_consumer.cpp caf/detail/config_consumer.cpp
src/detail/get_mac_addresses.cpp caf/detail/get_mac_addresses.cpp
src/detail/get_process_id.cpp caf/detail/get_process_id.cpp
src/detail/get_root_uuid.cpp caf/detail/get_root_uuid.cpp
src/detail/glob_match.cpp caf/detail/glob_match.cpp
src/detail/group_tunnel.cpp caf/detail/group_tunnel.cpp
src/detail/invoke_result_visitor.cpp caf/detail/invoke_result_visitor.cpp
src/detail/json.cpp caf/detail/json.cpp
src/detail/latch.cpp caf/detail/latch.cpp
src/detail/local_group_module.cpp caf/detail/local_group_module.cpp
src/detail/message_builder_element.cpp caf/detail/message_builder_element.cpp
src/detail/message_data.cpp caf/detail/message_data.cpp
src/detail/meta_object.cpp caf/detail/meta_object.cpp
src/detail/monotonic_buffer_resource.cpp caf/detail/monotonic_buffer_resource.cpp
src/detail/parse.cpp caf/detail/parse.cpp
src/detail/parser/chars.cpp caf/detail/parser/chars.cpp
src/detail/plain_ref_counted.cpp caf/detail/plain_ref_counted.cpp
src/detail/pretty_type_name.cpp caf/detail/pretty_type_name.cpp
src/detail/print.cpp caf/detail/print.cpp
src/detail/private_thread.cpp caf/detail/private_thread.cpp
src/detail/private_thread_pool.cpp caf/detail/private_thread_pool.cpp
src/detail/rfc3629.cpp caf/detail/rfc3629.cpp
src/detail/ripemd_160.cpp caf/detail/rfc3629.test.cpp
src/detail/set_thread_name.cpp caf/detail/ripemd_160.cpp
src/detail/stream_bridge.cpp caf/detail/set_thread_name.cpp
src/detail/stringification_inspector.cpp caf/detail/stream_bridge.cpp
src/detail/sync_request_bouncer.cpp caf/detail/stringification_inspector.cpp
src/detail/test_actor_clock.cpp caf/detail/sync_request_bouncer.cpp
src/detail/thread_safe_actor_clock.cpp caf/detail/test_actor_clock.cpp
src/detail/type_id_list_builder.cpp caf/detail/thread_safe_actor_clock.cpp
src/disposable.cpp caf/detail/type_id_list_builder.cpp
src/error.cpp caf/disposable.cpp
src/event_based_actor.cpp caf/error.cpp
src/execution_unit.cpp caf/event_based_actor.cpp
src/flow/coordinated.cpp caf/execution_unit.cpp
src/flow/coordinator.cpp caf/flow/coordinated.cpp
src/flow/observable_builder.cpp caf/flow/coordinator.cpp
src/flow/op/interval.cpp caf/flow/observable_builder.cpp
src/flow/scoped_coordinator.cpp caf/flow/op/interval.cpp
src/flow/subscription.cpp caf/flow/scoped_coordinator.cpp
src/forwarding_actor_proxy.cpp caf/flow/subscription.cpp
src/group.cpp caf/forwarding_actor_proxy.cpp
src/group_manager.cpp caf/group.cpp
src/group_module.cpp caf/group_manager.cpp
src/hash/sha1.cpp caf/group_module.cpp
src/init_global_meta_objects.cpp caf/hash/fnv.test.cpp
src/ipv4_address.cpp caf/hash/sha1.cpp
src/ipv4_endpoint.cpp caf/init_global_meta_objects.cpp
src/ipv4_subnet.cpp caf/ipv4_address.cpp
src/ipv6_address.cpp caf/ipv4_endpoint.cpp
src/ipv6_endpoint.cpp caf/ipv4_subnet.cpp
src/ipv6_subnet.cpp caf/ipv6_address.cpp
src/json_array.cpp caf/ipv6_endpoint.cpp
src/json_builder.cpp caf/ipv6_subnet.cpp
src/json_object.cpp caf/json_array.cpp
src/json_reader.cpp caf/json_builder.cpp
src/json_value.cpp caf/json_object.cpp
src/json_writer.cpp caf/json_reader.cpp
src/load_inspector.cpp caf/json_value.cpp
src/local_actor.cpp caf/json_writer.cpp
src/logger.cpp caf/load_inspector.cpp
src/mailbox_element.cpp caf/local_actor.cpp
src/make_config_option.cpp caf/logger.cpp
src/message.cpp caf/mailbox_element.cpp
src/message_builder.cpp caf/make_config_option.cpp
src/message_handler.cpp caf/message.cpp
src/monitorable_actor.cpp caf/message_builder.cpp
src/node_id.cpp caf/message_handler.cpp
src/policy/unprofiled.cpp caf/monitorable_actor.cpp
src/policy/work_sharing.cpp caf/node_id.cpp
src/policy/work_stealing.cpp caf/policy/unprofiled.cpp
src/proxy_registry.cpp caf/policy/work_sharing.cpp
src/raise_error.cpp caf/policy/work_stealing.cpp
src/ref_counted.cpp caf/proxy_registry.cpp
src/replies_to.cpp caf/raise_error.cpp
src/response_promise.cpp caf/ref_counted.cpp
src/resumable.cpp caf/replies_to.cpp
src/save_inspector.cpp caf/response_promise.cpp
src/scheduled_actor.cpp caf/resumable.cpp
src/scheduler/abstract_coordinator.cpp caf/save_inspector.cpp
src/scheduler/test_coordinator.cpp caf/scheduled_actor.cpp
src/scoped_actor.cpp caf/scheduler/abstract_coordinator.cpp
src/scoped_execution_unit.cpp caf/scheduler/test_coordinator.cpp
src/serializer.cpp caf/scoped_actor.cpp
src/settings.cpp caf/scoped_execution_unit.cpp
src/skip.cpp caf/serializer.cpp
src/stream.cpp caf/settings.cpp
src/string_algorithms.cpp caf/skip.cpp
src/string_view.cpp caf/stream.cpp
src/telemetry/collector/prometheus.cpp caf/string_algorithms.cpp
src/telemetry/importer/process.cpp caf/string_view.cpp
src/telemetry/label.cpp caf/telemetry/collector/prometheus.cpp
src/telemetry/label_view.cpp caf/telemetry/importer/process.cpp
src/telemetry/metric.cpp caf/telemetry/label.cpp
src/telemetry/metric_family.cpp caf/telemetry/label_view.cpp
src/telemetry/metric_registry.cpp caf/telemetry/metric.cpp
src/term.cpp caf/telemetry/metric_family.cpp
src/thread_hook.cpp caf/telemetry/metric_registry.cpp
src/timestamp.cpp caf/term.cpp
src/tracing_data.cpp caf/thread_hook.cpp
src/tracing_data_factory.cpp caf/timestamp.cpp
src/type_id.cpp caf/tracing_data.cpp
src/type_id_list.cpp caf/tracing_data_factory.cpp
src/uri.cpp caf/type_id.cpp
src/uri_builder.cpp caf/type_id_list.cpp
src/uuid.cpp caf/uri.cpp
TEST_SOURCES caf/uri_builder.cpp
test/core-test.cpp caf/uuid.cpp
TEST_SUITES
detail.rfc3629
hash.fnv
LEGACY_TEST_SOURCES LEGACY_TEST_SOURCES
test/core-legacy-test.cpp test/core-test.cpp
test/nasty.cpp test/nasty.cpp
LEGACY_TEST_SUITES LEGACY_TEST_SUITES
action action
...@@ -390,7 +387,7 @@ caf_add_component( ...@@ -390,7 +387,7 @@ caf_add_component(
uuid) uuid)
if(NOT CAF_USE_STD_FORMAT) if(NOT CAF_USE_STD_FORMAT)
target_sources(libcaf_core_obj PRIVATE src/detail/format.cpp) target_sources(libcaf_core_obj PRIVATE caf/detail/format.cpp)
endif() endif()
if(CAF_ENABLE_TESTING AND CAF_ENABLE_EXCEPTIONS) if(CAF_ENABLE_TESTING AND CAF_ENABLE_EXCEPTIONS)
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "caf/detail/rfc3629.hpp" #include "caf/detail/rfc3629.hpp"
#include "caf/test/caf_test_main.hpp"
#include "caf/test/test.hpp" #include "caf/test/test.hpp"
using namespace caf; using namespace caf;
...@@ -11,8 +12,6 @@ using detail::rfc3629; ...@@ -11,8 +12,6 @@ using detail::rfc3629;
using res_t = std::pair<size_t, bool>; using res_t = std::pair<size_t, bool>;
SUITE("detail.rfc3629") {
bool valid_utf8(const_byte_span bytes) noexcept { bool valid_utf8(const_byte_span bytes) noexcept {
return detail::rfc3629::valid(bytes); return detail::rfc3629::valid(bytes);
} }
...@@ -221,4 +220,4 @@ TEST("rfc3629::validate stops at the first invalid byte") { ...@@ -221,4 +220,4 @@ TEST("rfc3629::validate stops at the first invalid byte") {
} }
} }
} // SUITE("detail.rfc3629") CAF_TEST_MAIN()
...@@ -4,15 +4,14 @@ ...@@ -4,15 +4,14 @@
#include "caf/hash/fnv.hpp" #include "caf/hash/fnv.hpp"
#include "caf/test/caf_test_main.hpp"
#include "caf/test/test.hpp" #include "caf/test/test.hpp"
#include <string> #include <string>
using namespace std::literals; using namespace std::literals;
SUITE("hash.fnv") { TEST("hash::fnv can build hash values incrementally") {
TEST("hash::fnv can build hashe values incrementally") {
caf::hash::fnv<uint32_t> f; caf::hash::fnv<uint32_t> f;
check_eq(f.result, 0x811C9DC5u); check_eq(f.result, 0x811C9DC5u);
f.value('a'); f.value('a');
...@@ -55,4 +54,4 @@ TEST("fnv::compute can create hash values for types with inspect overloads") { ...@@ -55,4 +54,4 @@ TEST("fnv::compute can create hash values for types with inspect overloads") {
check_eq(hash_type::compute(foo{"C++ Actor Framework"}), 0x2FF91FE5u); check_eq(hash_type::compute(foo{"C++ Actor Framework"}), 0x2FF91FE5u);
} }
} // SUITE("hash.fnv") CAF_TEST_MAIN()
#define CAF_TEST_NO_MAIN
#include "caf/test/unit_test_impl.hpp"
#include "core-test.hpp"
#include <atomic>
namespace {
/// A trivial disposable with an atomic flag.
class trivial_impl : public caf::ref_counted, public caf::disposable::impl {
public:
trivial_impl() : flag_(false) {
// nop
}
void dispose() override {
flag_ = true;
}
bool disposed() const noexcept override {
return flag_.load();
}
void ref_disposable() const noexcept override {
ref();
}
void deref_disposable() const noexcept override {
deref();
}
friend void intrusive_ptr_add_ref(const trivial_impl* ptr) noexcept {
ptr->ref();
}
friend void intrusive_ptr_release(const trivial_impl* ptr) noexcept {
ptr->deref();
}
private:
std::atomic<bool> flag_;
};
} // namespace
namespace caf::flow {
std::string to_string(observer_state x) {
switch (x) {
default:
return "???";
case observer_state::idle:
return "caf::flow::observer_state::idle";
case observer_state::subscribed:
return "caf::flow::observer_state::subscribed";
case observer_state::completed:
return "caf::flow::observer_state::completed";
case observer_state::aborted:
return "caf::flow::observer_state::aborted";
}
}
bool from_string(std::string_view in, observer_state& out) {
if (in == "caf::flow::observer_state::idle") {
out = observer_state::idle;
return true;
}
if (in == "caf::flow::observer_state::subscribed") {
out = observer_state::subscribed;
return true;
}
if (in == "caf::flow::observer_state::completed") {
out = observer_state::completed;
return true;
}
if (in == "caf::flow::observer_state::aborted") {
out = observer_state::aborted;
return true;
}
return false;
}
bool from_integer(std::underlying_type_t<observer_state> in,
observer_state& out) {
auto result = static_cast<observer_state>(in);
switch (result) {
default:
return false;
case observer_state::idle:
case observer_state::subscribed:
case observer_state::completed:
case observer_state::aborted:
out = result;
return true;
}
}
disposable make_trivial_disposable() {
return disposable{make_counted<trivial_impl>()};
}
void passive_subscription_impl::request(size_t n) {
demand += n;
}
void passive_subscription_impl::dispose() {
disposed_flag = true;
}
bool passive_subscription_impl::disposed() const noexcept {
return disposed_flag;
}
} // namespace caf::flow
std::string to_string(level lvl) {
switch (lvl) {
case level::all:
return "all";
case level::trace:
return "trace";
case level::debug:
return "debug";
case level::warning:
return "warning";
case level::error:
return "error";
default:
return "???";
}
}
bool from_string(std::string_view str, level& lvl) {
auto set = [&](level value) {
lvl = value;
return true;
};
if (str == "all")
return set(level::all);
else if (str == "trace")
return set(level::trace);
else if (str == "debug")
return set(level::debug);
else if (str == "warning")
return set(level::warning);
else if (str == "error")
return set(level::error);
else
return false;
}
bool from_integer(uint8_t val, level& lvl) {
if (val < 5) {
lvl = static_cast<level>(val);
return true;
} else {
return false;
}
}
int main(int argc, char** argv) {
using namespace caf;
init_global_meta_objects<id_block::core_test>();
core::init_global_meta_objects();
return test::main(argc, argv);
}
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in #define CAF_TEST_NO_MAIN
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#include "caf/test/caf_test_main.hpp" #include "caf/test/unit_test_impl.hpp"
CAF_TEST_MAIN() #include "core-test.hpp"
#include <atomic>
namespace {
/// A trivial disposable with an atomic flag.
class trivial_impl : public caf::ref_counted, public caf::disposable::impl {
public:
trivial_impl() : flag_(false) {
// nop
}
void dispose() override {
flag_ = true;
}
bool disposed() const noexcept override {
return flag_.load();
}
void ref_disposable() const noexcept override {
ref();
}
void deref_disposable() const noexcept override {
deref();
}
friend void intrusive_ptr_add_ref(const trivial_impl* ptr) noexcept {
ptr->ref();
}
friend void intrusive_ptr_release(const trivial_impl* ptr) noexcept {
ptr->deref();
}
private:
std::atomic<bool> flag_;
};
} // namespace
namespace caf::flow {
std::string to_string(observer_state x) {
switch (x) {
default:
return "???";
case observer_state::idle:
return "caf::flow::observer_state::idle";
case observer_state::subscribed:
return "caf::flow::observer_state::subscribed";
case observer_state::completed:
return "caf::flow::observer_state::completed";
case observer_state::aborted:
return "caf::flow::observer_state::aborted";
}
}
bool from_string(std::string_view in, observer_state& out) {
if (in == "caf::flow::observer_state::idle") {
out = observer_state::idle;
return true;
}
if (in == "caf::flow::observer_state::subscribed") {
out = observer_state::subscribed;
return true;
}
if (in == "caf::flow::observer_state::completed") {
out = observer_state::completed;
return true;
}
if (in == "caf::flow::observer_state::aborted") {
out = observer_state::aborted;
return true;
}
return false;
}
bool from_integer(std::underlying_type_t<observer_state> in,
observer_state& out) {
auto result = static_cast<observer_state>(in);
switch (result) {
default:
return false;
case observer_state::idle:
case observer_state::subscribed:
case observer_state::completed:
case observer_state::aborted:
out = result;
return true;
}
}
disposable make_trivial_disposable() {
return disposable{make_counted<trivial_impl>()};
}
void passive_subscription_impl::request(size_t n) {
demand += n;
}
void passive_subscription_impl::dispose() {
disposed_flag = true;
}
bool passive_subscription_impl::disposed() const noexcept {
return disposed_flag;
}
} // namespace caf::flow
std::string to_string(level lvl) {
switch (lvl) {
case level::all:
return "all";
case level::trace:
return "trace";
case level::debug:
return "debug";
case level::warning:
return "warning";
case level::error:
return "error";
default:
return "???";
}
}
bool from_string(std::string_view str, level& lvl) {
auto set = [&](level value) {
lvl = value;
return true;
};
if (str == "all")
return set(level::all);
else if (str == "trace")
return set(level::trace);
else if (str == "debug")
return set(level::debug);
else if (str == "warning")
return set(level::warning);
else if (str == "error")
return set(level::error);
else
return false;
}
bool from_integer(uint8_t val, level& lvl) {
if (val < 5) {
lvl = static_cast<level>(val);
return true;
} else {
return false;
}
}
int main(int argc, char** argv) {
using namespace caf;
init_global_meta_objects<id_block::core_test>();
core::init_global_meta_objects();
return test::main(argc, argv);
}
...@@ -60,7 +60,7 @@ caf_add_component( ...@@ -60,7 +60,7 @@ caf_add_component(
caf/policy/tcp.cpp caf/policy/tcp.cpp
caf/policy/udp.cpp caf/policy/udp.cpp
LEGACY_TEST_SOURCES LEGACY_TEST_SOURCES
test/io-legacy-test.cpp test/io-test.cpp
LEGACY_TEST_SUITES LEGACY_TEST_SUITES
detail.prometheus_broker detail.prometheus_broker
io.basp.message_queue io.basp.message_queue
......
#define CAF_TEST_NO_MAIN
#include "caf/test/unit_test_impl.hpp"
#include "io-test.hpp"
int main(int argc, char** argv) {
using namespace caf;
init_global_meta_objects<id_block::io_test>();
io::middleman::init_global_meta_objects();
core::init_global_meta_objects();
return test::main(argc, argv);
}
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in #define CAF_TEST_NO_MAIN
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#include "caf/io/middleman.hpp" #include "caf/test/unit_test_impl.hpp"
#include "caf/test/caf_test_main.hpp"
CAF_TEST_MAIN(caf::io::middleman) #include "io-test.hpp"
int main(int argc, char** argv) {
using namespace caf;
init_global_meta_objects<id_block::io_test>();
io::middleman::init_global_meta_objects();
core::init_global_meta_objects();
return test::main(argc, argv);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment