diff --git a/test/boost/commitlog_test.cc b/test/boost/commitlog_test.cc index 94ae7d2074..f765d01586 100644 --- a/test/boost/commitlog_test.cc +++ b/test/boost/commitlog_test.cc @@ -17,6 +17,8 @@ #include #include +#include + #include "test/lib/scylla_test_case.hh" #include #include diff --git a/test/boost/compound_test.cc b/test/boost/compound_test.cc index b4d73bed0e..909948e22f 100644 --- a/test/boost/compound_test.cc +++ b/test/boost/compound_test.cc @@ -7,8 +7,10 @@ */ #include "test/lib/scylla_test_case.hh" +#include #include #include "test/lib/random_utils.hh" +#include "test/lib/test_utils.hh" #include "compound.hh" #include "compound_compat.hh" diff --git a/test/boost/config_test.cc b/test/boost/config_test.cc index 8327741885..49350ac0b2 100644 --- a/test/boost/config_test.cc +++ b/test/boost/config_test.cc @@ -10,8 +10,10 @@ #include #include #include +#include #include "test/lib/scylla_test_case.hh" +#include "test/lib/test_utils.hh" #include #include #include "db/config.hh" diff --git a/test/boost/expr_test.cc b/test/boost/expr_test.cc index f22dba8a73..e393476346 100644 --- a/test/boost/expr_test.cc +++ b/test/boost/expr_test.cc @@ -12,6 +12,7 @@ #include #include +#include #include "cql3/expr/expression.hh" #include "utils/overloaded_functor.hh" #include "utils/to_string.hh" diff --git a/test/boost/flat_mutation_reader_test.cc b/test/boost/flat_mutation_reader_test.cc index d3a00b2e03..c483d7f9b3 100644 --- a/test/boost/flat_mutation_reader_test.cc +++ b/test/boost/flat_mutation_reader_test.cc @@ -12,6 +12,8 @@ #include #include +#include + #include "mutation/mutation.hh" #include "mutation/mutation_fragment.hh" #include "readers/flat_mutation_reader_v2.hh" diff --git a/test/boost/hint_test.cc b/test/boost/hint_test.cc index bf977332e1..195fa02526 100644 --- a/test/boost/hint_test.cc +++ b/test/boost/hint_test.cc @@ -9,6 +9,7 @@ #include #include "test/lib/scylla_test_case.hh" #include +#include #include "db/hints/sync_point.hh" @@ -21,9 +22,8 @@ std::ostream& operator<<(std::ostream& out, const replay_position& p) { namespace db::hints { std::ostream& operator<<(std::ostream& out, const sync_point& sp) { - out << "{regular_per_shard_rps: " << sp.regular_per_shard_rps - << ", mv_per_shard_rps: " << sp.mv_per_shard_rps - << "}"; + fmt::print(out, "{{regular_per_shard_rps: {}, mv_per_shard_rps: {}}}", + sp.regular_per_shard_rps, sp.mv_per_shard_rps); return out; } } diff --git a/test/boost/idl_test.cc b/test/boost/idl_test.cc index 94dc601f38..6f5af9a0e7 100644 --- a/test/boost/idl_test.cc +++ b/test/boost/idl_test.cc @@ -12,9 +12,13 @@ #include +#include + #include #include +#include +#include "test/lib/test_utils.hh" #include "bytes.hh" #include "bytes_ostream.hh" @@ -51,9 +55,16 @@ public: thread_local int non_final_composite_test_object::construction_count = 0; thread_local int final_composite_test_object::construction_count = 0; +template <> struct fmt::formatter : fmt::formatter { + auto format(const simple_compound& sc, fmt::format_context& ctx) const { + return fmt::format_to(ctx.out(), " {{ foo: {}, bar: {} }}", sc.foo, sc.bar); + } +}; + std::ostream& operator<<(std::ostream& os, const simple_compound& sc) { - return os << " { foo: " << sc.foo << ", bar: " << sc.bar << " }"; + fmt::print(os, "{}", sc); + return os; } struct compound_with_optional { @@ -69,11 +80,11 @@ std::ostream& operator<<(std::ostream& os, const compound_with_optional& v) { os << " { first: "; if (v.first) { - os << *v.first; + fmt::print(os, "{}", *v.first); } else { - os << ""; + fmt::print(os, ""); } - os << ", second: " << v.second << " }"; + fmt::print(os, ", second: {}}}", v.second); return os; } @@ -87,7 +98,8 @@ struct wrapped_vector { std::ostream& operator<<(std::ostream& os, const wrapped_vector& v) { - return os << v.vector; + fmt::print(os, "{}", v.vector); + return os; } struct vectors_of_compounds { diff --git a/test/boost/mutation_query_test.cc b/test/boost/mutation_query_test.cc index 50cffc5553..e565c251c1 100644 --- a/test/boost/mutation_query_test.cc +++ b/test/boost/mutation_query_test.cc @@ -7,6 +7,8 @@ */ +#include + #include #include #include @@ -21,6 +23,7 @@ #include "test/lib/result_set_assertions.hh" #include "test/lib/mutation_source_test.hh" #include "test/lib/reader_concurrency_semaphore.hh" +#include "test/lib/test_utils.hh" #include "querier.hh" #include "mutation_query.hh" diff --git a/test/boost/mutation_reader_test.cc b/test/boost/mutation_reader_test.cc index 49f20d16cf..04470d7c82 100644 --- a/test/boost/mutation_reader_test.cc +++ b/test/boost/mutation_reader_test.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -37,6 +38,7 @@ #include "test/lib/simple_position_reader_queue.hh" #include "test/lib/fragment_scatterer.hh" #include "test/lib/key_utils.hh" +#include "test/lib/test_utils.hh" #include "dht/sharder.hh" #include "schema/schema_builder.hh" diff --git a/test/boost/mutation_test.cc b/test/boost/mutation_test.cc index 1f83b80600..2d0bc2a6fe 100644 --- a/test/boost/mutation_test.cc +++ b/test/boost/mutation_test.cc @@ -17,6 +17,8 @@ #include "utils/preempt.hh" #include "utils/xx_hasher.hh" +#include + #include #include #include @@ -46,6 +48,7 @@ #include "test/lib/mutation_assertions.hh" #include "test/lib/random_utils.hh" #include "test/lib/simple_schema.hh" +#include "test/lib/test_utils.hh" #include "test/lib/log.hh" #include "types/map.hh" #include "types/list.hh" diff --git a/test/boost/mutation_writer_test.cc b/test/boost/mutation_writer_test.cc index 4b043d177f..74ee7fe8cc 100644 --- a/test/boost/mutation_writer_test.cc +++ b/test/boost/mutation_writer_test.cc @@ -28,6 +28,7 @@ #include "test/lib/random_utils.hh" #include "test/lib/random_schema.hh" #include "test/lib/log.hh" +#include "test/lib/test_utils.hh" #include #include "readers/from_mutations_v2.hh" diff --git a/test/boost/nonwrapping_interval_test.cc b/test/boost/nonwrapping_interval_test.cc index 50a1f3711f..ec2e4c0977 100644 --- a/test/boost/nonwrapping_interval_test.cc +++ b/test/boost/nonwrapping_interval_test.cc @@ -11,12 +11,15 @@ #include #include "boost/icl/interval.hpp" #include "boost/icl/interval_map.hpp" +#include #include #include "schema/schema_builder.hh" #include "locator/token_metadata.hh" +#include "test/lib/test_utils.hh" + using ring_position = dht::ring_position; static diff --git a/test/boost/query_processor_test.cc b/test/boost/query_processor_test.cc index 9b98e1ed88..e780ca14f2 100644 --- a/test/boost/query_processor_test.cc +++ b/test/boost/query_processor_test.cc @@ -11,12 +11,14 @@ #include #include #include +#include #include #include #include "test/lib/scylla_test_case.hh" #include "test/lib/cql_test_env.hh" #include "test/lib/cql_assertions.hh" +#include "test/lib/test_utils.hh" #include #include diff --git a/test/boost/service_level_controller_test.cc b/test/boost/service_level_controller_test.cc index e9bd30c8d5..8e3064538c 100644 --- a/test/boost/service_level_controller_test.cc +++ b/test/boost/service_level_controller_test.cc @@ -8,11 +8,14 @@ #include +#include +#include #include #include #include "seastarx.hh" #include "test/lib/scylla_test_case.hh" +#include "test/lib/test_utils.hh" #include #include #include "service/qos/service_level_controller.hh" diff --git a/test/boost/sstable_resharding_test.cc b/test/boost/sstable_resharding_test.cc index 4a6e0d4acb..bdd2a3b9bf 100644 --- a/test/boost/sstable_resharding_test.cc +++ b/test/boost/sstable_resharding_test.cc @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/test/boost/statement_restrictions_test.cc b/test/boost/statement_restrictions_test.cc index f441b640be..dfdc295bd1 100644 --- a/test/boost/statement_restrictions_test.cc +++ b/test/boost/statement_restrictions_test.cc @@ -11,11 +11,14 @@ #include +#include + #include "cql3/restrictions/statement_restrictions.hh" #include "cql3/expr/expr-utils.hh" #include "cql3/util.hh" #include "test/lib/cql_assertions.hh" #include "test/lib/cql_test_env.hh" +#include "test/lib/test_utils.hh" using namespace cql3; diff --git a/test/boost/top_k_test.cc b/test/boost/top_k_test.cc index 57487bc91e..b06c67fd51 100644 --- a/test/boost/top_k_test.cc +++ b/test/boost/top_k_test.cc @@ -10,6 +10,8 @@ #include #include "utils/top_k.hh" +#include "test/lib/test_utils.hh" +#include #include #include diff --git a/test/boost/transport_test.cc b/test/boost/transport_test.cc index e93b6d174a..ca9266e9ad 100644 --- a/test/boost/transport_test.cc +++ b/test/boost/transport_test.cc @@ -8,10 +8,13 @@ #include "test/lib/scylla_test_case.hh" +#include + #include "transport/request.hh" #include "transport/response.hh" #include "test/lib/random_utils.hh" +#include "test/lib/test_utils.hh" namespace cql3 { diff --git a/test/boost/user_function_test.cc b/test/boost/user_function_test.cc index 58c5ca04cc..4be5cdd0fc 100644 --- a/test/boost/user_function_test.cc +++ b/test/boost/user_function_test.cc @@ -21,6 +21,7 @@ #include "db/config.hh" #include "test/lib/tmpdir.hh" #include "test/lib/exception_utils.hh" +#include "test/lib/test_utils.hh" using ire = exceptions::invalid_request_exception; using exception_predicate::message_equals; diff --git a/test/boost/view_build_test.cc b/test/boost/view_build_test.cc index bb68fc78f4..20dcc4eeaf 100644 --- a/test/boost/view_build_test.cc +++ b/test/boost/view_build_test.cc @@ -32,6 +32,7 @@ #include "test/lib/key_utils.hh" #include "test/lib/mutation_source_test.hh" #include "test/lib/mutation_assertions.hh" +#include "test/lib/test_utils.hh" #include "utils/ranges.hh" #include "readers/from_mutations_v2.hh" diff --git a/test/boost/wrapping_interval_test.cc b/test/boost/wrapping_interval_test.cc index 3a0222424a..7c197e2d5b 100644 --- a/test/boost/wrapping_interval_test.cc +++ b/test/boost/wrapping_interval_test.cc @@ -10,6 +10,7 @@ #include #include "boost/icl/interval_map.hpp" +#include #include #include "schema/schema_builder.hh" diff --git a/test/perf/perf_fast_forward.cc b/test/perf/perf_fast_forward.cc index b9f8422e60..3615fc222a 100644 --- a/test/perf/perf_fast_forward.cc +++ b/test/perf/perf_fast_forward.cc @@ -44,6 +44,14 @@ namespace sstables { extern bool use_binary_search_in_promoted_index; } // namespace sstables +namespace std { +// required by boost::lexical_cast(vector), which is in turn used +// by boost::program_option for printing out the default value of an option +std::ostream& operator<<(std::ostream& os, const std::vector& v) { + return os << fmt::format("{}", v); +} +} + reactor::io_stats s; static bool errors_found = false; @@ -1965,8 +1973,8 @@ int scylla_fast_forward_main(int argc, char** argv) { logging::logger_registry().set_logger_level("sstable", seastar::log_level::trace); } - std::cout << "Data directory: " << db_cfg.data_file_directories() << "\n"; - std::cout << "Output directory: " << output_dir << "\n"; + fmt::print("Data directory: {}\n", db_cfg.data_file_directories()); + fmt::print("Output directory: {}\n", output_dir); auto init = [&app] { auto conf_seed = app.configuration()["random-seed"]; diff --git a/tools/scylla-sstable.cc b/tools/scylla-sstable.cc index 1c6867494b..f4950d062f 100644 --- a/tools/scylla-sstable.cc +++ b/tools/scylla-sstable.cc @@ -49,6 +49,14 @@ using namespace tools::utils; using operation_func = void(*)(schema_ptr, reader_permit, const std::vector&, sstables::sstables_manager&, const bpo::variables_map&); +namespace std { +// required by boost::lexical_cast(vector), which is in turn used +// by boost::program_option for printing out the default value of an option +std::ostream& operator<<(std::ostream& os, const std::vector& v) { + return os << fmt::format("{}", v); +} +} + namespace { const auto app_name = "sstable"; diff --git a/tools/scylla-types.cc b/tools/scylla-types.cc index d754a33027..079f4a4452 100644 --- a/tools/scylla-types.cc +++ b/tools/scylla-types.cc @@ -10,6 +10,7 @@ #include #include +#include #include "compound.hh" #include "db/marshal/type_parser.hh" #include "schema/schema_builder.hh" @@ -22,6 +23,14 @@ using namespace tools::utils; namespace bpo = boost::program_options; +namespace std { +// required by boost::lexical_cast(vector), which is in turn used +// by boost::program_option for printing out the default value of an option +static std::ostream& operator<<(std::ostream& os, const std::vector& v) { + return os << fmt::format("{}", v); +} +} + namespace { const auto app_name = "types";