From 3cbaa890c50021d23d3e6fff9ea175bdc113a6ef Mon Sep 17 00:00:00 2001 From: Dominik Charousset Date: Thu, 22 Feb 2024 20:45:44 +0100 Subject: [PATCH] Use the Canonical Project Structure for Broker For the Canonical Project Structure, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1204r0.html. With the new structure, we drop the `include` and `src` sub-directories and place the source files next to the header files under `libbroker`. Further, we place the unit tests next to the source file with `.test.cc` suffix. Standalone tools have been placed alongside `libbroker` to the project root, whereas system/integration tests as well as benchmarks remain under `tests`, but are organized more consistently. --- CMakeLists.txt | 208 +-------- CONTRIBUTING.md | 3 +- broker-node/CMakeLists.txt | 7 + {src => broker-node}/broker-node.cc | 0 broker-pipe/CMakeLists.txt | 7 + {src => broker-pipe}/broker-pipe.cc | 0 broker-throughput/CMakeLists.txt | 4 + broker-throughput/README.md | 27 ++ .../broker-throughput.bro | 0 .../broker-throughput.cc | 0 .../broker-throughput.py | 0 {src => libbroker}/BrokerConfig.cmake.in | 0 libbroker/CMakeLists.txt | 217 +++++++++ {src => libbroker/broker}/address.cc | 0 {include => libbroker}/broker/address.hh | 0 {src => libbroker/broker}/alm/multipath.cc | 0 .../broker/alm/multipath.hh | 0 .../broker/alm/multipath.test.cc | 4 +- .../broker}/alm/routing_table.cc | 0 .../broker/alm/routing_table.hh | 0 .../broker/alm/routing_table.test.cc | 4 +- {include => libbroker}/broker/api_flags.hh | 0 {include => libbroker}/broker/backend.hh | 0 .../broker/backend.test.cc | 4 +- .../broker/backend_options.hh | 0 .../broker/bad_variant_access.hh | 0 {src => libbroker/broker}/broker-gateway.cc | 0 .../broker/broker-test.test.cc | 2 +- .../broker/broker-test.test.hh | 0 {include => libbroker}/broker/broker.hh | 0 {src => libbroker/broker}/builder.cc | 0 {include => libbroker}/broker/builder.hh | 0 .../broker/builder.test.cc | 4 +- {src => libbroker/broker}/command_envelope.cc | 0 .../broker/command_envelope.hh | 0 {src => libbroker/broker}/config.hh.in | 0 {src => libbroker/broker}/configuration.cc | 0 .../broker/configuration.hh | 0 {src => libbroker/broker}/convert.cc | 0 {include => libbroker}/broker/convert.hh | 0 .../core.cc => libbroker/broker/core.test.cc | 4 +- {include => libbroker}/broker/cow_tuple.hh | 0 {src => libbroker/broker}/data.cc | 0 {include => libbroker}/broker/data.hh | 0 .../data.cc => libbroker/broker/data.test.cc | 4 +- {src => libbroker/broker}/data_envelope.cc | 0 .../broker/data_envelope.hh | 0 {include => libbroker}/broker/defaults.hh | 0 .../broker}/detail/abstract_backend.cc | 0 .../broker/detail/abstract_backend.hh | 0 .../broker/detail/algorithms.hh | 0 .../broker/detail/appliers.hh | 0 .../broker/detail/assert.hh | 0 .../broker/detail/comparable.hh | 0 {include => libbroker}/broker/detail/die.hh | 0 .../broker}/detail/filesystem.cc | 0 .../broker/detail/filesystem.hh | 0 {src => libbroker/broker}/detail/flare.cc | 0 {include => libbroker}/broker/detail/flare.hh | 0 {include => libbroker}/broker/detail/hash.hh | 0 .../broker/detail/inspect_enum.hh | 0 .../broker}/detail/make_backend.cc | 0 .../broker/detail/make_backend.hh | 0 .../broker}/detail/memory_backend.cc | 0 .../broker/detail/memory_backend.hh | 0 .../detail/monotonic_buffer_resource.cc | 0 .../detail/monotonic_buffer_resource.hh | 0 .../broker/detail/native_socket.hh | 0 .../broker/detail/next_tick.hh | 0 .../broker}/detail/opaque_type.cc | 0 .../broker/detail/opaque_type.hh | 0 .../broker/detail/operators.hh | 0 .../broker/detail/overload.hh | 0 .../broker}/detail/peer_status_map.cc | 0 .../broker/detail/peer_status_map.hh | 0 .../broker/detail/peer_status_map.test.cc | 4 +- {include => libbroker}/broker/detail/pp.hh | 0 .../broker}/detail/prefix_matcher.cc | 0 .../broker/detail/prefix_matcher.hh | 0 .../broker/detail/promote.hh | 0 .../broker/detail/radix_tree.hh | 0 .../broker}/detail/sink_driver.cc | 0 .../broker/detail/sink_driver.hh | 0 .../broker}/detail/source_driver.cc | 0 .../broker/detail/source_driver.hh | 0 .../broker}/detail/sqlite_backend.cc | 0 .../broker/detail/sqlite_backend.hh | 0 .../broker}/detail/store_state.cc | 0 .../broker/detail/store_state.hh | 0 .../broker/detail/type_traits.hh | 0 {src => libbroker/broker}/domain_options.cc | 0 .../broker/domain_options.hh | 0 .../broker/domain_options.test.cc | 4 +- {src => libbroker/broker}/endpoint.cc | 0 {include => libbroker}/broker/endpoint.hh | 0 {src => libbroker/broker}/endpoint_id.cc | 0 {include => libbroker}/broker/endpoint_id.hh | 0 {src => libbroker/broker}/endpoint_info.cc | 0 .../broker/endpoint_info.hh | 0 {src => libbroker/broker}/entity_id.cc | 0 {include => libbroker}/broker/entity_id.hh | 0 {include => libbroker}/broker/enum_value.hh | 0 {src => libbroker/broker}/envelope.cc | 0 {include => libbroker}/broker/envelope.hh | 0 {src => libbroker/broker}/error.cc | 0 {include => libbroker}/broker/error.hh | 0 .../broker/error.test.cc | 4 +- {include => libbroker}/broker/expected.hh | 0 {src => libbroker/broker}/filter_type.cc | 0 {include => libbroker}/broker/filter_type.hh | 0 .../broker/filter_type.test.cc | 4 +- {src => libbroker/broker}/format/bin.cc | 0 {include => libbroker}/broker/format/bin.hh | 0 .../broker/format/bin.test.cc | 4 +- {src => libbroker/broker}/format/json.cc | 0 {include => libbroker}/broker/format/json.hh | 0 .../broker/format/json.test.cc | 4 +- {include => libbroker}/broker/format/txt.hh | 0 {include => libbroker}/broker/frontend.hh | 0 {include => libbroker}/broker/fwd.hh | 0 {src => libbroker/broker}/gateway.cc | 0 .../broker/integration.test.cc | 4 +- .../broker/internal/README.md | 0 .../broker/internal/channel.hh | 0 .../broker/internal/channel.test.cc | 4 +- .../broker}/internal/clone_actor.cc | 0 .../broker/internal/clone_actor.hh | 0 .../broker/internal/configuration_access.hh | 0 .../broker}/internal/connector.cc | 0 .../broker/internal/connector.hh | 0 .../broker}/internal/connector_adapter.cc | 0 .../broker/internal/connector_adapter.hh | 0 .../broker}/internal/core_actor.cc | 0 .../broker/internal/core_actor.hh | 0 .../broker/internal/core_actor.test.cc | 4 +- .../broker}/internal/core_recorder.cc | 0 .../broker/internal/core_recorder.hh | 0 .../broker}/internal/data_generator.cc | 0 .../broker/internal/data_generator.hh | 0 .../broker/internal/data_generator.test.cc | 4 +- .../broker/internal/endpoint_access.hh | 0 .../broker}/internal/flare_actor.cc | 0 .../broker/internal/flare_actor.hh | 0 .../broker/internal/flow_scope.hh | 0 {include => libbroker}/broker/internal/fwd.hh | 0 .../broker}/internal/generator_file_reader.cc | 0 .../broker/internal/generator_file_reader.hh | 0 .../broker}/internal/generator_file_writer.cc | 0 .../broker/internal/generator_file_writer.hh | 0 .../internal/generator_file_writer.test.cc | 4 +- {src => libbroker/broker}/internal/json.cc | 0 .../broker/internal/json.hh | 0 .../broker/internal/json.test.cc | 4 +- .../broker}/internal/json_client.cc | 0 .../broker/internal/json_client.hh | 0 .../broker}/internal/json_type_mapper.cc | 0 .../broker/internal/json_type_mapper.hh | 0 .../broker/internal/json_type_mapper.test.cc | 4 +- .../broker/internal/killswitch.hh | 0 .../broker/internal/logger.hh | 0 .../broker}/internal/master_actor.cc | 0 .../broker/internal/master_actor.hh | 0 .../broker}/internal/master_resolver.cc | 0 .../broker/internal/master_resolver.hh | 0 .../broker}/internal/meta_command_writer.cc | 0 .../broker/internal/meta_command_writer.hh | 0 .../internal/meta_command_writer.test.cc | 4 +- .../broker}/internal/meta_data_writer.cc | 0 .../broker/internal/meta_data_writer.hh | 0 .../broker/internal/meta_data_writer.test.cc | 4 +- .../broker}/internal/metric_collector.cc | 0 .../broker/internal/metric_collector.hh | 0 .../broker/internal/metric_collector.test.cc | 4 +- .../broker}/internal/metric_exporter.cc | 0 .../broker/internal/metric_exporter.hh | 0 .../broker/internal/metric_exporter.test.cc | 4 +- .../broker}/internal/metric_factory.cc | 0 .../broker/internal/metric_factory.hh | 0 .../broker}/internal/metric_scraper.cc | 0 .../broker/internal/metric_scraper.hh | 0 .../broker}/internal/metric_view.cc | 0 .../broker/internal/metric_view.hh | 0 .../broker/internal/native.hh | 0 .../broker/internal/peer_filter.hh | 0 {src => libbroker/broker}/internal/peering.cc | 0 .../broker/internal/peering.hh | 0 .../broker}/internal/pending_connection.cc | 0 .../broker/internal/pending_connection.hh | 0 {src => libbroker/broker}/internal/println.cc | 0 .../broker/internal/println.hh | 0 .../broker}/internal/prometheus.cc | 0 .../broker/internal/prometheus.hh | 0 .../broker/internal/read_value.hh | 0 .../broker/internal/retry_state.hh | 0 .../broker}/internal/store_actor.cc | 0 .../broker/internal/store_actor.hh | 0 .../broker/internal/type_id.hh | 0 .../broker}/internal/web_socket.cc | 0 .../broker/internal/web_socket.hh | 0 .../broker}/internal/wire_format.cc | 0 .../broker/internal/wire_format.hh | 0 .../broker/internal/wire_format.test.cc | 4 +- .../broker/internal/with_native_labels.hh | 0 .../broker/internal/write_value.hh | 0 {src => libbroker/broker}/internal_command.cc | 0 .../broker/internal_command.hh | 0 .../broker/intrusive_ptr.hh | 0 .../broker/lamport_timestamp.hh | 0 {src => libbroker/broker}/mailbox.cc | 0 {include => libbroker}/broker/mailbox.hh | 0 .../broker/master.test.cc | 4 +- {include => libbroker}/broker/message.hh | 0 {src => libbroker/broker}/network_info.cc | 0 {include => libbroker}/broker/network_info.hh | 0 {include => libbroker}/broker/none.hh | 0 {src => libbroker/broker}/p2p_message_type.cc | 0 .../broker/p2p_message_type.hh | 0 {include => libbroker}/broker/peer_flags.hh | 0 {include => libbroker}/broker/peer_info.hh | 0 {src => libbroker/broker}/peer_status.cc | 0 {include => libbroker}/broker/peer_status.hh | 0 .../broker/peering.test.cc | 4 +- {src => libbroker/broker}/ping_envelope.cc | 0 .../broker/ping_envelope.hh | 0 {src => libbroker/broker}/pong_envelope.cc | 0 .../broker/pong_envelope.hh | 0 {src => libbroker/broker}/port.cc | 0 {include => libbroker}/broker/port.hh | 0 {src => libbroker/broker}/publisher.cc | 0 {include => libbroker}/broker/publisher.hh | 0 .../broker/publisher.test.cc | 4 +- {include => libbroker}/broker/publisher_id.hh | 0 .../broker/radix_tree.test.cc | 4 +- .../broker}/routing_update_envelope.cc | 0 .../broker/routing_update_envelope.hh | 0 .../broker/shutdown.test.cc | 4 +- {src => libbroker/broker}/shutdown_options.cc | 0 .../broker/shutdown_options.hh | 0 {include => libbroker}/broker/snapshot.hh | 0 {include => libbroker}/broker/span.hh | 0 {src => libbroker/broker}/status.cc | 0 {include => libbroker}/broker/status.hh | 0 .../broker/status.test.cc | 4 +- .../broker}/status_subscriber.cc | 0 .../broker/status_subscriber.hh | 0 .../broker/status_subscriber.test.cc | 4 +- {src => libbroker/broker}/store.cc | 0 {include => libbroker}/broker/store.hh | 0 .../broker/store.test.cc | 4 +- {src => libbroker/broker}/store_event.cc | 0 {include => libbroker}/broker/store_event.hh | 0 .../broker/store_event.test.cc | 4 +- {src => libbroker/broker}/subnet.cc | 0 {include => libbroker}/broker/subnet.hh | 0 {src => libbroker/broker}/subscriber.cc | 0 {include => libbroker}/broker/subscriber.hh | 0 .../broker/subscriber.test.cc | 4 +- .../broker}/telemetry/counter.cc | 0 .../broker/telemetry/counter.hh | 0 .../broker/telemetry/fwd.hh | 0 {src => libbroker/broker}/telemetry/gauge.cc | 0 .../broker/telemetry/gauge.hh | 0 .../broker}/telemetry/histogram.cc | 0 .../broker/telemetry/histogram.hh | 0 .../broker/telemetry/histogram.test.cc | 4 +- .../broker}/telemetry/metric_family.cc | 0 .../broker/telemetry/metric_family.hh | 0 .../broker}/telemetry/metric_registry.cc | 0 .../broker/telemetry/metric_registry.hh | 0 .../broker}/telemetry/metric_registry_impl.cc | 0 .../broker/telemetry/metric_registry_impl.hh | 0 {src => libbroker/broker}/time.cc | 0 {include => libbroker}/broker/time.hh | 0 {include => libbroker}/broker/timeout.hh | 0 {src => libbroker/broker}/topic.cc | 0 {include => libbroker}/broker/topic.hh | 0 .../broker/topic.test.cc | 4 +- {src => libbroker/broker}/variant.cc | 0 {include => libbroker}/broker/variant.hh | 0 .../broker/variant.test.cc | 4 +- {src => libbroker/broker}/variant_data.cc | 0 {include => libbroker}/broker/variant_data.hh | 0 {src => libbroker/broker}/variant_list.cc | 0 {include => libbroker}/broker/variant_list.hh | 0 {src => libbroker/broker}/variant_set.cc | 0 {include => libbroker}/broker/variant_set.hh | 0 {src => libbroker/broker}/variant_table.cc | 0 .../broker/variant_table.hh | 0 {src => libbroker/broker}/variant_tag.cc | 0 {include => libbroker}/broker/variant_tag.hh | 0 {src => libbroker/broker}/version.cc | 0 {include => libbroker}/broker/version.hh | 0 {include => libbroker}/broker/visit.hh | 0 {src => libbroker/broker}/worker.cc | 0 {include => libbroker}/broker/worker.hh | 0 {src => libbroker/broker}/zeek.cc | 0 {include => libbroker}/broker/zeek.hh | 0 .../zeek.cc => libbroker/broker/zeek.test.cc | 4 +- tests/CMakeLists.txt | 110 +---- tests/benchmarks/CMakeLists.txt | 6 + .../cluster}/README.md | 30 -- .../cluster/cluster.cc} | 0 .../cluster/example.zip} | Bin .../cluster}/mars.dat | Bin .../fan-out/fan-out.cc} | 0 .../src => benchmarks}/main.cc | 0 .../include => benchmarks}/main.hh | 34 -- tests/benchmarks/routing-table/CMakeLists.txt | 15 + .../routing-table}/routing-table.cc | 0 tests/benchmarks/serialization/CMakeLists.txt | 15 + tests/benchmarks/serialization/generator.cc | 0 tests/benchmarks/serialization/generator.hh | 43 ++ .../serialization}/serialization.cc | 0 tests/btest/btest.cfg | 2 +- tests/cpp/ssl.cc | 126 ------ tests/cpp/system/README | 5 - tests/{cpp => data}/certs/ca.pem | 0 tests/{cpp => data}/certs/cert.1.pem | 0 tests/{cpp => data}/certs/cert.2.pem | 0 .../{cpp => data}/certs/cert.self-signed.pem | 0 tests/{cpp => data}/certs/key.1.enc.pem | 0 tests/{cpp => data}/certs/key.1.pem | 0 tests/{cpp => data}/certs/key.2.pem | 0 tests/{cpp => data}/certs/key.self-signed.pem | 0 tests/foo.txt | 1 - tests/micro-benchmark/CMakeLists.txt | 18 - tests/micro-benchmark/src/streaming.cc | 427 ------------------ 327 files changed, 406 insertions(+), 1053 deletions(-) create mode 100644 broker-node/CMakeLists.txt rename {src => broker-node}/broker-node.cc (100%) create mode 100644 broker-pipe/CMakeLists.txt rename {src => broker-pipe}/broker-pipe.cc (100%) create mode 100644 broker-throughput/CMakeLists.txt create mode 100644 broker-throughput/README.md rename tests/benchmark/broker-benchmark.bro => broker-throughput/broker-throughput.bro (100%) rename tests/benchmark/broker-benchmark.cc => broker-throughput/broker-throughput.cc (100%) rename tests/benchmark/broker-benchmark.py => broker-throughput/broker-throughput.py (100%) rename {src => libbroker}/BrokerConfig.cmake.in (100%) create mode 100644 libbroker/CMakeLists.txt rename {src => libbroker/broker}/address.cc (100%) rename {include => libbroker}/broker/address.hh (100%) rename {src => libbroker/broker}/alm/multipath.cc (100%) rename {include => libbroker}/broker/alm/multipath.hh (100%) rename tests/cpp/alm/multipath.cc => libbroker/broker/alm/multipath.test.cc (99%) rename {src => libbroker/broker}/alm/routing_table.cc (100%) rename {include => libbroker}/broker/alm/routing_table.hh (100%) rename tests/cpp/alm/routing_table.cc => libbroker/broker/alm/routing_table.test.cc (99%) rename {include => libbroker}/broker/api_flags.hh (100%) rename {include => libbroker}/broker/backend.hh (100%) rename tests/cpp/backend.cc => libbroker/broker/backend.test.cc (99%) rename {include => libbroker}/broker/backend_options.hh (100%) rename {include => libbroker}/broker/bad_variant_access.hh (100%) rename {src => libbroker/broker}/broker-gateway.cc (100%) rename tests/cpp/test.cc => libbroker/broker/broker-test.test.cc (99%) rename tests/cpp/test.hh => libbroker/broker/broker-test.test.hh (100%) rename {include => libbroker}/broker/broker.hh (100%) rename {src => libbroker/broker}/builder.cc (100%) rename {include => libbroker}/broker/builder.hh (100%) rename tests/cpp/builder.cc => libbroker/broker/builder.test.cc (99%) rename {src => libbroker/broker}/command_envelope.cc (100%) rename {include => libbroker}/broker/command_envelope.hh (100%) rename {src => libbroker/broker}/config.hh.in (100%) rename {src => libbroker/broker}/configuration.cc (100%) rename {include => libbroker}/broker/configuration.hh (100%) rename {src => libbroker/broker}/convert.cc (100%) rename {include => libbroker}/broker/convert.hh (100%) rename tests/cpp/core.cc => libbroker/broker/core.test.cc (99%) rename {include => libbroker}/broker/cow_tuple.hh (100%) rename {src => libbroker/broker}/data.cc (100%) rename {include => libbroker}/broker/data.hh (100%) rename tests/cpp/data.cc => libbroker/broker/data.test.cc (98%) rename {src => libbroker/broker}/data_envelope.cc (100%) rename {include => libbroker}/broker/data_envelope.hh (100%) rename {include => libbroker}/broker/defaults.hh (100%) rename {src => libbroker/broker}/detail/abstract_backend.cc (100%) rename {include => libbroker}/broker/detail/abstract_backend.hh (100%) rename {include => libbroker}/broker/detail/algorithms.hh (100%) rename {include => libbroker}/broker/detail/appliers.hh (100%) rename {include => libbroker}/broker/detail/assert.hh (100%) rename {include => libbroker}/broker/detail/comparable.hh (100%) rename {include => libbroker}/broker/detail/die.hh (100%) rename {src => libbroker/broker}/detail/filesystem.cc (100%) rename {include => libbroker}/broker/detail/filesystem.hh (100%) rename {src => libbroker/broker}/detail/flare.cc (100%) rename {include => libbroker}/broker/detail/flare.hh (100%) rename {include => libbroker}/broker/detail/hash.hh (100%) rename {include => libbroker}/broker/detail/inspect_enum.hh (100%) rename {src => libbroker/broker}/detail/make_backend.cc (100%) rename {include => libbroker}/broker/detail/make_backend.hh (100%) rename {src => libbroker/broker}/detail/memory_backend.cc (100%) rename {include => libbroker}/broker/detail/memory_backend.hh (100%) rename {src => libbroker/broker}/detail/monotonic_buffer_resource.cc (100%) rename {include => libbroker}/broker/detail/monotonic_buffer_resource.hh (100%) rename {include => libbroker}/broker/detail/native_socket.hh (100%) rename {include => libbroker}/broker/detail/next_tick.hh (100%) rename {src => libbroker/broker}/detail/opaque_type.cc (100%) rename {include => libbroker}/broker/detail/opaque_type.hh (100%) rename {include => libbroker}/broker/detail/operators.hh (100%) rename {include => libbroker}/broker/detail/overload.hh (100%) rename {src => libbroker/broker}/detail/peer_status_map.cc (100%) rename {include => libbroker}/broker/detail/peer_status_map.hh (100%) rename tests/cpp/detail/peer_status_map.cc => libbroker/broker/detail/peer_status_map.test.cc (95%) rename {include => libbroker}/broker/detail/pp.hh (100%) rename {src => libbroker/broker}/detail/prefix_matcher.cc (100%) rename {include => libbroker}/broker/detail/prefix_matcher.hh (100%) rename {include => libbroker}/broker/detail/promote.hh (100%) rename {include => libbroker}/broker/detail/radix_tree.hh (100%) rename {src => libbroker/broker}/detail/sink_driver.cc (100%) rename {include => libbroker}/broker/detail/sink_driver.hh (100%) rename {src => libbroker/broker}/detail/source_driver.cc (100%) rename {include => libbroker}/broker/detail/source_driver.hh (100%) rename {src => libbroker/broker}/detail/sqlite_backend.cc (100%) rename {include => libbroker}/broker/detail/sqlite_backend.hh (100%) rename {src => libbroker/broker}/detail/store_state.cc (100%) rename {include => libbroker}/broker/detail/store_state.hh (100%) rename {include => libbroker}/broker/detail/type_traits.hh (100%) rename {src => libbroker/broker}/domain_options.cc (100%) rename {include => libbroker}/broker/domain_options.hh (100%) rename tests/cpp/domain_options.cc => libbroker/broker/domain_options.test.cc (92%) rename {src => libbroker/broker}/endpoint.cc (100%) rename {include => libbroker}/broker/endpoint.hh (100%) rename {src => libbroker/broker}/endpoint_id.cc (100%) rename {include => libbroker}/broker/endpoint_id.hh (100%) rename {src => libbroker/broker}/endpoint_info.cc (100%) rename {include => libbroker}/broker/endpoint_info.hh (100%) rename {src => libbroker/broker}/entity_id.cc (100%) rename {include => libbroker}/broker/entity_id.hh (100%) rename {include => libbroker}/broker/enum_value.hh (100%) rename {src => libbroker/broker}/envelope.cc (100%) rename {include => libbroker}/broker/envelope.hh (100%) rename {src => libbroker/broker}/error.cc (100%) rename {include => libbroker}/broker/error.hh (100%) rename tests/cpp/error.cc => libbroker/broker/error.test.cc (99%) rename {include => libbroker}/broker/expected.hh (100%) rename {src => libbroker/broker}/filter_type.cc (100%) rename {include => libbroker}/broker/filter_type.hh (100%) rename tests/cpp/filter_type.cc => libbroker/broker/filter_type.test.cc (95%) rename {src => libbroker/broker}/format/bin.cc (100%) rename {include => libbroker}/broker/format/bin.hh (100%) rename tests/cpp/format/bin.cc => libbroker/broker/format/bin.test.cc (99%) rename {src => libbroker/broker}/format/json.cc (100%) rename {include => libbroker}/broker/format/json.hh (100%) rename tests/cpp/format/json.cc => libbroker/broker/format/json.test.cc (99%) rename {include => libbroker}/broker/format/txt.hh (100%) rename {include => libbroker}/broker/frontend.hh (100%) rename {include => libbroker}/broker/fwd.hh (100%) rename {src => libbroker/broker}/gateway.cc (100%) rename tests/cpp/integration.cc => libbroker/broker/integration.test.cc (99%) rename {include => libbroker}/broker/internal/README.md (100%) rename {include => libbroker}/broker/internal/channel.hh (100%) rename tests/cpp/internal/channel.cc => libbroker/broker/internal/channel.test.cc (99%) rename {src => libbroker/broker}/internal/clone_actor.cc (100%) rename {include => libbroker}/broker/internal/clone_actor.hh (100%) rename {include => libbroker}/broker/internal/configuration_access.hh (100%) rename {src => libbroker/broker}/internal/connector.cc (100%) rename {include => libbroker}/broker/internal/connector.hh (100%) rename {src => libbroker/broker}/internal/connector_adapter.cc (100%) rename {include => libbroker}/broker/internal/connector_adapter.hh (100%) rename {src => libbroker/broker}/internal/core_actor.cc (100%) rename {include => libbroker}/broker/internal/core_actor.hh (100%) rename tests/cpp/internal/core_actor.cc => libbroker/broker/internal/core_actor.test.cc (98%) rename {src => libbroker/broker}/internal/core_recorder.cc (100%) rename {include => libbroker}/broker/internal/core_recorder.hh (100%) rename {src => libbroker/broker}/internal/data_generator.cc (100%) rename {include => libbroker}/broker/internal/data_generator.hh (100%) rename tests/cpp/internal/data_generator.cc => libbroker/broker/internal/data_generator.test.cc (99%) rename {include => libbroker}/broker/internal/endpoint_access.hh (100%) rename {src => libbroker/broker}/internal/flare_actor.cc (100%) rename {include => libbroker}/broker/internal/flare_actor.hh (100%) rename {include => libbroker}/broker/internal/flow_scope.hh (100%) rename {include => libbroker}/broker/internal/fwd.hh (100%) rename {src => libbroker/broker}/internal/generator_file_reader.cc (100%) rename {include => libbroker}/broker/internal/generator_file_reader.hh (100%) rename {src => libbroker/broker}/internal/generator_file_writer.cc (100%) rename {include => libbroker}/broker/internal/generator_file_writer.hh (100%) rename tests/cpp/internal/generator_file_writer.cc => libbroker/broker/internal/generator_file_writer.test.cc (97%) rename {src => libbroker/broker}/internal/json.cc (100%) rename {include => libbroker}/broker/internal/json.hh (100%) rename tests/cpp/internal/json.cc => libbroker/broker/internal/json.test.cc (98%) rename {src => libbroker/broker}/internal/json_client.cc (100%) rename {include => libbroker}/broker/internal/json_client.hh (100%) rename {src => libbroker/broker}/internal/json_type_mapper.cc (100%) rename {include => libbroker}/broker/internal/json_type_mapper.hh (100%) rename tests/cpp/internal/json_type_mapper.cc => libbroker/broker/internal/json_type_mapper.test.cc (98%) rename {include => libbroker}/broker/internal/killswitch.hh (100%) rename {include => libbroker}/broker/internal/logger.hh (100%) rename {src => libbroker/broker}/internal/master_actor.cc (100%) rename {include => libbroker}/broker/internal/master_actor.hh (100%) rename {src => libbroker/broker}/internal/master_resolver.cc (100%) rename {include => libbroker}/broker/internal/master_resolver.hh (100%) rename {src => libbroker/broker}/internal/meta_command_writer.cc (100%) rename {include => libbroker}/broker/internal/meta_command_writer.hh (100%) rename tests/cpp/internal/meta_command_writer.cc => libbroker/broker/internal/meta_command_writer.test.cc (98%) rename {src => libbroker/broker}/internal/meta_data_writer.cc (100%) rename {include => libbroker}/broker/internal/meta_data_writer.hh (100%) rename tests/cpp/internal/meta_data_writer.cc => libbroker/broker/internal/meta_data_writer.test.cc (99%) rename {src => libbroker/broker}/internal/metric_collector.cc (100%) rename {include => libbroker}/broker/internal/metric_collector.hh (100%) rename tests/cpp/internal/metric_collector.cc => libbroker/broker/internal/metric_collector.test.cc (99%) rename {src => libbroker/broker}/internal/metric_exporter.cc (100%) rename {include => libbroker}/broker/internal/metric_exporter.hh (100%) rename tests/cpp/internal/metric_exporter.cc => libbroker/broker/internal/metric_exporter.test.cc (99%) rename {src => libbroker/broker}/internal/metric_factory.cc (100%) rename {include => libbroker}/broker/internal/metric_factory.hh (100%) rename {src => libbroker/broker}/internal/metric_scraper.cc (100%) rename {include => libbroker}/broker/internal/metric_scraper.hh (100%) rename {src => libbroker/broker}/internal/metric_view.cc (100%) rename {include => libbroker}/broker/internal/metric_view.hh (100%) rename {include => libbroker}/broker/internal/native.hh (100%) rename {include => libbroker}/broker/internal/peer_filter.hh (100%) rename {src => libbroker/broker}/internal/peering.cc (100%) rename {include => libbroker}/broker/internal/peering.hh (100%) rename {src => libbroker/broker}/internal/pending_connection.cc (100%) rename {include => libbroker}/broker/internal/pending_connection.hh (100%) rename {src => libbroker/broker}/internal/println.cc (100%) rename {include => libbroker}/broker/internal/println.hh (100%) rename {src => libbroker/broker}/internal/prometheus.cc (100%) rename {include => libbroker}/broker/internal/prometheus.hh (100%) rename {include => libbroker}/broker/internal/read_value.hh (100%) rename {include => libbroker}/broker/internal/retry_state.hh (100%) rename {src => libbroker/broker}/internal/store_actor.cc (100%) rename {include => libbroker}/broker/internal/store_actor.hh (100%) rename {include => libbroker}/broker/internal/type_id.hh (100%) rename {src => libbroker/broker}/internal/web_socket.cc (100%) rename {include => libbroker}/broker/internal/web_socket.hh (100%) rename {src => libbroker/broker}/internal/wire_format.cc (100%) rename {include => libbroker}/broker/internal/wire_format.hh (100%) rename tests/cpp/internal/wire_format.cc => libbroker/broker/internal/wire_format.test.cc (97%) rename {include => libbroker}/broker/internal/with_native_labels.hh (100%) rename {include => libbroker}/broker/internal/write_value.hh (100%) rename {src => libbroker/broker}/internal_command.cc (100%) rename {include => libbroker}/broker/internal_command.hh (100%) rename {include => libbroker}/broker/intrusive_ptr.hh (100%) rename {include => libbroker}/broker/lamport_timestamp.hh (100%) rename {src => libbroker/broker}/mailbox.cc (100%) rename {include => libbroker}/broker/mailbox.hh (100%) rename tests/cpp/master.cc => libbroker/broker/master.test.cc (99%) rename {include => libbroker}/broker/message.hh (100%) rename {src => libbroker/broker}/network_info.cc (100%) rename {include => libbroker}/broker/network_info.hh (100%) rename {include => libbroker}/broker/none.hh (100%) rename {src => libbroker/broker}/p2p_message_type.cc (100%) rename {include => libbroker}/broker/p2p_message_type.hh (100%) rename {include => libbroker}/broker/peer_flags.hh (100%) rename {include => libbroker}/broker/peer_info.hh (100%) rename {src => libbroker/broker}/peer_status.cc (100%) rename {include => libbroker}/broker/peer_status.hh (100%) rename tests/cpp/system/peering.cc => libbroker/broker/peering.test.cc (99%) rename {src => libbroker/broker}/ping_envelope.cc (100%) rename {include => libbroker}/broker/ping_envelope.hh (100%) rename {src => libbroker/broker}/pong_envelope.cc (100%) rename {include => libbroker}/broker/pong_envelope.hh (100%) rename {src => libbroker/broker}/port.cc (100%) rename {include => libbroker}/broker/port.hh (100%) rename {src => libbroker/broker}/publisher.cc (100%) rename {include => libbroker}/broker/publisher.hh (100%) rename tests/cpp/publisher.cc => libbroker/broker/publisher.test.cc (98%) rename {include => libbroker}/broker/publisher_id.hh (100%) rename tests/cpp/radix_tree.cc => libbroker/broker/radix_tree.test.cc (99%) rename {src => libbroker/broker}/routing_update_envelope.cc (100%) rename {include => libbroker}/broker/routing_update_envelope.hh (100%) rename tests/cpp/system/shutdown.cc => libbroker/broker/shutdown.test.cc (99%) rename {src => libbroker/broker}/shutdown_options.cc (100%) rename {include => libbroker}/broker/shutdown_options.hh (100%) rename {include => libbroker}/broker/snapshot.hh (100%) rename {include => libbroker}/broker/span.hh (100%) rename {src => libbroker/broker}/status.cc (100%) rename {include => libbroker}/broker/status.hh (100%) rename tests/cpp/status.cc => libbroker/broker/status.test.cc (98%) rename {src => libbroker/broker}/status_subscriber.cc (100%) rename {include => libbroker}/broker/status_subscriber.hh (100%) rename tests/cpp/status_subscriber.cc => libbroker/broker/status_subscriber.test.cc (97%) rename {src => libbroker/broker}/store.cc (100%) rename {include => libbroker}/broker/store.hh (100%) rename tests/cpp/store.cc => libbroker/broker/store.test.cc (98%) rename {src => libbroker/broker}/store_event.cc (100%) rename {include => libbroker}/broker/store_event.hh (100%) rename tests/cpp/store_event.cc => libbroker/broker/store_event.test.cc (99%) rename {src => libbroker/broker}/subnet.cc (100%) rename {include => libbroker}/broker/subnet.hh (100%) rename {src => libbroker/broker}/subscriber.cc (100%) rename {include => libbroker}/broker/subscriber.hh (100%) rename tests/cpp/subscriber.cc => libbroker/broker/subscriber.test.cc (98%) rename {src => libbroker/broker}/telemetry/counter.cc (100%) rename {include => libbroker}/broker/telemetry/counter.hh (100%) rename {include => libbroker}/broker/telemetry/fwd.hh (100%) rename {src => libbroker/broker}/telemetry/gauge.cc (100%) rename {include => libbroker}/broker/telemetry/gauge.hh (100%) rename {src => libbroker/broker}/telemetry/histogram.cc (100%) rename {include => libbroker}/broker/telemetry/histogram.hh (100%) rename tests/cpp/telemetry/histogram.cc => libbroker/broker/telemetry/histogram.test.cc (98%) rename {src => libbroker/broker}/telemetry/metric_family.cc (100%) rename {include => libbroker}/broker/telemetry/metric_family.hh (100%) rename {src => libbroker/broker}/telemetry/metric_registry.cc (100%) rename {include => libbroker}/broker/telemetry/metric_registry.hh (100%) rename {src => libbroker/broker}/telemetry/metric_registry_impl.cc (100%) rename {include => libbroker}/broker/telemetry/metric_registry_impl.hh (100%) rename {src => libbroker/broker}/time.cc (100%) rename {include => libbroker}/broker/time.hh (100%) rename {include => libbroker}/broker/timeout.hh (100%) rename {src => libbroker/broker}/topic.cc (100%) rename {include => libbroker}/broker/topic.hh (100%) rename tests/cpp/topic.cc => libbroker/broker/topic.test.cc (98%) rename {src => libbroker/broker}/variant.cc (100%) rename {include => libbroker}/broker/variant.hh (100%) rename tests/cpp/variant.cc => libbroker/broker/variant.test.cc (99%) rename {src => libbroker/broker}/variant_data.cc (100%) rename {include => libbroker}/broker/variant_data.hh (100%) rename {src => libbroker/broker}/variant_list.cc (100%) rename {include => libbroker}/broker/variant_list.hh (100%) rename {src => libbroker/broker}/variant_set.cc (100%) rename {include => libbroker}/broker/variant_set.hh (100%) rename {src => libbroker/broker}/variant_table.cc (100%) rename {include => libbroker}/broker/variant_table.hh (100%) rename {src => libbroker/broker}/variant_tag.cc (100%) rename {include => libbroker}/broker/variant_tag.hh (100%) rename {src => libbroker/broker}/version.cc (100%) rename {include => libbroker}/broker/version.hh (100%) rename {include => libbroker}/broker/visit.hh (100%) rename {src => libbroker/broker}/worker.cc (100%) rename {include => libbroker}/broker/worker.hh (100%) rename {src => libbroker/broker}/zeek.cc (100%) rename {include => libbroker}/broker/zeek.hh (100%) rename tests/cpp/zeek.cc => libbroker/broker/zeek.test.cc (98%) create mode 100644 tests/benchmarks/CMakeLists.txt rename tests/{benchmark => benchmarks/cluster}/README.md (86%) rename tests/{benchmark/broker-cluster-benchmark.cc => benchmarks/cluster/cluster.cc} (100%) rename tests/{benchmark/cluster-example.zip => benchmarks/cluster/example.zip} (100%) rename tests/{benchmark => benchmarks/cluster}/mars.dat (100%) rename tests/{benchmark/broker-fan-out.cc => benchmarks/fan-out/fan-out.cc} (100%) rename tests/{micro-benchmark/src => benchmarks}/main.cc (100%) rename tests/{micro-benchmark/include => benchmarks}/main.hh (91%) create mode 100644 tests/benchmarks/routing-table/CMakeLists.txt rename tests/{micro-benchmark/src => benchmarks/routing-table}/routing-table.cc (100%) create mode 100644 tests/benchmarks/serialization/CMakeLists.txt create mode 100644 tests/benchmarks/serialization/generator.cc create mode 100644 tests/benchmarks/serialization/generator.hh rename tests/{micro-benchmark/src => benchmarks/serialization}/serialization.cc (100%) delete mode 100644 tests/cpp/ssl.cc delete mode 100644 tests/cpp/system/README rename tests/{cpp => data}/certs/ca.pem (100%) rename tests/{cpp => data}/certs/cert.1.pem (100%) rename tests/{cpp => data}/certs/cert.2.pem (100%) rename tests/{cpp => data}/certs/cert.self-signed.pem (100%) rename tests/{cpp => data}/certs/key.1.enc.pem (100%) rename tests/{cpp => data}/certs/key.1.pem (100%) rename tests/{cpp => data}/certs/key.2.pem (100%) rename tests/{cpp => data}/certs/key.self-signed.pem (100%) delete mode 100644 tests/foo.txt delete mode 100644 tests/micro-benchmark/CMakeLists.txt delete mode 100644 tests/micro-benchmark/src/streaming.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index cba9fcdd6..f0d430916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ include(CMakePackageConfigHelpers) include(GNUInstallDirs) include(cmake/CommonCMakeConfig.cmake) +set(BROKER_TEST_TIMEOUT 60) + get_directory_property(parent_dir PARENT_DIRECTORY) if(parent_dir) set(broker_is_subproject ON) @@ -213,11 +215,9 @@ if (CAF_ROOT) message(STATUS "Using system CAF version ${CAF_VERSION}") # TODO: drop < 3.12 compatibility check when raising the minimum CMake version if (CMAKE_VERSION VERSION_LESS 3.12) - find_package(CAF REQUIRED - COMPONENTS openssl test io core - PATHS "${CAF_ROOT}") + find_package(CAF REQUIRED COMPONENTS test io core net PATHS "${CAF_ROOT}") else() - find_package(CAF REQUIRED COMPONENTS openssl test io core net) + find_package(CAF REQUIRED COMPONENTS test io core net) endif() list(APPEND LINK_LIBS CAF::core CAF::io CAF::net) set(BROKER_USE_EXTERNAL_CAF ON) @@ -227,12 +227,13 @@ else () # able to find a CAF installation. message(STATUS "Using bundled CAF") add_bundled_caf() - list(APPEND OPTIONAL_SRC $) - list(APPEND OPTIONAL_SRC $) - list(APPEND OPTIONAL_SRC $) set(BROKER_USE_EXTERNAL_CAF OFF) endif () +if ( NOT BROKER_DISABLE_TESTS ) + enable_testing() +endif() + # -- libroker ----------------------------------------------------------------- file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" BROKER_VERSION LIMIT_COUNT 1) @@ -256,169 +257,24 @@ install( CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}/include/broker\")") # Install all headers except the files from broker/internal. -install(DIRECTORY include/broker +install(DIRECTORY libbroker/broker DESTINATION include FILES_MATCHING PATTERN "*.hh" - PATTERN "include/broker/internal" EXCLUDE) - -include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include) + PATTERN "libbroker/broker/internal" EXCLUDE + PATTERN "*.test.hh" EXCLUDE) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.hh.in - ${CMAKE_CURRENT_BINARY_DIR}/include/broker/config.hh) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/broker/config.hh DESTINATION include/broker) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/broker/config.hh DESTINATION include/broker) if (NOT BROKER_EXTERNAL_SQLITE_TARGET) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) set_source_files_properties(3rdparty/sqlite3.c PROPERTIES COMPILE_FLAGS -DSQLITE_OMIT_LOAD_EXTENSION) - list(APPEND OPTIONAL_SRC 3rdparty/sqlite3.c) + list(APPEND OPTIONAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.c) else() list(APPEND LINK_LIBS ${BROKER_EXTERNAL_SQLITE_TARGET}) endif() -set(BROKER_SRC - # src/detail/core_recorder.cc - # src/detail/generator_file_reader.cc - # src/detail/generator_file_writer.cc - # src/gateway.cc - # src/internal/data_generator.cc - # src/internal/generator_file_reader.cc - # src/internal/generator_file_writer.cc - # src/internal/meta_command_writer.cc - # src/internal/meta_data_writer.cc - ${OPTIONAL_SRC} - src/address.cc - src/alm/multipath.cc - src/alm/routing_table.cc - src/builder.cc - src/command_envelope.cc - src/configuration.cc - src/convert.cc - src/data.cc - src/data_envelope.cc - src/detail/abstract_backend.cc - src/detail/filesystem.cc - src/detail/flare.cc - src/detail/make_backend.cc - src/detail/memory_backend.cc - src/detail/monotonic_buffer_resource.cc - src/detail/opaque_type.cc - src/detail/peer_status_map.cc - src/detail/prefix_matcher.cc - src/detail/sink_driver.cc - src/detail/source_driver.cc - src/detail/sqlite_backend.cc - src/detail/store_state.cc - src/domain_options.cc - src/endpoint.cc - src/endpoint_id.cc - src/endpoint_info.cc - src/entity_id.cc - src/envelope.cc - src/error.cc - src/filter_type.cc - src/format/bin.cc - src/format/json.cc - src/internal/clone_actor.cc - src/internal/connector.cc - src/internal/connector_adapter.cc - src/internal/core_actor.cc - src/internal/flare_actor.cc - src/internal/json.cc - src/internal/json_client.cc - src/internal/json_type_mapper.cc - src/internal/master_actor.cc - src/internal/master_resolver.cc - src/internal/metric_collector.cc - src/internal/metric_exporter.cc - src/internal/metric_factory.cc - src/internal/metric_scraper.cc - src/internal/metric_view.cc - src/internal/peering.cc - src/internal/pending_connection.cc - src/internal/println.cc - src/internal/prometheus.cc - src/internal/store_actor.cc - src/internal/web_socket.cc - src/internal/wire_format.cc - src/internal_command.cc - src/mailbox.cc - src/network_info.cc - src/p2p_message_type.cc - src/peer_status.cc - src/ping_envelope.cc - src/pong_envelope.cc - src/port.cc - src/publisher.cc - src/routing_update_envelope.cc - src/shutdown_options.cc - src/status.cc - src/status_subscriber.cc - src/store.cc - src/store_event.cc - src/subnet.cc - src/subscriber.cc - src/telemetry/counter.cc - src/telemetry/gauge.cc - src/telemetry/histogram.cc - src/telemetry/metric_family.cc - src/telemetry/metric_registry.cc - src/telemetry/metric_registry_impl.cc - src/time.cc - src/topic.cc - src/variant.cc - src/variant_data.cc - src/variant_list.cc - src/variant_set.cc - src/variant_table.cc - src/variant_tag.cc - src/version.cc - src/worker.cc - src/zeek.cc -) - -if (ENABLE_SHARED) - add_library(broker SHARED ${BROKER_SRC}) - set_target_properties(broker PROPERTIES - SOVERSION ${BROKER_SOVERSION} - VERSION ${BROKER_VERSION_MAJOR}.${BROKER_VERSION_MINOR} - MACOSX_RPATH true - OUTPUT_NAME broker) - target_link_libraries(broker PUBLIC ${LINK_LIBS}) - target_link_libraries(broker PRIVATE CAF::core CAF::io CAF::net) - install(TARGETS broker - EXPORT BrokerTargets - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - target_include_directories(broker INTERFACE - $ - $ - $) -endif () - -if (ENABLE_STATIC) - add_library(broker_static STATIC ${BROKER_SRC}) - set_target_properties(broker_static PROPERTIES OUTPUT_NAME broker) - if (NOT DISABLE_PYTHON_BINDINGS) - set_target_properties(broker_static PROPERTIES POSITION_INDEPENDENT_CODE ON) - endif() - target_link_libraries(broker_static PUBLIC ${LINK_LIBS}) - target_link_libraries(broker_static PRIVATE CAF::core CAF::io CAF::net) - install(TARGETS broker_static - EXPORT BrokerTargets - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - target_include_directories(broker_static INTERFACE - $ - $ - $) -endif () - -if (ENABLE_SHARED) - set(BROKER_LIBRARY broker) -else() - set(BROKER_LIBRARY broker_static) -endif() +add_subdirectory(libbroker) set(tidyCfgFile "${CMAKE_SOURCE_DIR}/.clang-tidy") if (BROKER_ENABLE_TIDY) @@ -437,30 +293,11 @@ if (BROKER_ENABLE_TIDY) endif () -# -- Tools -------------------------------------------------------------------- +# -- Tools and benchmarks ----------------------------------------------------- -macro(add_tool name) - add_executable(${name} src/${name}.cc ${ARGN}) - if (ENABLE_SHARED) - target_link_libraries(${name} broker CAF::core CAF::io CAF::net) - add_dependencies(${name} broker) - else() - target_link_libraries(${name} broker_static CAF::core CAF::io CAF::net) - add_dependencies(${name} broker_static) - endif() - if (BROKER_ENABLE_TIDY) - set_target_properties(${name} PROPERTIES - CXX_CLANG_TIDY "clang-tidy;--config-file=${tidyCfgFile}") - target_compile_definitions(${name} PRIVATE ${BROKER_CLANG_TIDY_DEF}) - endif () -endmacro() - -if (NOT BROKER_DISABLE_TOOLS) - # TODO: fix these tools - # add_tool(broker-gateway) - add_tool(broker-node) - add_tool(broker-pipe) -endif () +add_subdirectory(broker-node) +add_subdirectory(broker-pipe) +add_subdirectory(broker-throughput) # -- Bindings ----------------------------------------------------------------- @@ -499,15 +336,14 @@ endif () # -- Unit Tests --------------------------------------------------------------- if ( NOT BROKER_DISABLE_TESTS ) - enable_testing() add_subdirectory(tests) endif () # -- Documentation ------------------------------------------------------------ -if (NOT WIN32 AND NOT BROKER_DISABLE_DOCS) - add_subdirectory(doc) -endif () +# if (NOT WIN32 AND NOT BROKER_DISABLE_DOCS) +# add_subdirectory(doc) +# endif () # -- CMake package install ---------------------------------------------------- @@ -518,7 +354,7 @@ install( DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Broker") configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/src/BrokerConfig.cmake.in" + "${CMAKE_CURRENT_SOURCE_DIR}/libbroker/BrokerConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/BrokerConfig.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Broker") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc54d5f5c..9ca216e34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,7 +97,8 @@ General Header ------ -- Header filenames end in `.hh` and implementation filenames in `.cc`. +- Header filenames end in `.hh`, implementation filenames in `.cc` and files for + unit tests end in `.test.cc`. - All header files should use `#pragma once` to prevent multiple inclusion. diff --git a/broker-node/CMakeLists.txt b/broker-node/CMakeLists.txt new file mode 100644 index 000000000..b27a65b03 --- /dev/null +++ b/broker-node/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(broker-node + broker-node.cc +) +target_link_libraries(broker-node PRIVATE ${BROKER_LIBRARY}) +target_include_directories(broker PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/broker-node.cc b/broker-node/broker-node.cc similarity index 100% rename from src/broker-node.cc rename to broker-node/broker-node.cc diff --git a/broker-pipe/CMakeLists.txt b/broker-pipe/CMakeLists.txt new file mode 100644 index 000000000..e5b0f2669 --- /dev/null +++ b/broker-pipe/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(broker-pipe + broker-pipe.cc +) +target_link_libraries(broker-pipe PRIVATE ${BROKER_LIBRARY}) +target_include_directories(broker PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/broker-pipe.cc b/broker-pipe/broker-pipe.cc similarity index 100% rename from src/broker-pipe.cc rename to broker-pipe/broker-pipe.cc diff --git a/broker-throughput/CMakeLists.txt b/broker-throughput/CMakeLists.txt new file mode 100644 index 000000000..2681b0c84 --- /dev/null +++ b/broker-throughput/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(broker-throughput + broker-throughput.cc +) +target_link_libraries(broker-throughput PRIVATE ${BROKER_LIBRARY}) diff --git a/broker-throughput/README.md b/broker-throughput/README.md new file mode 100644 index 000000000..a1feb323f --- /dev/null +++ b/broker-throughput/README.md @@ -0,0 +1,27 @@ +The utility program `broker-throughput` is a standalone tool to measure the +throughput of a network of Broker endpoints. + +A test setup requires at least two processes: a client and a server. + +### Starting the Server + +The server simply creates a Broker endpoint and binds it to the given port: + +```sh +broker-throughput --verbose --server :8080 +``` + +### Staring the Client + +After starting the server, clients can start peering to it. The important +parameters of the benchmark are message type (`-t`) and rate (`-r`). The +message type is 1 for trivial strings, 2 for Broker vectors that resemble a +line in conn.log, or 3 for large Broker tables. The rate parameter configures +how many messages per second the client should send. + +For sending 1,000 large table messages per second, the client could get started +as follows: + +```sh +broker-throughput --verbose -t 3 -r 1000 localhost:8080 +``` diff --git a/tests/benchmark/broker-benchmark.bro b/broker-throughput/broker-throughput.bro similarity index 100% rename from tests/benchmark/broker-benchmark.bro rename to broker-throughput/broker-throughput.bro diff --git a/tests/benchmark/broker-benchmark.cc b/broker-throughput/broker-throughput.cc similarity index 100% rename from tests/benchmark/broker-benchmark.cc rename to broker-throughput/broker-throughput.cc diff --git a/tests/benchmark/broker-benchmark.py b/broker-throughput/broker-throughput.py similarity index 100% rename from tests/benchmark/broker-benchmark.py rename to broker-throughput/broker-throughput.py diff --git a/src/BrokerConfig.cmake.in b/libbroker/BrokerConfig.cmake.in similarity index 100% rename from src/BrokerConfig.cmake.in rename to libbroker/BrokerConfig.cmake.in diff --git a/libbroker/CMakeLists.txt b/libbroker/CMakeLists.txt new file mode 100644 index 000000000..4c0594c3c --- /dev/null +++ b/libbroker/CMakeLists.txt @@ -0,0 +1,217 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/broker/config.hh.in + ${CMAKE_CURRENT_BINARY_DIR}/broker/config.hh) + +set(BROKER_SRC + # src/detail/core_recorder.cc + # src/detail/generator_file_reader.cc + # src/detail/generator_file_writer.cc + # src/gateway.cc + # src/internal/data_generator.cc + # src/internal/generator_file_reader.cc + # src/internal/generator_file_writer.cc + # src/internal/meta_command_writer.cc + # src/internal/meta_data_writer.cc + ${OPTIONAL_SRC} + broker/address.cc + broker/alm/multipath.cc + broker/alm/routing_table.cc + broker/builder.cc + broker/command_envelope.cc + broker/configuration.cc + broker/convert.cc + broker/data.cc + broker/data_envelope.cc + broker/detail/abstract_backend.cc + broker/detail/filesystem.cc + broker/detail/flare.cc + broker/detail/make_backend.cc + broker/detail/memory_backend.cc + broker/detail/monotonic_buffer_resource.cc + broker/detail/opaque_type.cc + broker/detail/peer_status_map.cc + broker/detail/prefix_matcher.cc + broker/detail/sink_driver.cc + broker/detail/source_driver.cc + broker/detail/sqlite_backend.cc + broker/detail/store_state.cc + broker/domain_options.cc + broker/endpoint.cc + broker/endpoint_id.cc + broker/endpoint_info.cc + broker/entity_id.cc + broker/envelope.cc + broker/error.cc + broker/filter_type.cc + broker/format/bin.cc + broker/format/json.cc + broker/internal/clone_actor.cc + broker/internal/connector.cc + broker/internal/connector_adapter.cc + broker/internal/core_actor.cc + broker/internal/flare_actor.cc + broker/internal/json.cc + broker/internal/json_client.cc + broker/internal/json_type_mapper.cc + broker/internal/master_actor.cc + broker/internal/master_resolver.cc + broker/internal/metric_collector.cc + broker/internal/metric_exporter.cc + broker/internal/metric_factory.cc + broker/internal/metric_scraper.cc + broker/internal/metric_view.cc + broker/internal/peering.cc + broker/internal/pending_connection.cc + broker/internal/println.cc + broker/internal/prometheus.cc + broker/internal/store_actor.cc + broker/internal/web_socket.cc + broker/internal/wire_format.cc + broker/internal_command.cc + broker/mailbox.cc + broker/network_info.cc + broker/p2p_message_type.cc + broker/peer_status.cc + broker/ping_envelope.cc + broker/pong_envelope.cc + broker/port.cc + broker/publisher.cc + broker/routing_update_envelope.cc + broker/shutdown_options.cc + broker/status.cc + broker/status_subscriber.cc + broker/store.cc + broker/store_event.cc + broker/subnet.cc + broker/subscriber.cc + broker/telemetry/counter.cc + broker/telemetry/gauge.cc + broker/telemetry/histogram.cc + broker/telemetry/metric_family.cc + broker/telemetry/metric_registry.cc + broker/telemetry/metric_registry_impl.cc + broker/time.cc + broker/topic.cc + broker/variant.cc + broker/variant_data.cc + broker/variant_list.cc + broker/variant_set.cc + broker/variant_table.cc + broker/variant_tag.cc + broker/version.cc + broker/worker.cc + broker/zeek.cc +) + +if (ENABLE_SHARED) + add_library(broker SHARED ${BROKER_SRC}) + set_target_properties(broker PROPERTIES + SOVERSION ${BROKER_SOVERSION} + VERSION ${BROKER_VERSION_MAJOR}.${BROKER_VERSION_MINOR} + MACOSX_RPATH true + OUTPUT_NAME broker) + target_link_libraries(broker PUBLIC ${LINK_LIBS}) + target_link_libraries(broker PRIVATE CAF::core CAF::io CAF::net) + install(TARGETS broker + EXPORT BrokerTargets + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + target_include_directories(broker PUBLIC + $ + $ + $) +endif () + +if (ENABLE_STATIC) + add_library(broker_static STATIC ${BROKER_SRC}) + set_target_properties(broker_static PROPERTIES OUTPUT_NAME broker) + if (NOT DISABLE_PYTHON_BINDINGS) + set_target_properties(broker_static PROPERTIES POSITION_INDEPENDENT_CODE ON) + endif() + target_link_libraries(broker_static PUBLIC ${LINK_LIBS}) + target_link_libraries(broker_static PRIVATE CAF::core CAF::io CAF::net) + install(TARGETS broker_static + EXPORT BrokerTargets + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + target_include_directories(broker_static PUBLIC + $ + $ + $) +endif () + +if (ENABLE_SHARED) + set(main_lib_target broker) +else() + set(main_lib_target broker_static) +endif() + +set(BROKER_LIBRARY ${main_lib_target} PARENT_SCOPE) + +if ( BROKER_DISABLE_TESTS ) + return() +endif () + +set(BROKER_TEST_SRC + # broker/core.test.cc + # broker/integration.test.cc + # broker/internal/data_generator.test.cc + # broker/internal/generator_file_writer.test.cc + # broker/internal/json_type_mapper.test.cc + # broker/internal/meta_command_writer.test.cc + # broker/internal/meta_data_writer.test.cc + broker/alm/multipath.test.cc + broker/alm/routing_table.test.cc + broker/backend.test.cc + broker/broker-test.test.cc + broker/builder.test.cc + broker/data.test.cc + broker/detail/peer_status_map.test.cc + broker/domain_options.test.cc + broker/error.test.cc + broker/filter_type.test.cc + broker/format/bin.test.cc + broker/format/json.test.cc + broker/internal/channel.test.cc + broker/internal/core_actor.test.cc + broker/internal/json.test.cc + broker/internal/metric_collector.test.cc + broker/internal/metric_exporter.test.cc + broker/internal/wire_format.test.cc + broker/master.test.cc + broker/peering.test.cc + broker/publisher.test.cc + broker/radix_tree.test.cc + broker/shutdown.test.cc + broker/status.test.cc + broker/status_subscriber.test.cc + broker/store.test.cc + broker/store_event.test.cc + broker/subscriber.test.cc + broker/telemetry/histogram.test.cc + broker/topic.test.cc + broker/variant.test.cc + broker/zeek.test.cc +) + +# Our sytem testing suites require `socketpair`, but Windows lacks this API. +# if (NOT MSVC) +# list(APPEND tests +# cpp/system/shutdown.cc +# ) +# endif() + +add_executable(broker-test ${BROKER_TEST_SRC}) +target_link_libraries(broker-test PRIVATE ${main_lib_target} CAF::test) + +foreach(file_path ${BROKER_TEST_SRC}) + get_filename_component(test_dir ${file_path} DIRECTORY) + get_filename_component(test_file ${file_path} NAME_WE) + string(REPLACE "/" "." test_name ${test_dir}/${test_file}) + set_source_files_properties(${file_path} PROPERTIES COMPILE_DEFINITIONS SUITE=${test_name}) + set(test_verbosity 4) + if (${test_name} STREQUAL broker.radix_tree) + set(test_verbosity 3) # otherwise it just produces way too much output + endif () + add_test(NAME ${test_name} COMMAND broker-test -v ${test_verbosity} -s "^${suite}$" ${ARGN}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT ${BROKER_TEST_TIMEOUT}) + set_tests_properties(${test_name} PROPERTIES ENVIRONMENT + "BROKER_TEST_DIR=${BROKER_TEST_DIR}") +endforeach () diff --git a/src/address.cc b/libbroker/broker/address.cc similarity index 100% rename from src/address.cc rename to libbroker/broker/address.cc diff --git a/include/broker/address.hh b/libbroker/broker/address.hh similarity index 100% rename from include/broker/address.hh rename to libbroker/broker/address.hh diff --git a/src/alm/multipath.cc b/libbroker/broker/alm/multipath.cc similarity index 100% rename from src/alm/multipath.cc rename to libbroker/broker/alm/multipath.cc diff --git a/include/broker/alm/multipath.hh b/libbroker/broker/alm/multipath.hh similarity index 100% rename from include/broker/alm/multipath.hh rename to libbroker/broker/alm/multipath.hh diff --git a/tests/cpp/alm/multipath.cc b/libbroker/broker/alm/multipath.test.cc similarity index 99% rename from tests/cpp/alm/multipath.cc rename to libbroker/broker/alm/multipath.test.cc index 57dfb7504..20673731d 100644 --- a/tests/cpp/alm/multipath.cc +++ b/libbroker/broker/alm/multipath.test.cc @@ -1,8 +1,6 @@ -#define SUITE alm.multipath - #include "broker/alm/multipath.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/alm/routing_table.cc b/libbroker/broker/alm/routing_table.cc similarity index 100% rename from src/alm/routing_table.cc rename to libbroker/broker/alm/routing_table.cc diff --git a/include/broker/alm/routing_table.hh b/libbroker/broker/alm/routing_table.hh similarity index 100% rename from include/broker/alm/routing_table.hh rename to libbroker/broker/alm/routing_table.hh diff --git a/tests/cpp/alm/routing_table.cc b/libbroker/broker/alm/routing_table.test.cc similarity index 99% rename from tests/cpp/alm/routing_table.cc rename to libbroker/broker/alm/routing_table.test.cc index af97cb818..b650cd77c 100644 --- a/tests/cpp/alm/routing_table.cc +++ b/libbroker/broker/alm/routing_table.test.cc @@ -1,8 +1,6 @@ -#define SUITE alm.routing_table - #include "broker/alm/routing_table.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" using namespace broker; using namespace broker::literals; diff --git a/include/broker/api_flags.hh b/libbroker/broker/api_flags.hh similarity index 100% rename from include/broker/api_flags.hh rename to libbroker/broker/api_flags.hh diff --git a/include/broker/backend.hh b/libbroker/broker/backend.hh similarity index 100% rename from include/broker/backend.hh rename to libbroker/broker/backend.hh diff --git a/tests/cpp/backend.cc b/libbroker/broker/backend.test.cc similarity index 99% rename from tests/cpp/backend.cc rename to libbroker/broker/backend.test.cc index 8f8fe944a..647634ce6 100644 --- a/tests/cpp/backend.cc +++ b/libbroker/broker/backend.test.cc @@ -1,8 +1,6 @@ -#define SUITE backend - #include "broker/backend.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/backend_options.hh b/libbroker/broker/backend_options.hh similarity index 100% rename from include/broker/backend_options.hh rename to libbroker/broker/backend_options.hh diff --git a/include/broker/bad_variant_access.hh b/libbroker/broker/bad_variant_access.hh similarity index 100% rename from include/broker/bad_variant_access.hh rename to libbroker/broker/bad_variant_access.hh diff --git a/src/broker-gateway.cc b/libbroker/broker/broker-gateway.cc similarity index 100% rename from src/broker-gateway.cc rename to libbroker/broker/broker-gateway.cc diff --git a/tests/cpp/test.cc b/libbroker/broker/broker-test.test.cc similarity index 99% rename from tests/cpp/test.cc rename to libbroker/broker/broker-test.test.cc index b9fe628d2..6dff735bd 100644 --- a/tests/cpp/test.cc +++ b/libbroker/broker/broker-test.test.cc @@ -1,6 +1,6 @@ #define CAF_TEST_NO_MAIN -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/tests/cpp/test.hh b/libbroker/broker/broker-test.test.hh similarity index 100% rename from tests/cpp/test.hh rename to libbroker/broker/broker-test.test.hh diff --git a/include/broker/broker.hh b/libbroker/broker/broker.hh similarity index 100% rename from include/broker/broker.hh rename to libbroker/broker/broker.hh diff --git a/src/builder.cc b/libbroker/broker/builder.cc similarity index 100% rename from src/builder.cc rename to libbroker/broker/builder.cc diff --git a/include/broker/builder.hh b/libbroker/broker/builder.hh similarity index 100% rename from include/broker/builder.hh rename to libbroker/broker/builder.hh diff --git a/tests/cpp/builder.cc b/libbroker/broker/builder.test.cc similarity index 99% rename from tests/cpp/builder.cc rename to libbroker/broker/builder.test.cc index 1439a97b4..c9604d3a0 100644 --- a/tests/cpp/builder.cc +++ b/libbroker/broker/builder.test.cc @@ -1,8 +1,6 @@ -#define SUITE builder - #include "broker/builder.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/variant.hh" #include "broker/variant_list.hh" diff --git a/src/command_envelope.cc b/libbroker/broker/command_envelope.cc similarity index 100% rename from src/command_envelope.cc rename to libbroker/broker/command_envelope.cc diff --git a/include/broker/command_envelope.hh b/libbroker/broker/command_envelope.hh similarity index 100% rename from include/broker/command_envelope.hh rename to libbroker/broker/command_envelope.hh diff --git a/src/config.hh.in b/libbroker/broker/config.hh.in similarity index 100% rename from src/config.hh.in rename to libbroker/broker/config.hh.in diff --git a/src/configuration.cc b/libbroker/broker/configuration.cc similarity index 100% rename from src/configuration.cc rename to libbroker/broker/configuration.cc diff --git a/include/broker/configuration.hh b/libbroker/broker/configuration.hh similarity index 100% rename from include/broker/configuration.hh rename to libbroker/broker/configuration.hh diff --git a/src/convert.cc b/libbroker/broker/convert.cc similarity index 100% rename from src/convert.cc rename to libbroker/broker/convert.cc diff --git a/include/broker/convert.hh b/libbroker/broker/convert.hh similarity index 100% rename from include/broker/convert.hh rename to libbroker/broker/convert.hh diff --git a/tests/cpp/core.cc b/libbroker/broker/core.test.cc similarity index 99% rename from tests/cpp/core.cc rename to libbroker/broker/core.test.cc index da44324ed..b7a4a72a5 100644 --- a/tests/cpp/core.cc +++ b/libbroker/broker/core.test.cc @@ -1,8 +1,6 @@ -#define SUITE core - #include "broker/internal/core_actor.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/cow_tuple.hh b/libbroker/broker/cow_tuple.hh similarity index 100% rename from include/broker/cow_tuple.hh rename to libbroker/broker/cow_tuple.hh diff --git a/src/data.cc b/libbroker/broker/data.cc similarity index 100% rename from src/data.cc rename to libbroker/broker/data.cc diff --git a/include/broker/data.hh b/libbroker/broker/data.hh similarity index 100% rename from include/broker/data.hh rename to libbroker/broker/data.hh diff --git a/tests/cpp/data.cc b/libbroker/broker/data.test.cc similarity index 98% rename from tests/cpp/data.cc rename to libbroker/broker/data.test.cc index 2b18639a6..f0fdc9a1c 100644 --- a/tests/cpp/data.cc +++ b/libbroker/broker/data.test.cc @@ -1,8 +1,6 @@ -#define SUITE data - #include "broker/data.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/data_envelope.cc b/libbroker/broker/data_envelope.cc similarity index 100% rename from src/data_envelope.cc rename to libbroker/broker/data_envelope.cc diff --git a/include/broker/data_envelope.hh b/libbroker/broker/data_envelope.hh similarity index 100% rename from include/broker/data_envelope.hh rename to libbroker/broker/data_envelope.hh diff --git a/include/broker/defaults.hh b/libbroker/broker/defaults.hh similarity index 100% rename from include/broker/defaults.hh rename to libbroker/broker/defaults.hh diff --git a/src/detail/abstract_backend.cc b/libbroker/broker/detail/abstract_backend.cc similarity index 100% rename from src/detail/abstract_backend.cc rename to libbroker/broker/detail/abstract_backend.cc diff --git a/include/broker/detail/abstract_backend.hh b/libbroker/broker/detail/abstract_backend.hh similarity index 100% rename from include/broker/detail/abstract_backend.hh rename to libbroker/broker/detail/abstract_backend.hh diff --git a/include/broker/detail/algorithms.hh b/libbroker/broker/detail/algorithms.hh similarity index 100% rename from include/broker/detail/algorithms.hh rename to libbroker/broker/detail/algorithms.hh diff --git a/include/broker/detail/appliers.hh b/libbroker/broker/detail/appliers.hh similarity index 100% rename from include/broker/detail/appliers.hh rename to libbroker/broker/detail/appliers.hh diff --git a/include/broker/detail/assert.hh b/libbroker/broker/detail/assert.hh similarity index 100% rename from include/broker/detail/assert.hh rename to libbroker/broker/detail/assert.hh diff --git a/include/broker/detail/comparable.hh b/libbroker/broker/detail/comparable.hh similarity index 100% rename from include/broker/detail/comparable.hh rename to libbroker/broker/detail/comparable.hh diff --git a/include/broker/detail/die.hh b/libbroker/broker/detail/die.hh similarity index 100% rename from include/broker/detail/die.hh rename to libbroker/broker/detail/die.hh diff --git a/src/detail/filesystem.cc b/libbroker/broker/detail/filesystem.cc similarity index 100% rename from src/detail/filesystem.cc rename to libbroker/broker/detail/filesystem.cc diff --git a/include/broker/detail/filesystem.hh b/libbroker/broker/detail/filesystem.hh similarity index 100% rename from include/broker/detail/filesystem.hh rename to libbroker/broker/detail/filesystem.hh diff --git a/src/detail/flare.cc b/libbroker/broker/detail/flare.cc similarity index 100% rename from src/detail/flare.cc rename to libbroker/broker/detail/flare.cc diff --git a/include/broker/detail/flare.hh b/libbroker/broker/detail/flare.hh similarity index 100% rename from include/broker/detail/flare.hh rename to libbroker/broker/detail/flare.hh diff --git a/include/broker/detail/hash.hh b/libbroker/broker/detail/hash.hh similarity index 100% rename from include/broker/detail/hash.hh rename to libbroker/broker/detail/hash.hh diff --git a/include/broker/detail/inspect_enum.hh b/libbroker/broker/detail/inspect_enum.hh similarity index 100% rename from include/broker/detail/inspect_enum.hh rename to libbroker/broker/detail/inspect_enum.hh diff --git a/src/detail/make_backend.cc b/libbroker/broker/detail/make_backend.cc similarity index 100% rename from src/detail/make_backend.cc rename to libbroker/broker/detail/make_backend.cc diff --git a/include/broker/detail/make_backend.hh b/libbroker/broker/detail/make_backend.hh similarity index 100% rename from include/broker/detail/make_backend.hh rename to libbroker/broker/detail/make_backend.hh diff --git a/src/detail/memory_backend.cc b/libbroker/broker/detail/memory_backend.cc similarity index 100% rename from src/detail/memory_backend.cc rename to libbroker/broker/detail/memory_backend.cc diff --git a/include/broker/detail/memory_backend.hh b/libbroker/broker/detail/memory_backend.hh similarity index 100% rename from include/broker/detail/memory_backend.hh rename to libbroker/broker/detail/memory_backend.hh diff --git a/src/detail/monotonic_buffer_resource.cc b/libbroker/broker/detail/monotonic_buffer_resource.cc similarity index 100% rename from src/detail/monotonic_buffer_resource.cc rename to libbroker/broker/detail/monotonic_buffer_resource.cc diff --git a/include/broker/detail/monotonic_buffer_resource.hh b/libbroker/broker/detail/monotonic_buffer_resource.hh similarity index 100% rename from include/broker/detail/monotonic_buffer_resource.hh rename to libbroker/broker/detail/monotonic_buffer_resource.hh diff --git a/include/broker/detail/native_socket.hh b/libbroker/broker/detail/native_socket.hh similarity index 100% rename from include/broker/detail/native_socket.hh rename to libbroker/broker/detail/native_socket.hh diff --git a/include/broker/detail/next_tick.hh b/libbroker/broker/detail/next_tick.hh similarity index 100% rename from include/broker/detail/next_tick.hh rename to libbroker/broker/detail/next_tick.hh diff --git a/src/detail/opaque_type.cc b/libbroker/broker/detail/opaque_type.cc similarity index 100% rename from src/detail/opaque_type.cc rename to libbroker/broker/detail/opaque_type.cc diff --git a/include/broker/detail/opaque_type.hh b/libbroker/broker/detail/opaque_type.hh similarity index 100% rename from include/broker/detail/opaque_type.hh rename to libbroker/broker/detail/opaque_type.hh diff --git a/include/broker/detail/operators.hh b/libbroker/broker/detail/operators.hh similarity index 100% rename from include/broker/detail/operators.hh rename to libbroker/broker/detail/operators.hh diff --git a/include/broker/detail/overload.hh b/libbroker/broker/detail/overload.hh similarity index 100% rename from include/broker/detail/overload.hh rename to libbroker/broker/detail/overload.hh diff --git a/src/detail/peer_status_map.cc b/libbroker/broker/detail/peer_status_map.cc similarity index 100% rename from src/detail/peer_status_map.cc rename to libbroker/broker/detail/peer_status_map.cc diff --git a/include/broker/detail/peer_status_map.hh b/libbroker/broker/detail/peer_status_map.hh similarity index 100% rename from include/broker/detail/peer_status_map.hh rename to libbroker/broker/detail/peer_status_map.hh diff --git a/tests/cpp/detail/peer_status_map.cc b/libbroker/broker/detail/peer_status_map.test.cc similarity index 95% rename from tests/cpp/detail/peer_status_map.cc rename to libbroker/broker/detail/peer_status_map.test.cc index 981704e3f..9e3a3f89d 100644 --- a/tests/cpp/detail/peer_status_map.cc +++ b/libbroker/broker/detail/peer_status_map.test.cc @@ -1,8 +1,6 @@ -#define SUITE detail.peer_status_map - #include "broker/detail/peer_status_map.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" using namespace broker; diff --git a/include/broker/detail/pp.hh b/libbroker/broker/detail/pp.hh similarity index 100% rename from include/broker/detail/pp.hh rename to libbroker/broker/detail/pp.hh diff --git a/src/detail/prefix_matcher.cc b/libbroker/broker/detail/prefix_matcher.cc similarity index 100% rename from src/detail/prefix_matcher.cc rename to libbroker/broker/detail/prefix_matcher.cc diff --git a/include/broker/detail/prefix_matcher.hh b/libbroker/broker/detail/prefix_matcher.hh similarity index 100% rename from include/broker/detail/prefix_matcher.hh rename to libbroker/broker/detail/prefix_matcher.hh diff --git a/include/broker/detail/promote.hh b/libbroker/broker/detail/promote.hh similarity index 100% rename from include/broker/detail/promote.hh rename to libbroker/broker/detail/promote.hh diff --git a/include/broker/detail/radix_tree.hh b/libbroker/broker/detail/radix_tree.hh similarity index 100% rename from include/broker/detail/radix_tree.hh rename to libbroker/broker/detail/radix_tree.hh diff --git a/src/detail/sink_driver.cc b/libbroker/broker/detail/sink_driver.cc similarity index 100% rename from src/detail/sink_driver.cc rename to libbroker/broker/detail/sink_driver.cc diff --git a/include/broker/detail/sink_driver.hh b/libbroker/broker/detail/sink_driver.hh similarity index 100% rename from include/broker/detail/sink_driver.hh rename to libbroker/broker/detail/sink_driver.hh diff --git a/src/detail/source_driver.cc b/libbroker/broker/detail/source_driver.cc similarity index 100% rename from src/detail/source_driver.cc rename to libbroker/broker/detail/source_driver.cc diff --git a/include/broker/detail/source_driver.hh b/libbroker/broker/detail/source_driver.hh similarity index 100% rename from include/broker/detail/source_driver.hh rename to libbroker/broker/detail/source_driver.hh diff --git a/src/detail/sqlite_backend.cc b/libbroker/broker/detail/sqlite_backend.cc similarity index 100% rename from src/detail/sqlite_backend.cc rename to libbroker/broker/detail/sqlite_backend.cc diff --git a/include/broker/detail/sqlite_backend.hh b/libbroker/broker/detail/sqlite_backend.hh similarity index 100% rename from include/broker/detail/sqlite_backend.hh rename to libbroker/broker/detail/sqlite_backend.hh diff --git a/src/detail/store_state.cc b/libbroker/broker/detail/store_state.cc similarity index 100% rename from src/detail/store_state.cc rename to libbroker/broker/detail/store_state.cc diff --git a/include/broker/detail/store_state.hh b/libbroker/broker/detail/store_state.hh similarity index 100% rename from include/broker/detail/store_state.hh rename to libbroker/broker/detail/store_state.hh diff --git a/include/broker/detail/type_traits.hh b/libbroker/broker/detail/type_traits.hh similarity index 100% rename from include/broker/detail/type_traits.hh rename to libbroker/broker/detail/type_traits.hh diff --git a/src/domain_options.cc b/libbroker/broker/domain_options.cc similarity index 100% rename from src/domain_options.cc rename to libbroker/broker/domain_options.cc diff --git a/include/broker/domain_options.hh b/libbroker/broker/domain_options.hh similarity index 100% rename from include/broker/domain_options.hh rename to libbroker/broker/domain_options.hh diff --git a/tests/cpp/domain_options.cc b/libbroker/broker/domain_options.test.cc similarity index 92% rename from tests/cpp/domain_options.cc rename to libbroker/broker/domain_options.test.cc index 72e920730..4006ea4f1 100644 --- a/tests/cpp/domain_options.cc +++ b/libbroker/broker/domain_options.test.cc @@ -1,8 +1,6 @@ -#define SUITE domain_options - #include "broker/domain_options.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/endpoint.cc b/libbroker/broker/endpoint.cc similarity index 100% rename from src/endpoint.cc rename to libbroker/broker/endpoint.cc diff --git a/include/broker/endpoint.hh b/libbroker/broker/endpoint.hh similarity index 100% rename from include/broker/endpoint.hh rename to libbroker/broker/endpoint.hh diff --git a/src/endpoint_id.cc b/libbroker/broker/endpoint_id.cc similarity index 100% rename from src/endpoint_id.cc rename to libbroker/broker/endpoint_id.cc diff --git a/include/broker/endpoint_id.hh b/libbroker/broker/endpoint_id.hh similarity index 100% rename from include/broker/endpoint_id.hh rename to libbroker/broker/endpoint_id.hh diff --git a/src/endpoint_info.cc b/libbroker/broker/endpoint_info.cc similarity index 100% rename from src/endpoint_info.cc rename to libbroker/broker/endpoint_info.cc diff --git a/include/broker/endpoint_info.hh b/libbroker/broker/endpoint_info.hh similarity index 100% rename from include/broker/endpoint_info.hh rename to libbroker/broker/endpoint_info.hh diff --git a/src/entity_id.cc b/libbroker/broker/entity_id.cc similarity index 100% rename from src/entity_id.cc rename to libbroker/broker/entity_id.cc diff --git a/include/broker/entity_id.hh b/libbroker/broker/entity_id.hh similarity index 100% rename from include/broker/entity_id.hh rename to libbroker/broker/entity_id.hh diff --git a/include/broker/enum_value.hh b/libbroker/broker/enum_value.hh similarity index 100% rename from include/broker/enum_value.hh rename to libbroker/broker/enum_value.hh diff --git a/src/envelope.cc b/libbroker/broker/envelope.cc similarity index 100% rename from src/envelope.cc rename to libbroker/broker/envelope.cc diff --git a/include/broker/envelope.hh b/libbroker/broker/envelope.hh similarity index 100% rename from include/broker/envelope.hh rename to libbroker/broker/envelope.hh diff --git a/src/error.cc b/libbroker/broker/error.cc similarity index 100% rename from src/error.cc rename to libbroker/broker/error.cc diff --git a/include/broker/error.hh b/libbroker/broker/error.hh similarity index 100% rename from include/broker/error.hh rename to libbroker/broker/error.hh diff --git a/tests/cpp/error.cc b/libbroker/broker/error.test.cc similarity index 99% rename from tests/cpp/error.cc rename to libbroker/broker/error.test.cc index db499c66f..a09449fcc 100644 --- a/tests/cpp/error.cc +++ b/libbroker/broker/error.test.cc @@ -1,8 +1,6 @@ -#define SUITE error - #include "broker/error.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/internal/native.hh" diff --git a/include/broker/expected.hh b/libbroker/broker/expected.hh similarity index 100% rename from include/broker/expected.hh rename to libbroker/broker/expected.hh diff --git a/src/filter_type.cc b/libbroker/broker/filter_type.cc similarity index 100% rename from src/filter_type.cc rename to libbroker/broker/filter_type.cc diff --git a/include/broker/filter_type.hh b/libbroker/broker/filter_type.hh similarity index 100% rename from include/broker/filter_type.hh rename to libbroker/broker/filter_type.hh diff --git a/tests/cpp/filter_type.cc b/libbroker/broker/filter_type.test.cc similarity index 95% rename from tests/cpp/filter_type.cc rename to libbroker/broker/filter_type.test.cc index c3833be21..163d74f1b 100644 --- a/tests/cpp/filter_type.cc +++ b/libbroker/broker/filter_type.test.cc @@ -1,8 +1,6 @@ -#define SUITE filter - #include "broker/filter_type.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" using namespace broker; diff --git a/src/format/bin.cc b/libbroker/broker/format/bin.cc similarity index 100% rename from src/format/bin.cc rename to libbroker/broker/format/bin.cc diff --git a/include/broker/format/bin.hh b/libbroker/broker/format/bin.hh similarity index 100% rename from include/broker/format/bin.hh rename to libbroker/broker/format/bin.hh diff --git a/tests/cpp/format/bin.cc b/libbroker/broker/format/bin.test.cc similarity index 99% rename from tests/cpp/format/bin.cc rename to libbroker/broker/format/bin.test.cc index b979ac3a2..c0246c0d4 100644 --- a/tests/cpp/format/bin.cc +++ b/libbroker/broker/format/bin.test.cc @@ -1,8 +1,6 @@ -#define SUITE format.bin - #include "broker/format/bin.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/internal_command.hh" diff --git a/src/format/json.cc b/libbroker/broker/format/json.cc similarity index 100% rename from src/format/json.cc rename to libbroker/broker/format/json.cc diff --git a/include/broker/format/json.hh b/libbroker/broker/format/json.hh similarity index 100% rename from include/broker/format/json.hh rename to libbroker/broker/format/json.hh diff --git a/tests/cpp/format/json.cc b/libbroker/broker/format/json.test.cc similarity index 99% rename from tests/cpp/format/json.cc rename to libbroker/broker/format/json.test.cc index 125cff393..e6a5549fb 100644 --- a/tests/cpp/format/json.cc +++ b/libbroker/broker/format/json.test.cc @@ -1,8 +1,6 @@ -#define SUITE format.json - #include "broker/format/json.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" using namespace broker; using namespace std::literals; diff --git a/include/broker/format/txt.hh b/libbroker/broker/format/txt.hh similarity index 100% rename from include/broker/format/txt.hh rename to libbroker/broker/format/txt.hh diff --git a/include/broker/frontend.hh b/libbroker/broker/frontend.hh similarity index 100% rename from include/broker/frontend.hh rename to libbroker/broker/frontend.hh diff --git a/include/broker/fwd.hh b/libbroker/broker/fwd.hh similarity index 100% rename from include/broker/fwd.hh rename to libbroker/broker/fwd.hh diff --git a/src/gateway.cc b/libbroker/broker/gateway.cc similarity index 100% rename from src/gateway.cc rename to libbroker/broker/gateway.cc diff --git a/tests/cpp/integration.cc b/libbroker/broker/integration.test.cc similarity index 99% rename from tests/cpp/integration.cc rename to libbroker/broker/integration.test.cc index c6e8c7ff3..9fc77b6a1 100644 --- a/tests/cpp/integration.cc +++ b/libbroker/broker/integration.test.cc @@ -3,9 +3,7 @@ // system always consists of at least three nodes. Messages are not checked // individually. Rather, the system runs to a predetermined point before // checking for an expected outcome. -#define SUITE integration - -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/internal/README.md b/libbroker/broker/internal/README.md similarity index 100% rename from include/broker/internal/README.md rename to libbroker/broker/internal/README.md diff --git a/include/broker/internal/channel.hh b/libbroker/broker/internal/channel.hh similarity index 100% rename from include/broker/internal/channel.hh rename to libbroker/broker/internal/channel.hh diff --git a/tests/cpp/internal/channel.cc b/libbroker/broker/internal/channel.test.cc similarity index 99% rename from tests/cpp/internal/channel.cc rename to libbroker/broker/internal/channel.test.cc index 4638721c2..f9e3b9609 100644 --- a/tests/cpp/internal/channel.cc +++ b/libbroker/broker/internal/channel.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.channel - #include "broker/internal/channel.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/internal/clone_actor.cc b/libbroker/broker/internal/clone_actor.cc similarity index 100% rename from src/internal/clone_actor.cc rename to libbroker/broker/internal/clone_actor.cc diff --git a/include/broker/internal/clone_actor.hh b/libbroker/broker/internal/clone_actor.hh similarity index 100% rename from include/broker/internal/clone_actor.hh rename to libbroker/broker/internal/clone_actor.hh diff --git a/include/broker/internal/configuration_access.hh b/libbroker/broker/internal/configuration_access.hh similarity index 100% rename from include/broker/internal/configuration_access.hh rename to libbroker/broker/internal/configuration_access.hh diff --git a/src/internal/connector.cc b/libbroker/broker/internal/connector.cc similarity index 100% rename from src/internal/connector.cc rename to libbroker/broker/internal/connector.cc diff --git a/include/broker/internal/connector.hh b/libbroker/broker/internal/connector.hh similarity index 100% rename from include/broker/internal/connector.hh rename to libbroker/broker/internal/connector.hh diff --git a/src/internal/connector_adapter.cc b/libbroker/broker/internal/connector_adapter.cc similarity index 100% rename from src/internal/connector_adapter.cc rename to libbroker/broker/internal/connector_adapter.cc diff --git a/include/broker/internal/connector_adapter.hh b/libbroker/broker/internal/connector_adapter.hh similarity index 100% rename from include/broker/internal/connector_adapter.hh rename to libbroker/broker/internal/connector_adapter.hh diff --git a/src/internal/core_actor.cc b/libbroker/broker/internal/core_actor.cc similarity index 100% rename from src/internal/core_actor.cc rename to libbroker/broker/internal/core_actor.cc diff --git a/include/broker/internal/core_actor.hh b/libbroker/broker/internal/core_actor.hh similarity index 100% rename from include/broker/internal/core_actor.hh rename to libbroker/broker/internal/core_actor.hh diff --git a/tests/cpp/internal/core_actor.cc b/libbroker/broker/internal/core_actor.test.cc similarity index 98% rename from tests/cpp/internal/core_actor.cc rename to libbroker/broker/internal/core_actor.test.cc index 3256629f4..08ef26920 100644 --- a/tests/cpp/internal/core_actor.cc +++ b/libbroker/broker/internal/core_actor.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.core_actor - #include "broker/internal/core_actor.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/internal/core_recorder.cc b/libbroker/broker/internal/core_recorder.cc similarity index 100% rename from src/internal/core_recorder.cc rename to libbroker/broker/internal/core_recorder.cc diff --git a/include/broker/internal/core_recorder.hh b/libbroker/broker/internal/core_recorder.hh similarity index 100% rename from include/broker/internal/core_recorder.hh rename to libbroker/broker/internal/core_recorder.hh diff --git a/src/internal/data_generator.cc b/libbroker/broker/internal/data_generator.cc similarity index 100% rename from src/internal/data_generator.cc rename to libbroker/broker/internal/data_generator.cc diff --git a/include/broker/internal/data_generator.hh b/libbroker/broker/internal/data_generator.hh similarity index 100% rename from include/broker/internal/data_generator.hh rename to libbroker/broker/internal/data_generator.hh diff --git a/tests/cpp/internal/data_generator.cc b/libbroker/broker/internal/data_generator.test.cc similarity index 99% rename from tests/cpp/internal/data_generator.cc rename to libbroker/broker/internal/data_generator.test.cc index ba11e8bb7..d7a2cbad3 100644 --- a/tests/cpp/internal/data_generator.cc +++ b/libbroker/broker/internal/data_generator.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.data_generator - #include "broker/internal/data_generator.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/internal/endpoint_access.hh b/libbroker/broker/internal/endpoint_access.hh similarity index 100% rename from include/broker/internal/endpoint_access.hh rename to libbroker/broker/internal/endpoint_access.hh diff --git a/src/internal/flare_actor.cc b/libbroker/broker/internal/flare_actor.cc similarity index 100% rename from src/internal/flare_actor.cc rename to libbroker/broker/internal/flare_actor.cc diff --git a/include/broker/internal/flare_actor.hh b/libbroker/broker/internal/flare_actor.hh similarity index 100% rename from include/broker/internal/flare_actor.hh rename to libbroker/broker/internal/flare_actor.hh diff --git a/include/broker/internal/flow_scope.hh b/libbroker/broker/internal/flow_scope.hh similarity index 100% rename from include/broker/internal/flow_scope.hh rename to libbroker/broker/internal/flow_scope.hh diff --git a/include/broker/internal/fwd.hh b/libbroker/broker/internal/fwd.hh similarity index 100% rename from include/broker/internal/fwd.hh rename to libbroker/broker/internal/fwd.hh diff --git a/src/internal/generator_file_reader.cc b/libbroker/broker/internal/generator_file_reader.cc similarity index 100% rename from src/internal/generator_file_reader.cc rename to libbroker/broker/internal/generator_file_reader.cc diff --git a/include/broker/internal/generator_file_reader.hh b/libbroker/broker/internal/generator_file_reader.hh similarity index 100% rename from include/broker/internal/generator_file_reader.hh rename to libbroker/broker/internal/generator_file_reader.hh diff --git a/src/internal/generator_file_writer.cc b/libbroker/broker/internal/generator_file_writer.cc similarity index 100% rename from src/internal/generator_file_writer.cc rename to libbroker/broker/internal/generator_file_writer.cc diff --git a/include/broker/internal/generator_file_writer.hh b/libbroker/broker/internal/generator_file_writer.hh similarity index 100% rename from include/broker/internal/generator_file_writer.hh rename to libbroker/broker/internal/generator_file_writer.hh diff --git a/tests/cpp/internal/generator_file_writer.cc b/libbroker/broker/internal/generator_file_writer.test.cc similarity index 97% rename from tests/cpp/internal/generator_file_writer.cc rename to libbroker/broker/internal/generator_file_writer.test.cc index e3ccb2f5e..f59c59fc5 100644 --- a/tests/cpp/internal/generator_file_writer.cc +++ b/libbroker/broker/internal/generator_file_writer.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.generator_file_writer - #include "broker/internal/generator_file_writer.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/detail/filesystem.hh" #include "broker/internal/generator_file_reader.hh" diff --git a/src/internal/json.cc b/libbroker/broker/internal/json.cc similarity index 100% rename from src/internal/json.cc rename to libbroker/broker/internal/json.cc diff --git a/include/broker/internal/json.hh b/libbroker/broker/internal/json.hh similarity index 100% rename from include/broker/internal/json.hh rename to libbroker/broker/internal/json.hh diff --git a/tests/cpp/internal/json.cc b/libbroker/broker/internal/json.test.cc similarity index 98% rename from tests/cpp/internal/json.cc rename to libbroker/broker/internal/json.test.cc index 394b834c3..6227ad9b1 100644 --- a/tests/cpp/internal/json.cc +++ b/libbroker/broker/internal/json.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.json - #include "broker/internal/json.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/internal/json_client.cc b/libbroker/broker/internal/json_client.cc similarity index 100% rename from src/internal/json_client.cc rename to libbroker/broker/internal/json_client.cc diff --git a/include/broker/internal/json_client.hh b/libbroker/broker/internal/json_client.hh similarity index 100% rename from include/broker/internal/json_client.hh rename to libbroker/broker/internal/json_client.hh diff --git a/src/internal/json_type_mapper.cc b/libbroker/broker/internal/json_type_mapper.cc similarity index 100% rename from src/internal/json_type_mapper.cc rename to libbroker/broker/internal/json_type_mapper.cc diff --git a/include/broker/internal/json_type_mapper.hh b/libbroker/broker/internal/json_type_mapper.hh similarity index 100% rename from include/broker/internal/json_type_mapper.hh rename to libbroker/broker/internal/json_type_mapper.hh diff --git a/tests/cpp/internal/json_type_mapper.cc b/libbroker/broker/internal/json_type_mapper.test.cc similarity index 98% rename from tests/cpp/internal/json_type_mapper.cc rename to libbroker/broker/internal/json_type_mapper.test.cc index 10adb7834..fa2d26a99 100644 --- a/tests/cpp/internal/json_type_mapper.cc +++ b/libbroker/broker/internal/json_type_mapper.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.json_type_mapper - #include "broker/internal/json_type_mapper.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/internal/killswitch.hh b/libbroker/broker/internal/killswitch.hh similarity index 100% rename from include/broker/internal/killswitch.hh rename to libbroker/broker/internal/killswitch.hh diff --git a/include/broker/internal/logger.hh b/libbroker/broker/internal/logger.hh similarity index 100% rename from include/broker/internal/logger.hh rename to libbroker/broker/internal/logger.hh diff --git a/src/internal/master_actor.cc b/libbroker/broker/internal/master_actor.cc similarity index 100% rename from src/internal/master_actor.cc rename to libbroker/broker/internal/master_actor.cc diff --git a/include/broker/internal/master_actor.hh b/libbroker/broker/internal/master_actor.hh similarity index 100% rename from include/broker/internal/master_actor.hh rename to libbroker/broker/internal/master_actor.hh diff --git a/src/internal/master_resolver.cc b/libbroker/broker/internal/master_resolver.cc similarity index 100% rename from src/internal/master_resolver.cc rename to libbroker/broker/internal/master_resolver.cc diff --git a/include/broker/internal/master_resolver.hh b/libbroker/broker/internal/master_resolver.hh similarity index 100% rename from include/broker/internal/master_resolver.hh rename to libbroker/broker/internal/master_resolver.hh diff --git a/src/internal/meta_command_writer.cc b/libbroker/broker/internal/meta_command_writer.cc similarity index 100% rename from src/internal/meta_command_writer.cc rename to libbroker/broker/internal/meta_command_writer.cc diff --git a/include/broker/internal/meta_command_writer.hh b/libbroker/broker/internal/meta_command_writer.hh similarity index 100% rename from include/broker/internal/meta_command_writer.hh rename to libbroker/broker/internal/meta_command_writer.hh diff --git a/tests/cpp/internal/meta_command_writer.cc b/libbroker/broker/internal/meta_command_writer.test.cc similarity index 98% rename from tests/cpp/internal/meta_command_writer.cc rename to libbroker/broker/internal/meta_command_writer.test.cc index 97c87b55b..bd5e9488a 100644 --- a/tests/cpp/internal/meta_command_writer.cc +++ b/libbroker/broker/internal/meta_command_writer.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.meta_command_writer - #include "broker/internal/meta_command_writer.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/data.hh" #include "broker/internal/read_value.hh" diff --git a/src/internal/meta_data_writer.cc b/libbroker/broker/internal/meta_data_writer.cc similarity index 100% rename from src/internal/meta_data_writer.cc rename to libbroker/broker/internal/meta_data_writer.cc diff --git a/include/broker/internal/meta_data_writer.hh b/libbroker/broker/internal/meta_data_writer.hh similarity index 100% rename from include/broker/internal/meta_data_writer.hh rename to libbroker/broker/internal/meta_data_writer.hh diff --git a/tests/cpp/internal/meta_data_writer.cc b/libbroker/broker/internal/meta_data_writer.test.cc similarity index 99% rename from tests/cpp/internal/meta_data_writer.cc rename to libbroker/broker/internal/meta_data_writer.test.cc index 007a8df89..0d752b9c1 100644 --- a/tests/cpp/internal/meta_data_writer.cc +++ b/libbroker/broker/internal/meta_data_writer.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.meta_data_writer - #include "broker/internal/meta_data_writer.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/internal/metric_collector.cc b/libbroker/broker/internal/metric_collector.cc similarity index 100% rename from src/internal/metric_collector.cc rename to libbroker/broker/internal/metric_collector.cc diff --git a/include/broker/internal/metric_collector.hh b/libbroker/broker/internal/metric_collector.hh similarity index 100% rename from include/broker/internal/metric_collector.hh rename to libbroker/broker/internal/metric_collector.hh diff --git a/tests/cpp/internal/metric_collector.cc b/libbroker/broker/internal/metric_collector.test.cc similarity index 99% rename from tests/cpp/internal/metric_collector.cc rename to libbroker/broker/internal/metric_collector.test.cc index 0c4a6b079..562fab98f 100644 --- a/tests/cpp/internal/metric_collector.cc +++ b/libbroker/broker/internal/metric_collector.test.cc @@ -1,8 +1,6 @@ -#define SUITE metric_collector - #include "broker/internal/metric_collector.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/internal/metric_exporter.hh" diff --git a/src/internal/metric_exporter.cc b/libbroker/broker/internal/metric_exporter.cc similarity index 100% rename from src/internal/metric_exporter.cc rename to libbroker/broker/internal/metric_exporter.cc diff --git a/include/broker/internal/metric_exporter.hh b/libbroker/broker/internal/metric_exporter.hh similarity index 100% rename from include/broker/internal/metric_exporter.hh rename to libbroker/broker/internal/metric_exporter.hh diff --git a/tests/cpp/internal/metric_exporter.cc b/libbroker/broker/internal/metric_exporter.test.cc similarity index 99% rename from tests/cpp/internal/metric_exporter.cc rename to libbroker/broker/internal/metric_exporter.test.cc index 660d1a853..3f5208e25 100644 --- a/tests/cpp/internal/metric_exporter.cc +++ b/libbroker/broker/internal/metric_exporter.test.cc @@ -1,8 +1,6 @@ -#define SUITE metric_exporter - #include "broker/internal/metric_exporter.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/internal/metric_view.hh" diff --git a/src/internal/metric_factory.cc b/libbroker/broker/internal/metric_factory.cc similarity index 100% rename from src/internal/metric_factory.cc rename to libbroker/broker/internal/metric_factory.cc diff --git a/include/broker/internal/metric_factory.hh b/libbroker/broker/internal/metric_factory.hh similarity index 100% rename from include/broker/internal/metric_factory.hh rename to libbroker/broker/internal/metric_factory.hh diff --git a/src/internal/metric_scraper.cc b/libbroker/broker/internal/metric_scraper.cc similarity index 100% rename from src/internal/metric_scraper.cc rename to libbroker/broker/internal/metric_scraper.cc diff --git a/include/broker/internal/metric_scraper.hh b/libbroker/broker/internal/metric_scraper.hh similarity index 100% rename from include/broker/internal/metric_scraper.hh rename to libbroker/broker/internal/metric_scraper.hh diff --git a/src/internal/metric_view.cc b/libbroker/broker/internal/metric_view.cc similarity index 100% rename from src/internal/metric_view.cc rename to libbroker/broker/internal/metric_view.cc diff --git a/include/broker/internal/metric_view.hh b/libbroker/broker/internal/metric_view.hh similarity index 100% rename from include/broker/internal/metric_view.hh rename to libbroker/broker/internal/metric_view.hh diff --git a/include/broker/internal/native.hh b/libbroker/broker/internal/native.hh similarity index 100% rename from include/broker/internal/native.hh rename to libbroker/broker/internal/native.hh diff --git a/include/broker/internal/peer_filter.hh b/libbroker/broker/internal/peer_filter.hh similarity index 100% rename from include/broker/internal/peer_filter.hh rename to libbroker/broker/internal/peer_filter.hh diff --git a/src/internal/peering.cc b/libbroker/broker/internal/peering.cc similarity index 100% rename from src/internal/peering.cc rename to libbroker/broker/internal/peering.cc diff --git a/include/broker/internal/peering.hh b/libbroker/broker/internal/peering.hh similarity index 100% rename from include/broker/internal/peering.hh rename to libbroker/broker/internal/peering.hh diff --git a/src/internal/pending_connection.cc b/libbroker/broker/internal/pending_connection.cc similarity index 100% rename from src/internal/pending_connection.cc rename to libbroker/broker/internal/pending_connection.cc diff --git a/include/broker/internal/pending_connection.hh b/libbroker/broker/internal/pending_connection.hh similarity index 100% rename from include/broker/internal/pending_connection.hh rename to libbroker/broker/internal/pending_connection.hh diff --git a/src/internal/println.cc b/libbroker/broker/internal/println.cc similarity index 100% rename from src/internal/println.cc rename to libbroker/broker/internal/println.cc diff --git a/include/broker/internal/println.hh b/libbroker/broker/internal/println.hh similarity index 100% rename from include/broker/internal/println.hh rename to libbroker/broker/internal/println.hh diff --git a/src/internal/prometheus.cc b/libbroker/broker/internal/prometheus.cc similarity index 100% rename from src/internal/prometheus.cc rename to libbroker/broker/internal/prometheus.cc diff --git a/include/broker/internal/prometheus.hh b/libbroker/broker/internal/prometheus.hh similarity index 100% rename from include/broker/internal/prometheus.hh rename to libbroker/broker/internal/prometheus.hh diff --git a/include/broker/internal/read_value.hh b/libbroker/broker/internal/read_value.hh similarity index 100% rename from include/broker/internal/read_value.hh rename to libbroker/broker/internal/read_value.hh diff --git a/include/broker/internal/retry_state.hh b/libbroker/broker/internal/retry_state.hh similarity index 100% rename from include/broker/internal/retry_state.hh rename to libbroker/broker/internal/retry_state.hh diff --git a/src/internal/store_actor.cc b/libbroker/broker/internal/store_actor.cc similarity index 100% rename from src/internal/store_actor.cc rename to libbroker/broker/internal/store_actor.cc diff --git a/include/broker/internal/store_actor.hh b/libbroker/broker/internal/store_actor.hh similarity index 100% rename from include/broker/internal/store_actor.hh rename to libbroker/broker/internal/store_actor.hh diff --git a/include/broker/internal/type_id.hh b/libbroker/broker/internal/type_id.hh similarity index 100% rename from include/broker/internal/type_id.hh rename to libbroker/broker/internal/type_id.hh diff --git a/src/internal/web_socket.cc b/libbroker/broker/internal/web_socket.cc similarity index 100% rename from src/internal/web_socket.cc rename to libbroker/broker/internal/web_socket.cc diff --git a/include/broker/internal/web_socket.hh b/libbroker/broker/internal/web_socket.hh similarity index 100% rename from include/broker/internal/web_socket.hh rename to libbroker/broker/internal/web_socket.hh diff --git a/src/internal/wire_format.cc b/libbroker/broker/internal/wire_format.cc similarity index 100% rename from src/internal/wire_format.cc rename to libbroker/broker/internal/wire_format.cc diff --git a/include/broker/internal/wire_format.hh b/libbroker/broker/internal/wire_format.hh similarity index 100% rename from include/broker/internal/wire_format.hh rename to libbroker/broker/internal/wire_format.hh diff --git a/tests/cpp/internal/wire_format.cc b/libbroker/broker/internal/wire_format.test.cc similarity index 97% rename from tests/cpp/internal/wire_format.cc rename to libbroker/broker/internal/wire_format.test.cc index 8965e6b9a..f7ccbbf6c 100644 --- a/tests/cpp/internal/wire_format.cc +++ b/libbroker/broker/internal/wire_format.test.cc @@ -1,8 +1,6 @@ -#define SUITE internal.wire_format - #include "broker/internal/wire_format.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/command_envelope.hh" #include "broker/envelope.hh" diff --git a/include/broker/internal/with_native_labels.hh b/libbroker/broker/internal/with_native_labels.hh similarity index 100% rename from include/broker/internal/with_native_labels.hh rename to libbroker/broker/internal/with_native_labels.hh diff --git a/include/broker/internal/write_value.hh b/libbroker/broker/internal/write_value.hh similarity index 100% rename from include/broker/internal/write_value.hh rename to libbroker/broker/internal/write_value.hh diff --git a/src/internal_command.cc b/libbroker/broker/internal_command.cc similarity index 100% rename from src/internal_command.cc rename to libbroker/broker/internal_command.cc diff --git a/include/broker/internal_command.hh b/libbroker/broker/internal_command.hh similarity index 100% rename from include/broker/internal_command.hh rename to libbroker/broker/internal_command.hh diff --git a/include/broker/intrusive_ptr.hh b/libbroker/broker/intrusive_ptr.hh similarity index 100% rename from include/broker/intrusive_ptr.hh rename to libbroker/broker/intrusive_ptr.hh diff --git a/include/broker/lamport_timestamp.hh b/libbroker/broker/lamport_timestamp.hh similarity index 100% rename from include/broker/lamport_timestamp.hh rename to libbroker/broker/lamport_timestamp.hh diff --git a/src/mailbox.cc b/libbroker/broker/mailbox.cc similarity index 100% rename from src/mailbox.cc rename to libbroker/broker/mailbox.cc diff --git a/include/broker/mailbox.hh b/libbroker/broker/mailbox.hh similarity index 100% rename from include/broker/mailbox.hh rename to libbroker/broker/mailbox.hh diff --git a/tests/cpp/master.cc b/libbroker/broker/master.test.cc similarity index 99% rename from tests/cpp/master.cc rename to libbroker/broker/master.test.cc index 5519d3135..9016586fd 100644 --- a/tests/cpp/master.cc +++ b/libbroker/broker/master.test.cc @@ -1,8 +1,6 @@ -#define SUITE master - #include "broker/store.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/message.hh b/libbroker/broker/message.hh similarity index 100% rename from include/broker/message.hh rename to libbroker/broker/message.hh diff --git a/src/network_info.cc b/libbroker/broker/network_info.cc similarity index 100% rename from src/network_info.cc rename to libbroker/broker/network_info.cc diff --git a/include/broker/network_info.hh b/libbroker/broker/network_info.hh similarity index 100% rename from include/broker/network_info.hh rename to libbroker/broker/network_info.hh diff --git a/include/broker/none.hh b/libbroker/broker/none.hh similarity index 100% rename from include/broker/none.hh rename to libbroker/broker/none.hh diff --git a/src/p2p_message_type.cc b/libbroker/broker/p2p_message_type.cc similarity index 100% rename from src/p2p_message_type.cc rename to libbroker/broker/p2p_message_type.cc diff --git a/include/broker/p2p_message_type.hh b/libbroker/broker/p2p_message_type.hh similarity index 100% rename from include/broker/p2p_message_type.hh rename to libbroker/broker/p2p_message_type.hh diff --git a/include/broker/peer_flags.hh b/libbroker/broker/peer_flags.hh similarity index 100% rename from include/broker/peer_flags.hh rename to libbroker/broker/peer_flags.hh diff --git a/include/broker/peer_info.hh b/libbroker/broker/peer_info.hh similarity index 100% rename from include/broker/peer_info.hh rename to libbroker/broker/peer_info.hh diff --git a/src/peer_status.cc b/libbroker/broker/peer_status.cc similarity index 100% rename from src/peer_status.cc rename to libbroker/broker/peer_status.cc diff --git a/include/broker/peer_status.hh b/libbroker/broker/peer_status.hh similarity index 100% rename from include/broker/peer_status.hh rename to libbroker/broker/peer_status.hh diff --git a/tests/cpp/system/peering.cc b/libbroker/broker/peering.test.cc similarity index 99% rename from tests/cpp/system/peering.cc rename to libbroker/broker/peering.test.cc index ff5983fd2..e84a9ee5e 100644 --- a/tests/cpp/system/peering.cc +++ b/libbroker/broker/peering.test.cc @@ -1,9 +1,7 @@ // Puts some stress on the peering logic by launching many peering request // simultaneously. -#define SUITE system.peering - -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/endpoint.hh" diff --git a/src/ping_envelope.cc b/libbroker/broker/ping_envelope.cc similarity index 100% rename from src/ping_envelope.cc rename to libbroker/broker/ping_envelope.cc diff --git a/include/broker/ping_envelope.hh b/libbroker/broker/ping_envelope.hh similarity index 100% rename from include/broker/ping_envelope.hh rename to libbroker/broker/ping_envelope.hh diff --git a/src/pong_envelope.cc b/libbroker/broker/pong_envelope.cc similarity index 100% rename from src/pong_envelope.cc rename to libbroker/broker/pong_envelope.cc diff --git a/include/broker/pong_envelope.hh b/libbroker/broker/pong_envelope.hh similarity index 100% rename from include/broker/pong_envelope.hh rename to libbroker/broker/pong_envelope.hh diff --git a/src/port.cc b/libbroker/broker/port.cc similarity index 100% rename from src/port.cc rename to libbroker/broker/port.cc diff --git a/include/broker/port.hh b/libbroker/broker/port.hh similarity index 100% rename from include/broker/port.hh rename to libbroker/broker/port.hh diff --git a/src/publisher.cc b/libbroker/broker/publisher.cc similarity index 100% rename from src/publisher.cc rename to libbroker/broker/publisher.cc diff --git a/include/broker/publisher.hh b/libbroker/broker/publisher.hh similarity index 100% rename from include/broker/publisher.hh rename to libbroker/broker/publisher.hh diff --git a/tests/cpp/publisher.cc b/libbroker/broker/publisher.test.cc similarity index 98% rename from tests/cpp/publisher.cc rename to libbroker/broker/publisher.test.cc index 202762ec7..6afaee645 100644 --- a/tests/cpp/publisher.cc +++ b/libbroker/broker/publisher.test.cc @@ -1,11 +1,9 @@ // This unit test is a variation of the `core` unit test that uses a // `publisher` instead of an event-based `driver` actor. -#define SUITE publisher - #include "broker/publisher.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/include/broker/publisher_id.hh b/libbroker/broker/publisher_id.hh similarity index 100% rename from include/broker/publisher_id.hh rename to libbroker/broker/publisher_id.hh diff --git a/tests/cpp/radix_tree.cc b/libbroker/broker/radix_tree.test.cc similarity index 99% rename from tests/cpp/radix_tree.cc rename to libbroker/broker/radix_tree.test.cc index 87f83be1d..5a195eab1 100644 --- a/tests/cpp/radix_tree.cc +++ b/libbroker/broker/radix_tree.test.cc @@ -1,8 +1,6 @@ -#define SUITE radix_tree - #include "broker/detail/radix_tree.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/routing_update_envelope.cc b/libbroker/broker/routing_update_envelope.cc similarity index 100% rename from src/routing_update_envelope.cc rename to libbroker/broker/routing_update_envelope.cc diff --git a/include/broker/routing_update_envelope.hh b/libbroker/broker/routing_update_envelope.hh similarity index 100% rename from include/broker/routing_update_envelope.hh rename to libbroker/broker/routing_update_envelope.hh diff --git a/tests/cpp/system/shutdown.cc b/libbroker/broker/shutdown.test.cc similarity index 99% rename from tests/cpp/system/shutdown.cc rename to libbroker/broker/shutdown.test.cc index 4637d2ea1..dd50eeaa0 100644 --- a/tests/cpp/system/shutdown.cc +++ b/libbroker/broker/shutdown.test.cc @@ -1,9 +1,7 @@ // Checks whether Broker instances shut down gracefully, i.e., Broker endpoints // ship queued events before closing remote connections. -#define SUITE system.shutdown - -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/endpoint.hh" diff --git a/src/shutdown_options.cc b/libbroker/broker/shutdown_options.cc similarity index 100% rename from src/shutdown_options.cc rename to libbroker/broker/shutdown_options.cc diff --git a/include/broker/shutdown_options.hh b/libbroker/broker/shutdown_options.hh similarity index 100% rename from include/broker/shutdown_options.hh rename to libbroker/broker/shutdown_options.hh diff --git a/include/broker/snapshot.hh b/libbroker/broker/snapshot.hh similarity index 100% rename from include/broker/snapshot.hh rename to libbroker/broker/snapshot.hh diff --git a/include/broker/span.hh b/libbroker/broker/span.hh similarity index 100% rename from include/broker/span.hh rename to libbroker/broker/span.hh diff --git a/src/status.cc b/libbroker/broker/status.cc similarity index 100% rename from src/status.cc rename to libbroker/broker/status.cc diff --git a/include/broker/status.hh b/libbroker/broker/status.hh similarity index 100% rename from include/broker/status.hh rename to libbroker/broker/status.hh diff --git a/tests/cpp/status.cc b/libbroker/broker/status.test.cc similarity index 98% rename from tests/cpp/status.cc rename to libbroker/broker/status.test.cc index f76ceb699..29d313a01 100644 --- a/tests/cpp/status.cc +++ b/libbroker/broker/status.test.cc @@ -1,8 +1,6 @@ -#define SUITE status - #include "broker/status.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/status_subscriber.cc b/libbroker/broker/status_subscriber.cc similarity index 100% rename from src/status_subscriber.cc rename to libbroker/broker/status_subscriber.cc diff --git a/include/broker/status_subscriber.hh b/libbroker/broker/status_subscriber.hh similarity index 100% rename from include/broker/status_subscriber.hh rename to libbroker/broker/status_subscriber.hh diff --git a/tests/cpp/status_subscriber.cc b/libbroker/broker/status_subscriber.test.cc similarity index 97% rename from tests/cpp/status_subscriber.cc rename to libbroker/broker/status_subscriber.test.cc index fbe87a520..87217bef1 100644 --- a/tests/cpp/status_subscriber.cc +++ b/libbroker/broker/status_subscriber.test.cc @@ -1,8 +1,6 @@ -#define SUITE status_subscriber - #include "broker/status_subscriber.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/store.cc b/libbroker/broker/store.cc similarity index 100% rename from src/store.cc rename to libbroker/broker/store.cc diff --git a/include/broker/store.hh b/libbroker/broker/store.hh similarity index 100% rename from include/broker/store.hh rename to libbroker/broker/store.hh diff --git a/tests/cpp/store.cc b/libbroker/broker/store.test.cc similarity index 98% rename from tests/cpp/store.cc rename to libbroker/broker/store.test.cc index 2caf1c458..2c9dd8650 100644 --- a/tests/cpp/store.cc +++ b/libbroker/broker/store.test.cc @@ -1,8 +1,6 @@ -#define SUITE store - #include "broker/store.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/store_event.cc b/libbroker/broker/store_event.cc similarity index 100% rename from src/store_event.cc rename to libbroker/broker/store_event.cc diff --git a/include/broker/store_event.hh b/libbroker/broker/store_event.hh similarity index 100% rename from include/broker/store_event.hh rename to libbroker/broker/store_event.hh diff --git a/tests/cpp/store_event.cc b/libbroker/broker/store_event.test.cc similarity index 99% rename from tests/cpp/store_event.cc rename to libbroker/broker/store_event.test.cc index 1a2c7ce1a..d772e3261 100644 --- a/tests/cpp/store_event.cc +++ b/libbroker/broker/store_event.test.cc @@ -1,8 +1,6 @@ -#define SUITE store_event - #include "broker/store_event.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/src/subnet.cc b/libbroker/broker/subnet.cc similarity index 100% rename from src/subnet.cc rename to libbroker/broker/subnet.cc diff --git a/include/broker/subnet.hh b/libbroker/broker/subnet.hh similarity index 100% rename from include/broker/subnet.hh rename to libbroker/broker/subnet.hh diff --git a/src/subscriber.cc b/libbroker/broker/subscriber.cc similarity index 100% rename from src/subscriber.cc rename to libbroker/broker/subscriber.cc diff --git a/include/broker/subscriber.hh b/libbroker/broker/subscriber.hh similarity index 100% rename from include/broker/subscriber.hh rename to libbroker/broker/subscriber.hh diff --git a/tests/cpp/subscriber.cc b/libbroker/broker/subscriber.test.cc similarity index 98% rename from tests/cpp/subscriber.cc rename to libbroker/broker/subscriber.test.cc index 6a7f0b785..7c90ee4cb 100644 --- a/tests/cpp/subscriber.cc +++ b/libbroker/broker/subscriber.test.cc @@ -1,11 +1,9 @@ // This unit test is a variation of the `core` unit test that uses a // `subscriber` instead of an event-based `consumer` actor. -#define SUITE subscriber - #include "broker/subscriber.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/telemetry/counter.cc b/libbroker/broker/telemetry/counter.cc similarity index 100% rename from src/telemetry/counter.cc rename to libbroker/broker/telemetry/counter.cc diff --git a/include/broker/telemetry/counter.hh b/libbroker/broker/telemetry/counter.hh similarity index 100% rename from include/broker/telemetry/counter.hh rename to libbroker/broker/telemetry/counter.hh diff --git a/include/broker/telemetry/fwd.hh b/libbroker/broker/telemetry/fwd.hh similarity index 100% rename from include/broker/telemetry/fwd.hh rename to libbroker/broker/telemetry/fwd.hh diff --git a/src/telemetry/gauge.cc b/libbroker/broker/telemetry/gauge.cc similarity index 100% rename from src/telemetry/gauge.cc rename to libbroker/broker/telemetry/gauge.cc diff --git a/include/broker/telemetry/gauge.hh b/libbroker/broker/telemetry/gauge.hh similarity index 100% rename from include/broker/telemetry/gauge.hh rename to libbroker/broker/telemetry/gauge.hh diff --git a/src/telemetry/histogram.cc b/libbroker/broker/telemetry/histogram.cc similarity index 100% rename from src/telemetry/histogram.cc rename to libbroker/broker/telemetry/histogram.cc diff --git a/include/broker/telemetry/histogram.hh b/libbroker/broker/telemetry/histogram.hh similarity index 100% rename from include/broker/telemetry/histogram.hh rename to libbroker/broker/telemetry/histogram.hh diff --git a/tests/cpp/telemetry/histogram.cc b/libbroker/broker/telemetry/histogram.test.cc similarity index 98% rename from tests/cpp/telemetry/histogram.cc rename to libbroker/broker/telemetry/histogram.test.cc index bcdd8ee2b..3859a7c1c 100644 --- a/tests/cpp/telemetry/histogram.cc +++ b/libbroker/broker/telemetry/histogram.test.cc @@ -1,8 +1,6 @@ -#define SUITE telemetry.histogram - #include "broker/telemetry/histogram.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include "broker/telemetry/metric_registry.hh" diff --git a/src/telemetry/metric_family.cc b/libbroker/broker/telemetry/metric_family.cc similarity index 100% rename from src/telemetry/metric_family.cc rename to libbroker/broker/telemetry/metric_family.cc diff --git a/include/broker/telemetry/metric_family.hh b/libbroker/broker/telemetry/metric_family.hh similarity index 100% rename from include/broker/telemetry/metric_family.hh rename to libbroker/broker/telemetry/metric_family.hh diff --git a/src/telemetry/metric_registry.cc b/libbroker/broker/telemetry/metric_registry.cc similarity index 100% rename from src/telemetry/metric_registry.cc rename to libbroker/broker/telemetry/metric_registry.cc diff --git a/include/broker/telemetry/metric_registry.hh b/libbroker/broker/telemetry/metric_registry.hh similarity index 100% rename from include/broker/telemetry/metric_registry.hh rename to libbroker/broker/telemetry/metric_registry.hh diff --git a/src/telemetry/metric_registry_impl.cc b/libbroker/broker/telemetry/metric_registry_impl.cc similarity index 100% rename from src/telemetry/metric_registry_impl.cc rename to libbroker/broker/telemetry/metric_registry_impl.cc diff --git a/include/broker/telemetry/metric_registry_impl.hh b/libbroker/broker/telemetry/metric_registry_impl.hh similarity index 100% rename from include/broker/telemetry/metric_registry_impl.hh rename to libbroker/broker/telemetry/metric_registry_impl.hh diff --git a/src/time.cc b/libbroker/broker/time.cc similarity index 100% rename from src/time.cc rename to libbroker/broker/time.cc diff --git a/include/broker/time.hh b/libbroker/broker/time.hh similarity index 100% rename from include/broker/time.hh rename to libbroker/broker/time.hh diff --git a/include/broker/timeout.hh b/libbroker/broker/timeout.hh similarity index 100% rename from include/broker/timeout.hh rename to libbroker/broker/timeout.hh diff --git a/src/topic.cc b/libbroker/broker/topic.cc similarity index 100% rename from src/topic.cc rename to libbroker/broker/topic.cc diff --git a/include/broker/topic.hh b/libbroker/broker/topic.hh similarity index 100% rename from include/broker/topic.hh rename to libbroker/broker/topic.hh diff --git a/tests/cpp/topic.cc b/libbroker/broker/topic.test.cc similarity index 98% rename from tests/cpp/topic.cc rename to libbroker/broker/topic.test.cc index b7ef165e3..37661b58f 100644 --- a/tests/cpp/topic.cc +++ b/libbroker/broker/topic.test.cc @@ -1,8 +1,6 @@ -#define SUITE topic - #include "broker/topic.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" using namespace broker; diff --git a/src/variant.cc b/libbroker/broker/variant.cc similarity index 100% rename from src/variant.cc rename to libbroker/broker/variant.cc diff --git a/include/broker/variant.hh b/libbroker/broker/variant.hh similarity index 100% rename from include/broker/variant.hh rename to libbroker/broker/variant.hh diff --git a/tests/cpp/variant.cc b/libbroker/broker/variant.test.cc similarity index 99% rename from tests/cpp/variant.cc rename to libbroker/broker/variant.test.cc index c3deac997..ee3cc3d8b 100644 --- a/tests/cpp/variant.cc +++ b/libbroker/broker/variant.test.cc @@ -1,8 +1,6 @@ -#define SUITE variant - #include "broker/variant.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include #include diff --git a/src/variant_data.cc b/libbroker/broker/variant_data.cc similarity index 100% rename from src/variant_data.cc rename to libbroker/broker/variant_data.cc diff --git a/include/broker/variant_data.hh b/libbroker/broker/variant_data.hh similarity index 100% rename from include/broker/variant_data.hh rename to libbroker/broker/variant_data.hh diff --git a/src/variant_list.cc b/libbroker/broker/variant_list.cc similarity index 100% rename from src/variant_list.cc rename to libbroker/broker/variant_list.cc diff --git a/include/broker/variant_list.hh b/libbroker/broker/variant_list.hh similarity index 100% rename from include/broker/variant_list.hh rename to libbroker/broker/variant_list.hh diff --git a/src/variant_set.cc b/libbroker/broker/variant_set.cc similarity index 100% rename from src/variant_set.cc rename to libbroker/broker/variant_set.cc diff --git a/include/broker/variant_set.hh b/libbroker/broker/variant_set.hh similarity index 100% rename from include/broker/variant_set.hh rename to libbroker/broker/variant_set.hh diff --git a/src/variant_table.cc b/libbroker/broker/variant_table.cc similarity index 100% rename from src/variant_table.cc rename to libbroker/broker/variant_table.cc diff --git a/include/broker/variant_table.hh b/libbroker/broker/variant_table.hh similarity index 100% rename from include/broker/variant_table.hh rename to libbroker/broker/variant_table.hh diff --git a/src/variant_tag.cc b/libbroker/broker/variant_tag.cc similarity index 100% rename from src/variant_tag.cc rename to libbroker/broker/variant_tag.cc diff --git a/include/broker/variant_tag.hh b/libbroker/broker/variant_tag.hh similarity index 100% rename from include/broker/variant_tag.hh rename to libbroker/broker/variant_tag.hh diff --git a/src/version.cc b/libbroker/broker/version.cc similarity index 100% rename from src/version.cc rename to libbroker/broker/version.cc diff --git a/include/broker/version.hh b/libbroker/broker/version.hh similarity index 100% rename from include/broker/version.hh rename to libbroker/broker/version.hh diff --git a/include/broker/visit.hh b/libbroker/broker/visit.hh similarity index 100% rename from include/broker/visit.hh rename to libbroker/broker/visit.hh diff --git a/src/worker.cc b/libbroker/broker/worker.cc similarity index 100% rename from src/worker.cc rename to libbroker/broker/worker.cc diff --git a/include/broker/worker.hh b/libbroker/broker/worker.hh similarity index 100% rename from include/broker/worker.hh rename to libbroker/broker/worker.hh diff --git a/src/zeek.cc b/libbroker/broker/zeek.cc similarity index 100% rename from src/zeek.cc rename to libbroker/broker/zeek.cc diff --git a/include/broker/zeek.hh b/libbroker/broker/zeek.hh similarity index 100% rename from include/broker/zeek.hh rename to libbroker/broker/zeek.hh diff --git a/tests/cpp/zeek.cc b/libbroker/broker/zeek.test.cc similarity index 98% rename from tests/cpp/zeek.cc rename to libbroker/broker/zeek.test.cc index 3e1b67086..46070fc5e 100644 --- a/tests/cpp/zeek.cc +++ b/libbroker/broker/zeek.test.cc @@ -1,11 +1,9 @@ // We leave testing the actual communication with Zeek to Python tests. Here we // just check that the messages are constructed and parsed correctly. -#define SUITE zeek - #include "broker/zeek.hh" -#include "test.hh" +#include "broker/broker-test.test.hh" #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f0a6b628b..033996e41 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,108 +1,8 @@ -# -- Global test harness setup ------------------------------------------------ - -set(BROKER_TEST_TIMEOUT 60) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/cpp) - -# -- C++ ---------------------------------------------------------------------- - -set(tests - # cpp/integration.cc - # cpp/internal/data_generator.cc - # cpp/internal/generator_file_writer.cc - # cpp/internal/meta_command_writer.cc - # cpp/internal/meta_data_writer.cc - # cpp/ssl.cc - cpp/alm/multipath.cc - cpp/alm/routing_table.cc - cpp/backend.cc - cpp/builder.cc - cpp/data.cc - cpp/detail/peer_status_map.cc - cpp/format/bin.cc - cpp/format/json.cc - cpp/domain_options.cc - cpp/error.cc - cpp/filter_type.cc - cpp/internal/channel.cc - cpp/internal/core_actor.cc - cpp/internal/json.cc - cpp/internal/metric_collector.cc - cpp/internal/metric_exporter.cc - cpp/internal/wire_format.cc - cpp/master.cc - cpp/publisher.cc - cpp/radix_tree.cc - cpp/status.cc - cpp/status_subscriber.cc - cpp/store.cc - cpp/store_event.cc - cpp/subscriber.cc - cpp/system/peering.cc - cpp/system/shutdown.cc - cpp/telemetry/histogram.cc - cpp/test.cc - cpp/topic.cc - cpp/variant.cc - cpp/zeek.cc -) - -# Our sytem testing suites require `socketpair`, but Windows lacks this API. -if (NOT MSVC) - list(APPEND tests - cpp/system/shutdown.cc - ) -endif() - -add_executable(broker-test ${tests}) -target_link_libraries(broker-test PRIVATE ${BROKER_LIBRARY} CAF::test CAF::core CAF::net) - -set(BROKER_TEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -macro(make_cpp_test suite) - string(REPLACE " " "_" test_name ${suite}) - set(test_verbosity 4) - if (${test_name} STREQUAL radix_tree) - set(test_verbosity 3) # otherwise it just produces way too much output - endif () - add_test(NAME ${test_name} COMMAND broker-test -v ${test_verbosity} -s "^${suite}$" ${ARGN}) - set_tests_properties(${test_name} PROPERTIES TIMEOUT ${BROKER_TEST_TIMEOUT}) - set_tests_properties(${test_name} PROPERTIES ENVIRONMENT - "BROKER_TEST_DIR=${BROKER_TEST_DIR}") -endmacro() - -# Find all test suites. -foreach(test ${tests}) - file(STRINGS ${test} contents) - foreach(line ${contents}) - if ("${line}" MATCHES "SUITE") - string(REGEX REPLACE ".* SUITE (.*)" "\\1" suite ${line}) - list(APPEND suites ${suite}) - endif() - endforeach() -endforeach() -list(REMOVE_DUPLICATES suites) - -foreach(suite ${suites}) - make_cpp_test("${suite}") -endforeach () - # -- system tests via btest -------------------------------------------------- add_subdirectory(btest) -# -- Benchmark ---------------------------------------------------------------- - -add_executable(broker-benchmark benchmark/broker-benchmark.cc) -target_link_libraries(broker-benchmark ${BROKER_LIBRARY}) -install(TARGETS broker-benchmark DESTINATION bin) - -# add_executable(broker-fan-out benchmark/broker-fan-out.cc) -# target_link_libraries(broker-fan-out ${BROKER_LIBRARY}) - -# add_executable(broker-cluster-benchmark benchmark/broker-cluster-benchmark.cc) -# target_link_libraries(broker-cluster-benchmark ${libbroker} CAF::core CAF::openssl CAF::io) -# install(TARGETS broker-cluster-benchmark DESTINATION bin) +add_subdirectory(benchmarks) # -- Python ------------------------------------------------------------------- @@ -140,11 +40,3 @@ if (BROKER_PYTHON_BINDINGS) # # allow some extra time for the benchmark integration test # set_tests_properties(python-broker-cluster-benchmark PROPERTIES TIMEOUT 120) endif () - -# -- optional micro benchmarks ------------------------------------------------- - -# find_package(benchmark QUIET) -# -# if (benchmark_FOUND) -# add_subdirectory(micro-benchmark) -# endif () diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt new file mode 100644 index 000000000..da9bcebf4 --- /dev/null +++ b/tests/benchmarks/CMakeLists.txt @@ -0,0 +1,6 @@ +find_package(benchmark QUIET) + +# add_subdirectory(cluster) +# add_subdirectory(fan-out) +# add_subdirectory(routing-table) +# add_subdirectory(serialization) diff --git a/tests/benchmark/README.md b/tests/benchmarks/cluster/README.md similarity index 86% rename from tests/benchmark/README.md rename to tests/benchmarks/cluster/README.md index 9f0ad04ac..6d7f8100d 100644 --- a/tests/benchmark/README.md +++ b/tests/benchmarks/cluster/README.md @@ -179,33 +179,3 @@ mars.dat Note that the tool has to linearly scan each generator file, which may take some time. - -## Rate Testing: `broker-benchmark` - -Running the rate benchmark allows users to configure varying (or even -increasing) rates to investigate system behavior at different loads. - -This tool requires two processes: a client and a server. - -### Starting the Server - -The server simply creates a Broker endpoint and binds it to the given port: - -```sh -broker-benchmark --verbose --server :8080 -``` - -### Staring the Client - -After starting the server, clients can start peering to it. The important -parameters of the benchmark are message type (`-t`) and rate (`-r`). The -message type is 1 for trivial strings, 2 for Broker vectors that resemble a -line in conn.log, or 3 for large Broker tables. The rate parameter configures -how many messages per second the client should send. - -For sending 1,000 large table messages per second, the client could get started -as follows: - -```sh -broker-benchmark --verbose -t 3 -r 1000 localhost:8080 -``` diff --git a/tests/benchmark/broker-cluster-benchmark.cc b/tests/benchmarks/cluster/cluster.cc similarity index 100% rename from tests/benchmark/broker-cluster-benchmark.cc rename to tests/benchmarks/cluster/cluster.cc diff --git a/tests/benchmark/cluster-example.zip b/tests/benchmarks/cluster/example.zip similarity index 100% rename from tests/benchmark/cluster-example.zip rename to tests/benchmarks/cluster/example.zip diff --git a/tests/benchmark/mars.dat b/tests/benchmarks/cluster/mars.dat similarity index 100% rename from tests/benchmark/mars.dat rename to tests/benchmarks/cluster/mars.dat diff --git a/tests/benchmark/broker-fan-out.cc b/tests/benchmarks/fan-out/fan-out.cc similarity index 100% rename from tests/benchmark/broker-fan-out.cc rename to tests/benchmarks/fan-out/fan-out.cc diff --git a/tests/micro-benchmark/src/main.cc b/tests/benchmarks/main.cc similarity index 100% rename from tests/micro-benchmark/src/main.cc rename to tests/benchmarks/main.cc diff --git a/tests/micro-benchmark/include/main.hh b/tests/benchmarks/main.hh similarity index 91% rename from tests/micro-benchmark/include/main.hh rename to tests/benchmarks/main.hh index ff55294bd..755fafb7d 100644 --- a/tests/micro-benchmark/include/main.hh +++ b/tests/benchmarks/main.hh @@ -312,39 +312,5 @@ inline bool operator!=(const uuid_multipath& x, const uuid_multipath& y) { // -- benchmark utilities ------------------------------------------------------ -class generator { -public: - generator(); - - broker::endpoint_id next_endpoint_id(); - - static auto make_endpoint_id() { - generator g; - return g.next_endpoint_id(); - } - - broker::count next_count(); - - caf::uuid next_uuid(); - - std::string next_string(size_t length); - - broker::timestamp next_timestamp(); - - // Generates events for one of three possible types: - // 1. Trivial data consisting of a number and a string. - // 2. More complex data that resembles a line in a conn.log. - // 3. Large tables of size 100 by 10, filled with random strings. - broker::data next_data(size_t event_type); - - static auto make_data(size_t event_type) { - generator g; - return g.next_data(event_type); - } - -private: - std::minstd_rand rng_; - broker::timestamp ts_; -}; void run_streaming_benchmark(); diff --git a/tests/benchmarks/routing-table/CMakeLists.txt b/tests/benchmarks/routing-table/CMakeLists.txt new file mode 100644 index 000000000..db795b1f5 --- /dev/null +++ b/tests/benchmarks/routing-table/CMakeLists.txt @@ -0,0 +1,15 @@ +if (NOT benchmark_FOUND) + return() +endif () + +add_executable(broker-routing-table-benchmark + routing-table.cc +) + +target_include_directories(broker-routing-table-benchmark PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(broker-routing-table-benchmark + PRIVATE + benchmark::benchmark_main + ${BROKER_LIBRARY}) diff --git a/tests/micro-benchmark/src/routing-table.cc b/tests/benchmarks/routing-table/routing-table.cc similarity index 100% rename from tests/micro-benchmark/src/routing-table.cc rename to tests/benchmarks/routing-table/routing-table.cc diff --git a/tests/benchmarks/serialization/CMakeLists.txt b/tests/benchmarks/serialization/CMakeLists.txt new file mode 100644 index 000000000..6527e4d4a --- /dev/null +++ b/tests/benchmarks/serialization/CMakeLists.txt @@ -0,0 +1,15 @@ +if (NOT benchmark_FOUND) + return() +endif () + +add_executable(broker-serialization-benchmark + serialization.cc +) + +target_include_directories(broker-serialization-benchmark PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(broker-serialization-benchmark + PRIVATE + benchmark::benchmark_main + ${BROKER_LIBRARY}) diff --git a/tests/benchmarks/serialization/generator.cc b/tests/benchmarks/serialization/generator.cc new file mode 100644 index 000000000..e69de29bb diff --git a/tests/benchmarks/serialization/generator.hh b/tests/benchmarks/serialization/generator.hh new file mode 100644 index 000000000..fb5ad2685 --- /dev/null +++ b/tests/benchmarks/serialization/generator.hh @@ -0,0 +1,43 @@ +#include +#include +#include + +#include + +#include +#include + +class generator { +public: + generator(); + + broker::endpoint_id next_endpoint_id(); + + static auto make_endpoint_id() { + generator g; + return g.next_endpoint_id(); + } + + broker::count next_count(); + + caf::uuid next_uuid(); + + std::string next_string(size_t length); + + broker::timestamp next_timestamp(); + + // Generates events for one of three possible types: + // 1. Trivial data consisting of a number and a string. + // 2. More complex data that resembles a line in a conn.log. + // 3. Large tables of size 100 by 10, filled with random strings. + broker::data next_data(size_t event_type); + + static auto make_data(size_t event_type) { + generator g; + return g.next_data(event_type); + } + +private: + std::minstd_rand rng_; + broker::timestamp ts_; +}; diff --git a/tests/micro-benchmark/src/serialization.cc b/tests/benchmarks/serialization/serialization.cc similarity index 100% rename from tests/micro-benchmark/src/serialization.cc rename to tests/benchmarks/serialization/serialization.cc diff --git a/tests/btest/btest.cfg b/tests/btest/btest.cfg index d2278ef10..7fd72c4ed 100644 --- a/tests/btest/btest.cfg +++ b/tests/btest/btest.cfg @@ -9,6 +9,6 @@ IgnoreFiles = *.swp *.cc SCRIPTS = %(testbase)s/scripts TMPDIR = %(testbase)s/.tmp TEST_ROOT = %(testbase)s -CERTS_ROOT = %(testbase)s/../cpp/certs +CERTS_ROOT = %(testbase)s/../data/certs PYTHONUNBUFFERED=1 diff --git a/tests/cpp/ssl.cc b/tests/cpp/ssl.cc deleted file mode 100644 index c31fda91e..000000000 --- a/tests/cpp/ssl.cc +++ /dev/null @@ -1,126 +0,0 @@ -// This suite is a test ensuring SSL authentication works as expected. -#define SUITE ssl - -#include "test.hh" - -#include -#include -#include -#include -#include - -#include "broker/configuration.hh" -#include "broker/data.hh" -#include "broker/endpoint.hh" -#include "broker/internal/configuration_access.hh" -#include "broker/subscriber.hh" -#include "broker/topic.hh" - -using namespace broker; - -namespace { - -configuration make_config(std::string cert_id) { - configuration cfg{skip_init}; - try { - cfg.init(caf::test::engine::argc(), caf::test::engine::argv()); - } catch (std::exception& ex) { - FAIL("parsing the config failed: " << ex.what()); - } - if (cert_id.size()) { - auto test_dir = getenv("BROKER_TEST_DIR"); - REQUIRE(test_dir); - auto cd = std::string(test_dir) + "/cpp/certs/"; - cfg.set("caf.openssl.cafile", cd + "ca.pem"); - cfg.set("caf.openssl.certificate", cd + "cert." + cert_id + ".pem"); - cfg.set("caf.openssl.key", cd + "key." + cert_id + ".pem"); - MESSAGE("using certififcate " << cfg.openssl_certificate() << ", key " - << cfg.openssl_key()); - } - return cfg; -} - -// Holds state for individual peers. We use one fixture per simulated peer. -struct peer_fixture { - // Identifies this fixture in the parent's `peers` map. - std::string name; - - // Each peer is an endpoint. - endpoint ep; - - // Initializes this peer and registers it at parent. - peer_fixture(std::string peer_name, configuration config) - : name(std::move(peer_name)), ep(std::move(config)) {} -}; - -// A fixture for testing SSL authentication. -struct ssl_auth_fixture { - peer_fixture mercury_auth; - peer_fixture venus_auth; - peer_fixture earth_no_auth; - peer_fixture earth_wrong_auth; - - ssl_auth_fixture() - : mercury_auth("mercury_auth", make_config("1")), - venus_auth("venus_auth", make_config("2")), - earth_no_auth("earth_no_auth", make_config("")), - earth_wrong_auth("earth_wrong_auth", make_config("self-signed")) {} -}; - -} // namespace - -FIXTURE_SCOPE(ssl_auth_use_cases, ssl_auth_fixture) - -TEST(authenticated_session) { - MESSAGE("prepare authenticated connection"); - auto mercury_auth_es = mercury_auth.ep.make_subscriber({"/broker/test"}); - auto venus_auth_es = venus_auth.ep.make_subscriber({"/broker/test"}); - - MESSAGE("mercury_auth listen"); - auto p = mercury_auth.ep.listen("127.0.0.1", 0); - MESSAGE("venus_auth peer with mecury_auth on port " << p); - auto b = venus_auth.ep.peer("127.0.0.1", p); - REQUIRE(b); - - data_message ping{"/broker/test", "ping"}; - data_message pong{"/broker/test", "pong"}; - - MESSAGE("mercury_auth sending ping"); - mercury_auth.ep.publish(ping); - MESSAGE("venus_auth waiting for ping"); - CHECK_EQUAL(venus_auth_es.get(), ping); - CHECK(mercury_auth_es.poll().empty()); - CHECK(venus_auth_es.poll().empty()); - - MESSAGE("venus_auth sending pong"); - venus_auth.ep.publish(pong); - MESSAGE("mercury_auth waiting for pong"); - CHECK_EQUAL(mercury_auth_es.get(), pong); - CHECK(mercury_auth_es.poll().empty()); - CHECK(venus_auth_es.poll().empty()); - - MESSAGE("disconnect venus_auth from mercury_auth"); - venus_auth.ep.unpeer("mercury", 4040); -} - -TEST(authenticated_failure_no_ssl_peer) { - MESSAGE("prepare authenticated connection expected to fail"); - MESSAGE("earth_no_auth listen"); - auto p = earth_no_auth.ep.listen("127.0.0.1", 0); - - MESSAGE("venus_auth peer with earth_no_auth on port " << p); - auto b = venus_auth.ep.peer("127.0.0.1", p, timeout::seconds(0)); - REQUIRE(not b); -} - -TEST(authenticated_failure_wrong_ssl_peer) { - MESSAGE("prepare authenticated connection expected to fail"); - MESSAGE("earth_wrong_auth listen"); - auto p = earth_wrong_auth.ep.listen("127.0.0.1", 0); - - MESSAGE("venus_auth peer with earth_wrong_auth on port " << p); - auto b = venus_auth.ep.peer("127.0.0.1", p, timeout::seconds(0)); - REQUIRE(not b); -} - -FIXTURE_SCOPE_END() diff --git a/tests/cpp/system/README b/tests/cpp/system/README deleted file mode 100644 index 152bf4e78..000000000 --- a/tests/cpp/system/README +++ /dev/null @@ -1,5 +0,0 @@ -Unlike the other test suites bundled in `broker-test`, the suites in this -directory perform system testing. - -All suites use `broker::endpoint` directly and there is some level of -nondeterminism due to threading. diff --git a/tests/cpp/certs/ca.pem b/tests/data/certs/ca.pem similarity index 100% rename from tests/cpp/certs/ca.pem rename to tests/data/certs/ca.pem diff --git a/tests/cpp/certs/cert.1.pem b/tests/data/certs/cert.1.pem similarity index 100% rename from tests/cpp/certs/cert.1.pem rename to tests/data/certs/cert.1.pem diff --git a/tests/cpp/certs/cert.2.pem b/tests/data/certs/cert.2.pem similarity index 100% rename from tests/cpp/certs/cert.2.pem rename to tests/data/certs/cert.2.pem diff --git a/tests/cpp/certs/cert.self-signed.pem b/tests/data/certs/cert.self-signed.pem similarity index 100% rename from tests/cpp/certs/cert.self-signed.pem rename to tests/data/certs/cert.self-signed.pem diff --git a/tests/cpp/certs/key.1.enc.pem b/tests/data/certs/key.1.enc.pem similarity index 100% rename from tests/cpp/certs/key.1.enc.pem rename to tests/data/certs/key.1.enc.pem diff --git a/tests/cpp/certs/key.1.pem b/tests/data/certs/key.1.pem similarity index 100% rename from tests/cpp/certs/key.1.pem rename to tests/data/certs/key.1.pem diff --git a/tests/cpp/certs/key.2.pem b/tests/data/certs/key.2.pem similarity index 100% rename from tests/cpp/certs/key.2.pem rename to tests/data/certs/key.2.pem diff --git a/tests/cpp/certs/key.self-signed.pem b/tests/data/certs/key.self-signed.pem similarity index 100% rename from tests/cpp/certs/key.self-signed.pem rename to tests/data/certs/key.self-signed.pem diff --git a/tests/foo.txt b/tests/foo.txt deleted file mode 100644 index 5716ca598..000000000 --- a/tests/foo.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/tests/micro-benchmark/CMakeLists.txt b/tests/micro-benchmark/CMakeLists.txt deleted file mode 100644 index 0de37a189..000000000 --- a/tests/micro-benchmark/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -find_package(benchmark REQUIRED) - -add_executable(micro-benchmark - "src/main.cc" - "src/routing-table.cc" - "src/serialization.cc" - "src/streaming.cc" -) - -target_include_directories(micro-benchmark PRIVATE "include") - -target_link_libraries(micro-benchmark PRIVATE benchmark::benchmark_main) - -if (ENABLE_STATIC) - target_link_libraries(micro-benchmark PRIVATE broker_static) -else () - target_link_libraries(micro-benchmark PRIVATE broker) -endif () diff --git a/tests/micro-benchmark/src/streaming.cc b/tests/micro-benchmark/src/streaming.cc deleted file mode 100644 index b11060679..000000000 --- a/tests/micro-benchmark/src/streaming.cc +++ /dev/null @@ -1,427 +0,0 @@ -#include "main.hh" - -#include "broker/message.hh" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -namespace { - -// -- print utility ------------------------------------------------------------ - -struct stats { - std::string_view benchmark_name; - std::vector runtime_measurements; // in seconds - - explicit stats(std::string_view name) : benchmark_name(name) { - // nop - } - - auto min() const noexcept { - if (runtime_measurements.empty()) - return 0.0; - else - return *std::min_element(runtime_measurements.begin(), - runtime_measurements.end()); - } - - auto max() const noexcept { - if (runtime_measurements.empty()) - return 0.0; - else - return *std::max_element(runtime_measurements.begin(), - runtime_measurements.end()); - } - - auto avg() const noexcept { - if (runtime_measurements.empty()) - return 0.0; - else - return std::accumulate(runtime_measurements.begin(), - runtime_measurements.end(), 0.0) - / runtime_measurements.size(); - } -}; - -struct setlw_t { - int n; -}; - -auto setlw(int n) { - return setlw_t{n}; -} - -std::ostream& operator<<(std::ostream& out, setlw_t token) { - return out << std::left << std::setw(token.n); -} - -struct setrw_t { - int n; -}; - -auto setrw(int n) { - return setrw_t{n}; -} - -std::ostream& operator<<(std::ostream& out, setrw_t token) { - return out << std::right << std::setw(token.n); -} - -struct padding { - size_t n; - char c; -}; - -std::ostream& operator<<(std::ostream& out, padding x) { - for (size_t i = 0; i < x.n; ++i) - out.put(x.c); - return out; -} - -using std::cout; - -struct layout { - static constexpr size_t col_size[] = {45, 15, 15, 15}; - - static size_t line_size() noexcept { - return std::accumulate(std::begin(col_size), std::end(col_size), size_t{0}); - } -}; - -void print_sep() { - cout << padding{layout::line_size(), '-'} << '\n'; -} - -void print_header() { - print_sep(); - cout << setlw(layout::col_size[0]) << "Benchmark" // Col 1. - << setrw(layout::col_size[1]) << "Time AVG" // Col 2. - << setrw(layout::col_size[2]) << "Time MIN" // Col 3. - << setrw(layout::col_size[3]) << "Time MAX" // Col 4. - << '\n'; - print_sep(); -} - -void print_result(const stats& xs) { - cout << setlw(layout::col_size[0]) << xs.benchmark_name // Col 1. - << setrw(layout::col_size[1] - 2) << xs.avg() << " s" // Col 2. - << setrw(layout::col_size[2] - 2) << xs.min() << " s" // Col 3. - << setrw(layout::col_size[3] - 2) << xs.max() << " s" // Col 4. - << '\n'; -} - -void print_footer() { - print_sep(); - cout.put('\n'); -} - -// -- synchronization ---------------------------------------------------------- - -// Drop-in replacement for std::barrier (based on the TS API as of 2020). -// TODO: tests/cpp/system/shutdown.cc also contains a barrier implementation, we -// could consolidate the two (or just wait for std::barrier). -class barrier { -public: - explicit barrier(ptrdiff_t num_threads) - : num_threads_(num_threads), count_(0) { - // nop - } - - void arrive_and_wait() { - std::unique_lock guard{mx_}; - auto new_count = ++count_; - if (new_count == num_threads_) { - cv_.notify_all(); - } else if (new_count > num_threads_) { - count_ = 1; - cv_.wait(guard, [this] { return count_.load() == num_threads_; }); - } else { - cv_.wait(guard, [this] { return count_.load() == num_threads_; }); - } - } - -private: - ptrdiff_t num_threads_; - std::mutex mx_; - std::atomic count_; - std::condition_variable cv_; -}; - -struct synchronizer { - using clock_type = std::chrono::steady_clock; - using time_point = clock_type::time_point; - using fractional_duration = std::chrono::duration; - time_point init; - time_point fin; - - stats& recorder; - - synchronizer(stats& recorder) : recorder(recorder) { - // nop - } - - auto runtime() const { - return std::chrono::duration_cast(fin - init); - } - - void start() { - init = clock_type::now(); - } - - void stop() { - fin = clock_type::now(); - recorder.runtime_measurements.emplace_back(runtime().count()); - } -}; - -// -- worker code -------------------------------------------------------------- - -template -struct impl { - // -- member types ----------------------------------------------------------- - - using value_type = ValueType; - - // -- consumer --------------------------------------------------------------- - - struct consumer_state { - consumer_state(caf::event_based_actor* self, synchronizer* sync, size_t num) - : self(self), sync(sync), num(num) { - // nop - } - - caf::event_based_actor* self; - - synchronizer* sync; - - size_t num; - - static inline const char* name = "broker.consumer"; - - caf::behavior make_behavior() { - return { - [this](caf::stream in) { - self->unbecome(); - return caf::attach_stream_sink( - self, in, - // Initializer. - [](size_t& received) { received = 0; }, - // Processing step. - [](size_t& received, value_type) { ++received; }, - // Finalizer. - [this]([[maybe_unused]] size_t& received, const caf::error&) { - assert(num == received); - self->quit(); - sync->stop(); - }); - }, - }; - } - }; - - using consumer_actor = caf::stateful_actor; - - // -- producer --------------------------------------------------------------- - - struct producer_state { - producer_state(caf::event_based_actor* self, synchronizer* sync, - caf::actor consumer, size_t num, value_type msg) - : self(self), - sync(sync), - consumer(std::move(consumer)), - num(num), - msg(std::move(msg)) { - // nop - } - - caf::event_based_actor* self; - synchronizer* sync; - caf::actor consumer; - size_t num; - value_type msg; - - static inline const char* name = "broker.producer"; - - caf::behavior make_behavior() { - sync->start(); - caf::attach_stream_source( - self, std::move(consumer), - // Initializer. - [](size_t& shipped) { shipped = 0; }, - // Generator. - [this](size_t& shipped, caf::downstream& out, size_t hint) { - if (auto n = std::min(hint, num - shipped); n > 0) { - for (size_t pushed = 0; pushed < n; ++pushed) - out.push(msg); - shipped += n; - } - }, - // Done predicate. - [this](const size_t& shipped) { return shipped >= num; }); - return {}; - } - }; - - using producer_actor = caf::stateful_actor; -}; - -// -- CAF setup ---------------------------------------------------------------- - -struct config : caf::actor_system_config { - config() { - config_file_path.clear(); - set("caf.scheduler.max-threads", 2); - set("caf.logger.console.verbosity", "quiet"); - set("caf.logger.file.verbosity", "quiet"); - } -}; - -// -- benchmarking utility ----------------------------------------------------- - -template -void run_single_system(std::string benchmark_name, size_t num, ValueType msg) { - using impl_type = impl; - using consumer_actor = typename impl_type::consumer_actor; - using producer_actor = typename impl_type::producer_actor; - stats recorder{benchmark_name}; - for (int i = 0; i < 10; ++i) { - config cfg; - synchronizer sync{recorder}; - caf::actor_system sys{cfg}; - auto consumer = sys.spawn(&sync, num); - sys.spawn(&sync, consumer, num, msg); - } - print_result(recorder); -} - -#if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD) -constexpr int no_sigpipe_io_flag = 0; -#else -constexpr int no_sigpipe_io_flag = MSG_NOSIGNAL; -#endif - -std::pair make_socket_pair() { - int sockets[2]; - if (auto res = socketpair(AF_UNIX, SOCK_STREAM, 0, sockets); res != 0) { - perror("socketpair"); - abort(); - } else { - return {sockets[0], sockets[1]}; - } -} - -// Note: this setup uses some private CAF APIs and is bound to break eventually! -// Unfortunately, there's no way to set this up with the public API at the -// moment. Once there is an officially supported way we'll switch to that API -// instead. -template -void run_distributed(std::string benchmark_name, size_t num, ValueType msg) { - using impl_type = impl; - using consumer_actor = typename impl_type::consumer_actor; - using producer_actor = typename impl_type::producer_actor; - stats recorder{benchmark_name}; - for (int i = 0; i < 10; ++i) { - synchronizer sync{recorder}; - // Note: we use tie instead of `auto [fd0, fd1]` for lambda captures. - int fd0; - int fd1; - std::tie(fd0, fd1) = make_socket_pair(); - // Spin up the "server" with a consumer. - auto t0 = std::thread{[fd0, sptr{&sync}, num] { - config cfg; - cfg.load(); - cfg.set("caf.middleman.workers", 0); - caf::actor_system sys{cfg}; - auto consumer = sys.spawn(sptr, num); - std::set dummy; - auto scribe = sys.middleman().backend().new_scribe(fd0); - auto basp = sys.middleman().get_named_broker("BASP"); - auto cptr = caf::actor_cast(consumer); - caf::anon_send(basp, caf::publish_atom_v, std::move(scribe), - uint16_t{1234}, std::move(cptr), std::move(dummy)); - }}; - // Spin up the "client" with the producer. - auto t1 = std::thread{[fd1, sptr{&sync}, num, msg] { - config cfg; - cfg.load(); - caf::actor_system sys{cfg}; - std::set dummy; - auto scribe = sys.middleman().backend().new_scribe(fd1); - auto basp = sys.middleman().get_named_broker("BASP"); - caf::actor consumer; - { - caf::scoped_actor self{sys}; - self - ->request(basp, caf::infinite, caf::connect_atom_v, std::move(scribe), - uint16_t{1234}) - .receive( - [&consumer](endpoint_id&, caf::strong_actor_ptr& ptr, - std::set&) { - if (ptr) { - consumer = caf::actor_cast(ptr); - } else { - std::cerr << "*** CAF returned an invalid consumer handle\n"; - abort(); - } - }, - [](caf::error& err) { - std::cerr << "*** failed to connect to the consumer: " - << caf::to_string(err) << '\n'; - abort(); - }); - } - sys.spawn(sptr, consumer, num, msg); - }}; - t0.join(); - t1.join(); - } - print_result(recorder); -} - -} // namespace - -void run_streaming_benchmark() { - using namespace broker; - constexpr size_t n = 100'000; - cout << std::fixed << std::setprecision(6); // Microsecond resolution. - generator g; - auto nid = g.next_endpoint_id(); - auto uid = g.next_uuid(); - print_header(); - // TODO: allow users to specify the index range. We currently only enable - // message type 1 since it's reasonably fast. - for (size_t index = 0; index < 1; ++index) { - auto suffixed = [index](std::string str) { - str += std::to_string(index); - return str; - }; - auto dmsg = make_data_message("/micro/benchmark", g.next_data(index + 1)); - auto nmsg = make_node_message(dmsg, alm::multipath{nid}); - auto lmsg = legacy_node_message{dmsg, 20}; - auto umsg = uuid_node_message{dmsg, uuid_multipath{uid, true}}; - run_single_system(suffixed("/single-system/data-message/"), n, dmsg); - run_single_system(suffixed("/single-system/node-message/"), n, nmsg); - run_single_system(suffixed("/single-system/legacy-node-message/"), n, lmsg); - run_single_system(suffixed("/single-system/uuid-node-message/"), n, umsg); - run_distributed(suffixed("/distributed/data-message/"), n, dmsg); - run_distributed(suffixed("/distributed/node-message/"), n, nmsg); - run_distributed(suffixed("/distributed/legacy-node-message/"), n, lmsg); - run_distributed(suffixed("/distributed/uuid-node-message/"), n, umsg); - } - print_footer(); -}