test/boost: include test/lib/test_utils.hh
this change was created in the same spirit of 505900f18f. because
we are deprecating the operator<< for vector and unorderd_map in
Seastar, some tests do not compile anymore if we disable these
operators. so to be prepared for the change disabling them, let's
include test/lib/test_utils.hh for accessing the printer dedicated
for Boost.test. and also '#include <fmt/ranges.h>' when necessary,
because, in order to format the ranges using {fmt}, we need to
use fmt/ranges.h.
Refs #13245
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
#include <set>
|
||||
#include <deque>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
#include <seastar/core/coroutine.hh>
|
||||
#include <seastar/core/future-util.hh>
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
*/
|
||||
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
#include <fmt/ranges.h>
|
||||
#include <seastar/testing/thread_test_case.hh>
|
||||
#include "test/lib/random_utils.hh"
|
||||
#include "test/lib/test_utils.hh"
|
||||
|
||||
#include "compound.hh"
|
||||
#include "compound_compat.hh"
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
#include "test/lib/test_utils.hh"
|
||||
#include <seastar/testing/thread_test_case.hh>
|
||||
#include <seastar/core/future-util.hh>
|
||||
#include "db/config.hh"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <utility>
|
||||
#include <fmt/ranges.h>
|
||||
#include "cql3/expr/expression.hh"
|
||||
#include "utils/overloaded_functor.hh"
|
||||
#include "utils/to_string.hh"
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <seastar/testing/thread_test_case.hh>
|
||||
#include <seastar/util/closeable.hh>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "mutation/mutation.hh"
|
||||
#include "mutation/mutation_fragment.hh"
|
||||
#include "readers/flat_mutation_reader_v2.hh"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
#include <seastar/core/smp.hh>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,13 @@
|
||||
|
||||
#include <seastar/util/variant_utils.hh>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#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<simple_compound> : fmt::formatter<string_view> {
|
||||
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 << "<disengaged>";
|
||||
fmt::print(os, "<disengaged>");
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
#include <boost/range/algorithm_ext/push_back.hpp>
|
||||
@@ -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"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <source_location>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include <seastar/core/sleep.hh>
|
||||
#include <seastar/core/do_with.hh>
|
||||
@@ -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"
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "utils/preempt.hh"
|
||||
#include "utils/xx_hasher.hh"
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <seastar/core/sstring.hh>
|
||||
#include <seastar/core/do_with.hh>
|
||||
#include <seastar/core/thread.hh>
|
||||
@@ -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"
|
||||
|
||||
@@ -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 <boost/range/adaptor/map.hpp>
|
||||
#include "readers/from_mutations_v2.hh"
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "boost/icl/interval.hpp"
|
||||
#include "boost/icl/interval_map.hpp"
|
||||
#include <fmt/ranges.h>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "schema/schema_builder.hh"
|
||||
|
||||
#include "locator/token_metadata.hh"
|
||||
|
||||
#include "test/lib/test_utils.hh"
|
||||
|
||||
using ring_position = dht::ring_position;
|
||||
|
||||
static
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
#include <boost/range/adaptors.hpp>
|
||||
#include <boost/range/algorithm.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <fmt/ranges.h>
|
||||
#include <iterator>
|
||||
#include <stdint.h>
|
||||
|
||||
#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 <seastar/core/future-util.hh>
|
||||
#include <seastar/core/metrics_api.hh>
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <fmt/std.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "seastarx.hh"
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
#include "test/lib/test_utils.hh"
|
||||
#include <seastar/testing/thread_test_case.hh>
|
||||
#include <seastar/core/future-util.hh>
|
||||
#include "service/qos/service_level_controller.hh"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <fmt/ranges.h>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "utils/top_k.hh"
|
||||
#include "test/lib/test_utils.hh"
|
||||
#include <fmt/ranges.h>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "transport/request.hh"
|
||||
#include "transport/response.hh"
|
||||
|
||||
#include "test/lib/random_utils.hh"
|
||||
#include "test/lib/test_utils.hh"
|
||||
|
||||
namespace cql3 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "boost/icl/interval_map.hpp"
|
||||
#include <fmt/ranges.h>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "schema/schema_builder.hh"
|
||||
|
||||
@@ -44,6 +44,14 @@ namespace sstables {
|
||||
extern bool use_binary_search_in_promoted_index;
|
||||
} // namespace sstables
|
||||
|
||||
namespace std {
|
||||
// required by boost::lexical_cast<std::string>(vector<string>), 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<string>& 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"];
|
||||
|
||||
@@ -49,6 +49,14 @@ using namespace tools::utils;
|
||||
|
||||
using operation_func = void(*)(schema_ptr, reader_permit, const std::vector<sstables::shared_sstable>&, sstables::sstables_manager&, const bpo::variables_map&);
|
||||
|
||||
namespace std {
|
||||
// required by boost::lexical_cast<std::string>(vector<string>), 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<sstring>& v) {
|
||||
return os << fmt::format("{}", v);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const auto app_name = "sstable";
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
#include <seastar/core/coroutine.hh>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
#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<std::string>(vector<string>), 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<sstring>& v) {
|
||||
return os << fmt::format("{}", v);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const auto app_name = "types";
|
||||
|
||||
Reference in New Issue
Block a user