diff options
author | Kefu Chai <kchai@redhat.com> | 2021-08-11 05:53:01 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2021-08-13 06:23:36 +0200 |
commit | 1d1e173876db1067d001e688b8eff0375908226f (patch) | |
tree | 3f7924142da0d53816a341ef482e935f7b7db4d1 /src/test | |
parent | test/erasure-code: build without "using namespace std" (diff) | |
download | ceph-1d1e173876db1067d001e688b8eff0375908226f.tar.xz ceph-1d1e173876db1067d001e688b8eff0375908226f.zip |
test: : build without "using namespace std"
* add "std::" prefix in headers
* add "using" declarations in .cc files.
so we don't rely on "using namespace std" in one or more included
headers.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/test')
115 files changed, 283 insertions, 125 deletions
diff --git a/src/test/ObjectMap/KeyValueDBMemory.h b/src/test/ObjectMap/KeyValueDBMemory.h index 5e7d3f0e167..de84ede9049 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.h +++ b/src/test/ObjectMap/KeyValueDBMemory.h @@ -24,47 +24,47 @@ public: int open(std::ostream &out, const std::string& cfs="") override { return 0; } - int create_and_open(ostream &out, const std::string& cfs="") override { + int create_and_open(std::ostream &out, const std::string& cfs="") override { return 0; } int get( - const string &prefix, - const std::set<string> &key, - std::map<string, bufferlist> *out + const std::string &prefix, + const std::set<std::string> &key, + std::map<std::string, bufferlist> *out ) override; using KeyValueDB::get; int get_keys( - const string &prefix, - const std::set<string> &key, - std::set<string> *out + const std::string &prefix, + const std::set<std::string> &key, + std::set<std::string> *out ); int set( - const string &prefix, - const string &key, + const std::string &prefix, + const std::string &key, const bufferlist &bl ); int rmkey( - const string &prefix, - const string &key + const std::string &prefix, + const std::string &key ); int rmkeys_by_prefix( - const string &prefix + const std::string &prefix ); int rm_range_keys( - const string &prefix, - const string &start, - const string &end + const std::string &prefix, + const std::string &start, + const std::string &end ); class TransactionImpl_ : public TransactionImpl { public: - list<Context *> on_commit; + std::list<Context *> on_commit; KeyValueDBMemory *db; explicit TransactionImpl_(KeyValueDBMemory *db) : db(db) {} @@ -72,10 +72,10 @@ public: struct SetOp : public Context { KeyValueDBMemory *db; - std::pair<string,string> key; + std::pair<std::string,std::string> key; bufferlist value; SetOp(KeyValueDBMemory *db, - const std::pair<string,string> &key, + const std::pair<std::string,std::string> &key, const bufferlist &value) : db(db), key(key), value(value) {} void finish(int r) override { @@ -83,15 +83,15 @@ public: } }; - void set(const string &prefix, const string &k, const bufferlist& bl) override { + void set(const std::string &prefix, const std::string &k, const bufferlist& bl) override { on_commit.push_back(new SetOp(db, std::make_pair(prefix, k), bl)); } struct RmKeysOp : public Context { KeyValueDBMemory *db; - std::pair<string,string> key; + std::pair<std::string,std::string> key; RmKeysOp(KeyValueDBMemory *db, - const std::pair<string,string> &key) + const std::pair<std::string,std::string> &key) : db(db), key(key) {} void finish(int r) override { db->rmkey(key.first, key.second); @@ -100,40 +100,40 @@ public: using KeyValueDB::TransactionImpl::rmkey; using KeyValueDB::TransactionImpl::set; - void rmkey(const string &prefix, const string &key) override { + void rmkey(const std::string &prefix, const std::string &key) override { on_commit.push_back(new RmKeysOp(db, std::make_pair(prefix, key))); } struct RmKeysByPrefixOp : public Context { KeyValueDBMemory *db; - string prefix; + std::string prefix; RmKeysByPrefixOp(KeyValueDBMemory *db, - const string &prefix) + const std::string &prefix) : db(db), prefix(prefix) {} void finish(int r) override { db->rmkeys_by_prefix(prefix); } }; - void rmkeys_by_prefix(const string &prefix) override { + void rmkeys_by_prefix(const std::string &prefix) override { on_commit.push_back(new RmKeysByPrefixOp(db, prefix)); } struct RmRangeKeys: public Context { KeyValueDBMemory *db; - string prefix, start, end; - RmRangeKeys(KeyValueDBMemory *db, const string &prefix, const string &s, const string &e) + std::string prefix, start, end; + RmRangeKeys(KeyValueDBMemory *db, const std::string &prefix, const std::string &s, const std::string &e) : db(db), prefix(prefix), start(s), end(e) {} void finish(int r) { db->rm_range_keys(prefix, start, end); } }; - void rm_range_keys(const string &prefix, const string &start, const string &end) { + void rm_range_keys(const std::string &prefix, const std::string &start, const std::string &end) { on_commit.push_back(new RmRangeKeys(db, prefix, start, end)); } int complete() { - for (list<Context *>::iterator i = on_commit.begin(); + for (auto i = on_commit.begin(); i != on_commit.end(); on_commit.erase(i++)) { (*i)->complete(0); @@ -142,7 +142,7 @@ public: } ~TransactionImpl_() override { - for (list<Context *>::iterator i = on_commit.begin(); + for (auto i = on_commit.begin(); i != on_commit.end(); on_commit.erase(i++)) { delete *i; @@ -158,13 +158,11 @@ public: return static_cast<TransactionImpl_*>(trans.get())->complete(); } - uint64_t get_estimated_size(map<string,uint64_t> &extras) override { + uint64_t get_estimated_size(std::map<std::string,uint64_t> &extras) override { uint64_t total_size = 0; - for (map<pair<string,string>,bufferlist>::iterator p = db.begin(); - p != db.end(); ++p) { - string prefix = p->first.first; - bufferlist &bl = p->second; + for (auto& [key, bl] : db) { + string prefix = key.first; uint64_t sz = bl.length(); total_size += sz; @@ -177,8 +175,8 @@ public: } private: - bool exists_prefix(const string &prefix) { - std::map<std::pair<string,string>,bufferlist>::iterator it; + bool exists_prefix(const std::string &prefix) { + std::map<std::pair<std::string,std::string>,bufferlist>::iterator it; it = db.lower_bound(std::make_pair(prefix, "")); return ((it != db.end()) && ((*it).first.first == prefix)); } diff --git a/src/test/TestSignalHandlers.cc b/src/test/TestSignalHandlers.cc index 74f819675e6..a1344e06fae 100644 --- a/src/test/TestSignalHandlers.cc +++ b/src/test/TestSignalHandlers.cc @@ -29,7 +29,8 @@ #include <string> #define dout_context g_ceph_context -using std::string; + +using namespace std; // avoid compiler warning about dereferencing NULL pointer static int* get_null() diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc index eaa78f82b6b..98cb4f927b7 100644 --- a/src/test/TestTimers.cc +++ b/src/test/TestTimers.cc @@ -13,6 +13,8 @@ */ #define MAX_TEST_CONTEXTS 5 +using namespace std; + class TestContext; namespace diff --git a/src/test/admin_socket.cc b/src/test/admin_socket.cc index 859328d9c78..69bbcedb3cd 100644 --- a/src/test/admin_socket.cc +++ b/src/test/admin_socket.cc @@ -24,6 +24,8 @@ #include <string> #include <sys/un.h> +using namespace std; + class AdminSocketTest { public: diff --git a/src/test/admin_socket_output.cc b/src/test/admin_socket_output.cc index b178e3841cd..1ce69094dd9 100644 --- a/src/test/admin_socket_output.cc +++ b/src/test/admin_socket_output.cc @@ -21,6 +21,8 @@ #include "admin_socket_output.h" +using namespace std; + void AdminSocketOutput::add_target(const std::string& target) { if (target == "all") { add_target("osd"); diff --git a/src/test/base64.cc b/src/test/base64.cc index 9fcdef41525..48035118a9f 100644 --- a/src/test/base64.cc +++ b/src/test/base64.cc @@ -19,6 +19,8 @@ #include "gtest/gtest.h" +using namespace std; + TEST(RoundTrip, SimpleRoundTrip) { static const int OUT_LEN = 4096; const char * const original = "abracadabra"; diff --git a/src/test/bench_log.cc b/src/test/bench_log.cc index 205dfe97b62..e4855521bee 100644 --- a/src/test/bench_log.cc +++ b/src/test/bench_log.cc @@ -11,6 +11,8 @@ #define dout_context g_ceph_context +using namespace std; + struct T : public Thread { int num; set<int> myset; diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index 4d830f6e97e..3d1f064b2c4 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -43,6 +43,8 @@ #define MAX_TEST 1000000 #define FILENAME "bufferlist" +using namespace std; + static char cmd[128]; struct instrumented_bptr : public ceph::buffer::ptr { diff --git a/src/test/ceph_argparse.cc b/src/test/ceph_argparse.cc index ae1461a0940..738879c5ba8 100644 --- a/src/test/ceph_argparse.cc +++ b/src/test/ceph_argparse.cc @@ -18,6 +18,8 @@ #include <vector> #include "include/stringify.h" +using namespace std; + /* Holds a std::vector with C-strings. * Will free() them properly in the destructor. * diff --git a/src/test/ceph_compatset.cc b/src/test/ceph_compatset.cc index 7b274e2a562..28561bf2b23 100644 --- a/src/test/ceph_compatset.cc +++ b/src/test/ceph_compatset.cc @@ -30,6 +30,8 @@ #include "gtest/gtest.h" #include <vector> +using namespace std; + TEST(CephCompatSet, AllSet) { CompatSet::FeatureSet compat; CompatSet::FeatureSet ro; diff --git a/src/test/client/alternate_name.cc b/src/test/client/alternate_name.cc index 7671eff9aec..43f4280120c 100644 --- a/src/test/client/alternate_name.cc +++ b/src/test/client/alternate_name.cc @@ -48,7 +48,7 @@ TEST_F(TestClient, AlternateNameMkdir) { { Client::walk_dentry_result wdr; ASSERT_EQ(0, client->walk(dir.c_str(), &wdr, myperm)); - ASSERT_EQ(wdr.alternate_name, "foo"s); + ASSERT_EQ(wdr.alternate_name, "foo"); } ASSERT_EQ(0, client->rmdir(dir.c_str(), myperm)); diff --git a/src/test/client/main.cc b/src/test/client/main.cc index 437ff722d5d..b85399774f3 100644 --- a/src/test/client/main.cc +++ b/src/test/client/main.cc @@ -21,7 +21,7 @@ int main(int argc, char **argv) { - vector<const char*> args; + std::vector<const char*> args; argv_to_vec(argc, (const char **)argv, args); [[maybe_unused]] auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); ::testing::InitGoogleTest(&argc, argv); diff --git a/src/test/cls_2pc_queue/test_cls_2pc_queue.cc b/src/test/cls_2pc_queue/test_cls_2pc_queue.cc index 90a4d2db47f..41ebf82daf0 100644 --- a/src/test/cls_2pc_queue/test_cls_2pc_queue.cc +++ b/src/test/cls_2pc_queue/test_cls_2pc_queue.cc @@ -19,6 +19,8 @@ #include <chrono> #include <atomic> +using namespace std; + class TestCls2PCQueue : public ::testing::Test { protected: librados::Rados rados; diff --git a/src/test/cls_cas/test_cls_cas.cc b/src/test/cls_cas/test_cls_cas.cc index b011b4b8eec..698eda434ca 100644 --- a/src/test/cls_cas/test_cls_cas.cc +++ b/src/test/cls_cas/test_cls_cas.cc @@ -17,6 +17,7 @@ #include <string> #include <vector> +using namespace std; /// creates a temporary pool and initializes an IoCtx for each test class cls_cas : public ::testing::Test { diff --git a/src/test/cls_fifo/bench_cls_fifo.cc b/src/test/cls_fifo/bench_cls_fifo.cc index df390cd3171..ae4b7e1ae64 100644 --- a/src/test/cls_fifo/bench_cls_fifo.cc +++ b/src/test/cls_fifo/bench_cls_fifo.cc @@ -37,6 +37,8 @@ #include "neorados/cls/fifo.h" +using namespace std; + namespace ba = boost::asio; namespace bs = boost::system; namespace bpo = boost::program_options; diff --git a/src/test/cls_fifo/test_cls_fifo.cc b/src/test/cls_fifo/test_cls_fifo.cc index 484248c0c81..c7a40413bb8 100644 --- a/src/test/cls_fifo/test_cls_fifo.cc +++ b/src/test/cls_fifo/test_cls_fifo.cc @@ -33,6 +33,8 @@ #include "gtest/gtest.h" +using namespace std; + namespace R = neorados; namespace ba = boost::asio; namespace bs = boost::system; diff --git a/src/test/cls_lock/test_cls_lock.cc b/src/test/cls_lock/test_cls_lock.cc index 405befa0335..bf09ec592cf 100644 --- a/src/test/cls_lock/test_cls_lock.cc +++ b/src/test/cls_lock/test_cls_lock.cc @@ -23,11 +23,11 @@ #include "test/librados/test_cxx.h" #include "gtest/gtest.h" -using namespace librados; - #include "cls/lock/cls_lock_client.h" #include "cls/lock/cls_lock_ops.h" +using namespace std; +using namespace librados; using namespace rados::cls::lock; void lock_info(IoCtx *ioctx, string& oid, string& name, map<locker_id_t, locker_info_t>& lockers, diff --git a/src/test/cls_log/test_cls_log.cc b/src/test/cls_log/test_cls_log.cc index 868afcaf65d..016e9d643ee 100644 --- a/src/test/cls_log/test_cls_log.cc +++ b/src/test/cls_log/test_cls_log.cc @@ -16,6 +16,8 @@ #include <string> #include <vector> +using namespace std; + /// creates a temporary pool and initializes an IoCtx for each test class cls_log : public ::testing::Test { librados::Rados rados; diff --git a/src/test/cls_lua/test_cls_lua.cc b/src/test/cls_lua/test_cls_lua.cc index 5a313c12ca6..516b4c9ae00 100644 --- a/src/test/cls_lua/test_cls_lua.cc +++ b/src/test/cls_lua/test_cls_lua.cc @@ -7,6 +7,8 @@ #include "cls/lua/cls_lua_client.h" #include "cls/lua/cls_lua.h" +using namespace std; + /* * JSON script to test JSON I/O protocol with cls_lua */ diff --git a/src/test/cls_queue/test_cls_queue.cc b/src/test/cls_queue/test_cls_queue.cc index 4f0b0d05003..5dbbccb82fd 100644 --- a/src/test/cls_queue/test_cls_queue.cc +++ b/src/test/cls_queue/test_cls_queue.cc @@ -18,6 +18,8 @@ #include <chrono> #include <atomic> +using namespace std; + class TestClsQueue : public ::testing::Test { protected: librados::Rados rados; diff --git a/src/test/cls_refcount/test_cls_refcount.cc b/src/test/cls_refcount/test_cls_refcount.cc index b481ca0f240..ed991820f6e 100644 --- a/src/test/cls_refcount/test_cls_refcount.cc +++ b/src/test/cls_refcount/test_cls_refcount.cc @@ -11,6 +11,8 @@ #include <string> #include <vector> +using namespace std; + static librados::ObjectWriteOperation *new_op() { return new librados::ObjectWriteOperation(); } diff --git a/src/test/cls_rgw/test_cls_rgw.cc b/src/test/cls_rgw/test_cls_rgw.cc index 425123f56e1..d150097fab4 100644 --- a/src/test/cls_rgw/test_cls_rgw.cc +++ b/src/test/cls_rgw/test_cls_rgw.cc @@ -16,6 +16,7 @@ #include <map> #include <set> +using namespace std; using namespace librados; // creates a temporary pool and initializes an IoCtx shared by all tests diff --git a/src/test/cls_rgw_gc/test_cls_rgw_gc.cc b/src/test/cls_rgw_gc/test_cls_rgw_gc.cc index 387083f27fc..129aa3d8735 100644 --- a/src/test/cls_rgw_gc/test_cls_rgw_gc.cc +++ b/src/test/cls_rgw_gc/test_cls_rgw_gc.cc @@ -17,6 +17,7 @@ #include <map> #include <set> +using namespace std; using namespace librados; librados::Rados rados; diff --git a/src/test/cls_version/test_cls_version.cc b/src/test/cls_version/test_cls_version.cc index 9ecea1f2cd2..3397f14efb6 100644 --- a/src/test/cls_version/test_cls_version.cc +++ b/src/test/cls_version/test_cls_version.cc @@ -14,6 +14,8 @@ #include <string> #include <vector> +using namespace std; + static librados::ObjectWriteOperation *new_op() { return new librados::ObjectWriteOperation(); } diff --git a/src/test/compressor/compressor_plugin_example.cc b/src/test/compressor/compressor_plugin_example.cc index 5a6ddd32ebf..014f1fb9db6 100644 --- a/src/test/compressor/compressor_plugin_example.cc +++ b/src/test/compressor/compressor_plugin_example.cc @@ -20,6 +20,8 @@ #include "compressor/CompressionPlugin.h" #include "compressor_example.h" +using namespace std; + class CompressorPluginExample : public CompressionPlugin { public: diff --git a/src/test/compressor/test_compression.cc b/src/test/compressor/test_compression.cc index a8a66398cbc..2bbaed760d6 100644 --- a/src/test/compressor/test_compression.cc +++ b/src/test/compressor/test_compression.cc @@ -25,6 +25,8 @@ #include "global/global_context.h" #include "osd/OSDMap.h" +using namespace std; + class CompressorTest : public ::testing::Test, public ::testing::WithParamInterface<const char*> { public: diff --git a/src/test/confutils.cc b/src/test/confutils.cc index 984c3480bd6..f69e22316b6 100644 --- a/src/test/confutils.cc +++ b/src/test/confutils.cc @@ -29,6 +29,7 @@ namespace fs = std::filesystem; +using namespace std; using ceph::bufferlist; using std::cerr; using std::ostringstream; diff --git a/src/test/crush/CrushWrapper.cc b/src/test/crush/CrushWrapper.cc index 07410ac81f1..6a401233882 100644 --- a/src/test/crush/CrushWrapper.cc +++ b/src/test/crush/CrushWrapper.cc @@ -31,6 +31,8 @@ #include "crush/CrushWrapper.h" +using namespace std; + class CrushWrapperTest : public ::testing::Test { public: diff --git a/src/test/crush/crush.cc b/src/test/crush/crush.cc index e9421988d9d..2d87958b383 100644 --- a/src/test/crush/crush.cc +++ b/src/test/crush/crush.cc @@ -20,6 +20,8 @@ #include "crush/CrushWrapper.h" #include "osd/osd_types.h" +using namespace std; + std::unique_ptr<CrushWrapper> build_indep_map(CephContext *cct, int num_rack, int num_host, int num_osd) { diff --git a/src/test/crypto.cc b/src/test/crypto.cc index c7e08bb41fa..819d41c7218 100644 --- a/src/test/crypto.cc +++ b/src/test/crypto.cc @@ -11,6 +11,7 @@ #include "common/ceph_context.h" #include "global/global_context.h" +using namespace std; class CryptoEnvironment: public ::testing::Environment { public: diff --git a/src/test/daemon_config.cc b/src/test/daemon_config.cc index 26048868f25..f1e7945fe8e 100644 --- a/src/test/daemon_config.cc +++ b/src/test/daemon_config.cc @@ -28,7 +28,7 @@ #include <boost/lexical_cast.hpp> -using std::string; +using namespace std; TEST(DaemonConfig, SimpleSet) { int ret; diff --git a/src/test/filestore/TestFileStore.cc b/src/test/filestore/TestFileStore.cc index 88ec02f484e..1ae9849e4b2 100644 --- a/src/test/filestore/TestFileStore.cc +++ b/src/test/filestore/TestFileStore.cc @@ -19,6 +19,8 @@ #include "os/filestore/FileStore.h" #include <gtest/gtest.h> +using namespace std; + class TestFileStore { public: static void create_backend(FileStore &fs, unsigned long f_type) { diff --git a/src/test/fio/fio_ceph_messenger.cc b/src/test/fio/fio_ceph_messenger.cc index 4a4cf4fb575..cab2d3db698 100644 --- a/src/test/fio/fio_ceph_messenger.cc +++ b/src/test/fio/fio_ceph_messenger.cc @@ -22,6 +22,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_ +using namespace std; + enum ceph_msgr_type { CEPH_MSGR_TYPE_UNDEF, CEPH_MSGR_TYPE_POSIX, diff --git a/src/test/fio/fio_ceph_objectstore.cc b/src/test/fio/fio_ceph_objectstore.cc index 0846904b1bc..fe9c793ab12 100644 --- a/src/test/fio/fio_ceph_objectstore.cc +++ b/src/test/fio/fio_ceph_objectstore.cc @@ -32,6 +32,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_ +using namespace std; + namespace { /// fio configuration options read from the job file diff --git a/src/test/fs/test_ino_release_cb.cc b/src/test/fs/test_ino_release_cb.cc index 7a7875d41f2..b442fb99192 100644 --- a/src/test/fs/test_ino_release_cb.cc +++ b/src/test/fs/test_ino_release_cb.cc @@ -7,6 +7,8 @@ #define MAX_CEPH_FILES 1000 #define DIRNAME "ino_release_cb" +using namespace std; + static std::atomic<bool> cb_done = false; static void cb(void *hdl, vinodeno_t vino) diff --git a/src/test/immutable_object_cache/test_multi_session.cc b/src/test/immutable_object_cache/test_multi_session.cc index c0c629ab036..a8ccbffe2ff 100644 --- a/src/test/immutable_object_cache/test_multi_session.cc +++ b/src/test/immutable_object_cache/test_multi_session.cc @@ -12,6 +12,7 @@ #include "tools/immutable_object_cache/CacheClient.h" #include "tools/immutable_object_cache/CacheServer.h" +using namespace std; using namespace ceph::immutable_obj_cache; class TestMultiSession : public ::testing::Test { diff --git a/src/test/journal/RadosTestFixture.cc b/src/test/journal/RadosTestFixture.cc index 50e35e871d4..0da22ba2b61 100644 --- a/src/test/journal/RadosTestFixture.cc +++ b/src/test/journal/RadosTestFixture.cc @@ -8,6 +8,8 @@ #include "common/WorkQueue.h" #include "journal/Settings.h" +using namespace std::chrono_literals; + RadosTestFixture::RadosTestFixture() : m_timer_lock(ceph::make_mutex("m_timer_lock")), m_listener(this) { diff --git a/src/test/journal/test_JournalPlayer.cc b/src/test/journal/test_JournalPlayer.cc index 1601705dacf..63d2d0a30d6 100644 --- a/src/test/journal/test_JournalPlayer.cc +++ b/src/test/journal/test_JournalPlayer.cc @@ -12,6 +12,7 @@ #include <list> #include <boost/scope_exit.hpp> +using namespace std::chrono_literals; typedef std::list<journal::Entry> Entries; template <typename T> diff --git a/src/test/journal/test_ObjectRecorder.cc b/src/test/journal/test_ObjectRecorder.cc index ac110a23e6f..e4ab8a141cc 100644 --- a/src/test/journal/test_ObjectRecorder.cc +++ b/src/test/journal/test_ObjectRecorder.cc @@ -10,6 +10,7 @@ #include "test/journal/RadosTestFixture.h" #include <limits> +using namespace std::chrono_literals; using std::shared_ptr; class TestObjectRecorder : public RadosTestFixture { diff --git a/src/test/libcephfs/access.cc b/src/test/libcephfs/access.cc index cac42f33fb9..7338739fa95 100644 --- a/src/test/libcephfs/access.cc +++ b/src/test/libcephfs/access.cc @@ -34,6 +34,7 @@ #include <sys/xattr.h> #endif +using namespace std; rados_t cluster; diff --git a/src/test/libcephfs/monconfig.cc b/src/test/libcephfs/monconfig.cc index c962c4f3ab0..7a224a6298a 100644 --- a/src/test/libcephfs/monconfig.cc +++ b/src/test/libcephfs/monconfig.cc @@ -48,7 +48,7 @@ class MonConfig : public ::testing::Test } // Helper to test basic operation on a mount - void use_mount(struct ceph_mount_info *mnt, string name_prefix) { + void use_mount(struct ceph_mount_info *mnt, std::string name_prefix) { char name[20]; snprintf(name, sizeof(name), "%s.%d", name_prefix.c_str(), getpid()); int fd = ceph_open(mnt, name, O_CREAT|O_RDWR, 0644); diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index ac899f85556..443253fdd32 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -44,6 +44,8 @@ #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) #endif +using namespace std; + TEST(LibCephFS, OpenEmptyComponent) { pid_t mypid = getpid(); diff --git a/src/test/librados/aio_cxx.cc b/src/test/librados/aio_cxx.cc index 84ea454e85c..9f27c61833f 100644 --- a/src/test/librados/aio_cxx.cc +++ b/src/test/librados/aio_cxx.cc @@ -16,9 +16,8 @@ #include "test_cxx.h" +using namespace std; using namespace librados; -using std::pair; -using std::ostringstream; class AioTestDataPP { diff --git a/src/test/librados/asio.cc b/src/test/librados/asio.cc index 9dd6b00fe0f..12d56e85c69 100644 --- a/src/test/librados/asio.cc +++ b/src/test/librados/asio.cc @@ -28,6 +28,8 @@ #define dout_subsys ceph_subsys_rados #define dout_context g_ceph_context +using namespace std; + // test fixture for global setup/teardown class AsioRados : public ::testing::Test { static constexpr auto poolname = "ceph_test_rados_api_asio"; diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc index 3da398c12a7..1d110f73b33 100644 --- a/src/test/librados/cmd.cc +++ b/src/test/librados/cmd.cc @@ -13,6 +13,8 @@ #include <sstream> #include <string> +using std::cout; +using std::list; using std::map; using std::ostringstream; using std::string; diff --git a/src/test/librados/list.cc b/src/test/librados/list.cc index 3307db5ac9c..930e6b9eb8e 100644 --- a/src/test/librados/list.cc +++ b/src/test/librados/list.cc @@ -15,6 +15,7 @@ #include <string> #include <stdexcept> +using namespace std; using namespace librados; typedef RadosTestNSCleanup LibRadosList; diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc index bffab46cbe1..de29f5f6efa 100644 --- a/src/test/librados/misc.cc +++ b/src/test/librados/misc.cc @@ -27,10 +27,8 @@ #include <string> #include <regex> +using namespace std; using namespace librados; -using std::map; -using std::ostringstream; -using std::string; typedef RadosTest LibRadosMisc; diff --git a/src/test/librados/misc_cxx.cc b/src/test/librados/misc_cxx.cc index e7ad1ec59ef..0241f1dfeb9 100644 --- a/src/test/librados/misc_cxx.cc +++ b/src/test/librados/misc_cxx.cc @@ -21,10 +21,8 @@ #include "test/librados/testcase_cxx.h" #include "test/librados/test_cxx.h" +using namespace std; using namespace librados; -using std::map; -using std::ostringstream; -using std::string; typedef RadosTestPP LibRadosMiscPP; typedef RadosTestECPP LibRadosMiscECPP; diff --git a/src/test/librados/service.cc b/src/test/librados/service.cc index 223dc967b9a..55197b6f960 100644 --- a/src/test/librados/service.cc +++ b/src/test/librados/service.cc @@ -14,6 +14,7 @@ #include "gtest/gtest.h" #include "test/unit.cc" +using namespace std; using namespace librados; TEST(LibRadosService, RegisterEarly) { diff --git a/src/test/librados/service_cxx.cc b/src/test/librados/service_cxx.cc index 40869f0f8d9..1bf682af8c5 100644 --- a/src/test/librados/service_cxx.cc +++ b/src/test/librados/service_cxx.cc @@ -10,6 +10,7 @@ #include "test/librados/testcase_cxx.h" #include "test/unit.cc" +using namespace std; using namespace librados; TEST(LibRadosServicePP, RegisterEarly) { diff --git a/src/test/librados/test_common.cc b/src/test/librados/test_common.cc index c17b710d17c..647a9ff4858 100644 --- a/src/test/librados/test_common.cc +++ b/src/test/librados/test_common.cc @@ -6,6 +6,8 @@ #include "json_spirit/json_spirit.h" #include "test_common.h" +using namespace std; + namespace { using namespace ceph; diff --git a/src/test/librados/tier_cxx.cc b/src/test/librados/tier_cxx.cc index 06c3f77dc43..bd9ad2147b4 100644 --- a/src/test/librados/tier_cxx.cc +++ b/src/test/librados/tier_cxx.cc @@ -26,10 +26,8 @@ #include "cls/cas/cls_cas_client.h" #include "cls/cas/cls_cas_internal.h" +using namespace std; using namespace librados; -using std::map; -using std::ostringstream; -using std::string; typedef RadosTestPP LibRadosTierPP; typedef RadosTestECPP LibRadosTierECPP; diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index c567147e7a2..b5ceb53eae9 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -31,6 +31,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rados +using namespace std; + namespace librados { MockTestMemIoCtxImpl &get_mock_io_ctx(IoCtx &ioctx) { diff --git a/src/test/librados_test_stub/TestIoCtxImpl.cc b/src/test/librados_test_stub/TestIoCtxImpl.cc index 73bc8d4a885..0b106e1d122 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestIoCtxImpl.cc @@ -13,6 +13,8 @@ #include <functional> #include <errno.h> +using namespace std; + namespace librados { TestIoCtxImpl::TestIoCtxImpl() : m_client(NULL) { diff --git a/src/test/librgw_file.cc b/src/test/librgw_file.cc index fea8a061191..b206f24932c 100644 --- a/src/test/librgw_file.cc +++ b/src/test/librgw_file.cc @@ -26,6 +26,8 @@ #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { librgw_t rgw = nullptr; string uid("testuser"); diff --git a/src/test/librgw_file_aw.cc b/src/test/librgw_file_aw.cc index 0a9f91b7090..224366b4360 100644 --- a/src/test/librgw_file_aw.cc +++ b/src/test/librgw_file_aw.cc @@ -30,6 +30,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { librgw_t rgw = nullptr; string userid("testuser"); diff --git a/src/test/librgw_file_cd.cc b/src/test/librgw_file_cd.cc index ff0bd1fbde2..8bbe350ac24 100644 --- a/src/test/librgw_file_cd.cc +++ b/src/test/librgw_file_cd.cc @@ -25,6 +25,8 @@ #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { librgw_t rgw = nullptr; string userid("testuser"); diff --git a/src/test/librgw_file_gp.cc b/src/test/librgw_file_gp.cc index bde68fb4b9e..757fdfd8da2 100644 --- a/src/test/librgw_file_gp.cc +++ b/src/test/librgw_file_gp.cc @@ -30,6 +30,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { librgw_t rgw = nullptr; string uid("testuser"); diff --git a/src/test/librgw_file_marker.cc b/src/test/librgw_file_marker.cc index 2475423fd46..3e2bce95e78 100644 --- a/src/test/librgw_file_marker.cc +++ b/src/test/librgw_file_marker.cc @@ -31,6 +31,8 @@ #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { using namespace rgw; diff --git a/src/test/librgw_file_nfsns.cc b/src/test/librgw_file_nfsns.cc index b2a8fd27b06..eb48a1ee71c 100644 --- a/src/test/librgw_file_nfsns.cc +++ b/src/test/librgw_file_nfsns.cc @@ -30,6 +30,8 @@ #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { using namespace rgw; diff --git a/src/test/librgw_file_xattr.cc b/src/test/librgw_file_xattr.cc index bb4b74c9e25..73902c4810b 100644 --- a/src/test/librgw_file_xattr.cc +++ b/src/test/librgw_file_xattr.cc @@ -35,6 +35,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { using namespace rgw; diff --git a/src/test/mds/TestMDSAuthCaps.cc b/src/test/mds/TestMDSAuthCaps.cc index 3556a8591c1..4828032dbd6 100644 --- a/src/test/mds/TestMDSAuthCaps.cc +++ b/src/test/mds/TestMDSAuthCaps.cc @@ -19,8 +19,7 @@ #include "gtest/gtest.h" -using std::string; -using std::cout; +using namespace std; entity_addr_t addr; diff --git a/src/test/mgr/test_mgrcap.cc b/src/test/mgr/test_mgrcap.cc index 90933dd7c52..279e0c28e91 100644 --- a/src/test/mgr/test_mgrcap.cc +++ b/src/test/mgr/test_mgrcap.cc @@ -19,6 +19,8 @@ #include "gtest/gtest.h" +using namespace std; + const char *parse_good[] = { // MgrCapMatch diff --git a/src/test/mon/PGMap.cc b/src/test/mon/PGMap.cc index 7566651323f..1d0536c178f 100644 --- a/src/test/mon/PGMap.cc +++ b/src/test/mon/PGMap.cc @@ -16,6 +16,7 @@ #include "include/stringify.h" +using namespace std; namespace { class CheckTextTable : public TextTable { diff --git a/src/test/mon/moncap.cc b/src/test/mon/moncap.cc index 1c151b1e399..dd86224bd68 100644 --- a/src/test/mon/moncap.cc +++ b/src/test/mon/moncap.cc @@ -19,6 +19,8 @@ #include "gtest/gtest.h" +using namespace std; + const char *parse_good[] = { // MonCapMatch diff --git a/src/test/mon/test-mon-msg.cc b/src/test/mon/test-mon-msg.cc index fede9df8f15..4a05876154e 100644 --- a/src/test/mon/test-mon-msg.cc +++ b/src/test/mon/test-mon-msg.cc @@ -48,6 +48,8 @@ #undef dout_prefix #define dout_prefix *_dout << "test-mon-msg " +using namespace std; + class MonClientHelper : public Dispatcher { protected: diff --git a/src/test/msgr/test_async_driver.cc b/src/test/msgr/test_async_driver.cc index e6a217af309..6cf4211b6df 100644 --- a/src/test/msgr/test_async_driver.cc +++ b/src/test/msgr/test_async_driver.cc @@ -58,6 +58,7 @@ #include <gtest/gtest.h> +using namespace std; class EventDriverTest : public ::testing::TestWithParam<const char*> { public: diff --git a/src/test/msgr/test_async_networkstack.cc b/src/test/msgr/test_async_networkstack.cc index f6d04f0a0ee..d369833b846 100644 --- a/src/test/msgr/test_async_networkstack.cc +++ b/src/test/msgr/test_async_networkstack.cc @@ -30,6 +30,7 @@ #include "msg/async/Event.h" #include "msg/async/Stack.h" +using namespace std; class NoopConfigObserver : public md_config_obs_t { std::list<std::string> options; diff --git a/src/test/msgr/test_frames_v2.cc b/src/test/msgr/test_frames_v2.cc index 725903251a7..cbcf6cab48d 100644 --- a/src/test/msgr/test_frames_v2.cc +++ b/src/test/msgr/test_frames_v2.cc @@ -36,6 +36,8 @@ EXPECT_EQ(val1, val2); \ } +using namespace std; + namespace ceph::msgr::v2 { // MessageFrame with the first segment not fixed to ceph_msg_header2 diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index 3ebe320be11..68133224c21 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -59,6 +59,8 @@ typedef boost::mt11213b gen_type; } \ } while(0); +using namespace std; + class MessengerTest : public ::testing::TestWithParam<const char*> { public: DummyAuthClientServer dummy_auth; diff --git a/src/test/objectstore/Allocator_bench.cc b/src/test/objectstore/Allocator_bench.cc index 4977d6a545b..0d04a854e9a 100644 --- a/src/test/objectstore/Allocator_bench.cc +++ b/src/test/objectstore/Allocator_bench.cc @@ -21,6 +21,8 @@ typedef boost::mt11213b gen_type; #define dout_context g_ceph_context #define dout_subsys ceph_subsys_ +using namespace std; + class AllocTest : public ::testing::TestWithParam<const char*> { public: diff --git a/src/test/objectstore/DeterministicOpSequence.cc b/src/test/objectstore/DeterministicOpSequence.cc index 76b2cd55105..a51c5cfc6c6 100644 --- a/src/test/objectstore/DeterministicOpSequence.cc +++ b/src/test/objectstore/DeterministicOpSequence.cc @@ -34,6 +34,8 @@ #undef dout_prefix #define dout_prefix *_dout << "deterministic_seq " +using namespace std; + DeterministicOpSequence::DeterministicOpSequence(ObjectStore *store, std::string status) : TestObjectStoreState(store), diff --git a/src/test/objectstore/DeterministicOpSequence.h b/src/test/objectstore/DeterministicOpSequence.h index 5a5a6ad93ce..9c085d9a414 100644 --- a/src/test/objectstore/DeterministicOpSequence.h +++ b/src/test/objectstore/DeterministicOpSequence.h @@ -81,7 +81,7 @@ protected: uint64_t len, const bufferlist& data); virtual void _do_set_attrs(coll_entry_t *entry, hobject_t &obj, - const map<string, bufferlist> &attrs); + const std::map<std::string, bufferlist> &attrs); virtual void _do_clone(coll_entry_t *entry, hobject_t& orig_obj, hobject_t& new_obj); virtual void _do_clone_range(coll_entry_t *entry, hobject_t& orig_obj, hobject_t& new_obj, uint64_t srcoff, uint64_t srclen, uint64_t dstoff); diff --git a/src/test/objectstore/FileStoreDiff.cc b/src/test/objectstore/FileStoreDiff.cc index a99e6f3d7d4..c356f29b31b 100644 --- a/src/test/objectstore/FileStoreDiff.cc +++ b/src/test/objectstore/FileStoreDiff.cc @@ -25,6 +25,8 @@ #undef dout_prefix #define dout_prefix *_dout << "filestore_diff " +using namespace std; + FileStoreDiff::FileStoreDiff(FileStore *a, FileStore *b) : a_store(a), b_store(b) { diff --git a/src/test/objectstore/FileStoreTracker.cc b/src/test/objectstore/FileStoreTracker.cc index 880d26dfe9f..7d091cf3ee7 100644 --- a/src/test/objectstore/FileStoreTracker.cc +++ b/src/test/objectstore/FileStoreTracker.cc @@ -5,6 +5,8 @@ #include <boost/scoped_ptr.hpp> #include "include/Context.h" +using namespace std; + class OnApplied : public Context { FileStoreTracker *tracker; list<pair<pair<coll_t, string>, uint64_t> > in_flight; diff --git a/src/test/objectstore/FileStoreTracker.h b/src/test/objectstore/FileStoreTracker.h index 90c456250ce..555e48fe5c7 100644 --- a/src/test/objectstore/FileStoreTracker.h +++ b/src/test/objectstore/FileStoreTracker.h @@ -18,7 +18,7 @@ class FileStoreTracker { uint64_t restart_seq; struct OutTransaction { - list<pair<pair<coll_t, string>, uint64_t> > *in_flight; + std::list<std::pair<std::pair<coll_t, std::string>, uint64_t> > *in_flight; ObjectStore::Transaction *t; }; public: @@ -33,75 +33,77 @@ public: OutTransaction *out) = 0; virtual ~Op() {}; }; - list<Op*> ops; + std::list<Op*> ops; class Write : public Op { public: coll_t coll; - string oid; + std::string oid; Write(const coll_t &coll, - const string &oid) + const std::string &oid) : coll(coll), oid(oid) {} void operator()(FileStoreTracker *harness, OutTransaction *out) override { - harness->write(make_pair(coll, oid), out); + harness->write(std::make_pair(coll, oid), out); } }; class CloneRange : public Op { public: coll_t coll; - string from; - string to; + std::string from; + std::string to; CloneRange(const coll_t &coll, - const string &from, - const string &to) + const std::string &from, + const std::string &to) : coll(coll), from(from), to(to) {} void operator()(FileStoreTracker *harness, OutTransaction *out) override { - harness->clone_range(make_pair(coll, from), make_pair(coll, to), + harness->clone_range(std::make_pair(coll, from), + std::make_pair(coll, to), out); } }; class Clone : public Op { public: coll_t coll; - string from; - string to; + std::string from; + std::string to; Clone(const coll_t &coll, - const string &from, - const string &to) + const std::string &from, + const std::string &to) : coll(coll), from(from), to(to) {} void operator()(FileStoreTracker *harness, OutTransaction *out) override { - harness->clone(make_pair(coll, from), make_pair(coll, to), - out); + harness->clone(std::make_pair(coll, from), + std::make_pair(coll, to), + out); } }; class Remove: public Op { public: coll_t coll; - string obj; + std::string obj; Remove(const coll_t &coll, - const string &obj) + const std::string &obj) : coll(coll), obj(obj) {} void operator()(FileStoreTracker *harness, OutTransaction *out) override { - harness->remove(make_pair(coll, obj), + harness->remove(std::make_pair(coll, obj), out); } }; public: - void write(const coll_t &coll, const string &oid) { + void write(const coll_t &coll, const std::string &oid) { ops.push_back(new Write(coll, oid)); } - void clone_range(const coll_t &coll, const string &from, - const string &to) { + void clone_range(const coll_t &coll, const std::string &from, + const std::string &to) { ops.push_back(new CloneRange(coll, from, to)); } - void clone(const coll_t &coll, const string &from, - const string &to) { + void clone(const coll_t &coll, const std::string &from, + const std::string &to) { ops.push_back(new Clone(coll, from, to)); } - void remove(const coll_t &coll, const string &oid) { + void remove(const coll_t &coll, const std::string &oid) { ops.push_back(new Remove(coll, oid)); } friend class FileStoreTracker; @@ -110,26 +112,26 @@ public: int init(); void submit_transaction(Transaction &t); void verify(const coll_t &coll, - const string &from, + const std::string &from, bool on_start = false); private: - ObjectContents get_current_content(const pair<coll_t, string> &obj); - pair<uint64_t, uint64_t> get_valid_reads(const pair<coll_t, string> &obj); - ObjectContents get_content(const pair<coll_t, string> &obj, uint64_t version); + ObjectContents get_current_content(const std::pair<coll_t, std::string> &obj); + std::pair<uint64_t, uint64_t> get_valid_reads(const std::pair<coll_t, std::string> &obj); + ObjectContents get_content(const std::pair<coll_t, std::string> &obj, uint64_t version); - void committed(const pair<coll_t, string> &obj, uint64_t seq); - void applied(const pair<coll_t, string> &obj, uint64_t seq); - uint64_t set_content(const pair<coll_t, string> &obj, ObjectContents &content); + void committed(const std::pair<coll_t, std::string> &obj, uint64_t seq); + void applied(const std::pair<coll_t, std::string> &obj, uint64_t seq); + uint64_t set_content(const std::pair<coll_t, std::string> &obj, ObjectContents &content); // ObjectContents Operations - void write(const pair<coll_t, string> &obj, OutTransaction *out); - void remove(const pair<coll_t, string> &obj, OutTransaction *out); - void clone_range(const pair<coll_t, string> &from, - const pair<coll_t, string> &to, + void write(const std::pair<coll_t, std::string> &obj, OutTransaction *out); + void remove(const std::pair<coll_t, std::string> &obj, OutTransaction *out); + void clone_range(const std::pair<coll_t, std::string> &from, + const std::pair<coll_t, std::string> &to, OutTransaction *out); - void clone(const pair<coll_t, string> &from, - const pair<coll_t, string> &to, + void clone(const std::pair<coll_t, std::string> &from, + const std::pair<coll_t, std::string> &to, OutTransaction *out); friend class OnApplied; friend class OnCommitted; diff --git a/src/test/objectstore/TestObjectStoreState.cc b/src/test/objectstore/TestObjectStoreState.cc index fcda2d55038..f4ccef4f08c 100644 --- a/src/test/objectstore/TestObjectStoreState.cc +++ b/src/test/objectstore/TestObjectStoreState.cc @@ -30,6 +30,8 @@ #undef dout_prefix #define dout_prefix *_dout << "ceph_test_objectstore_state " +using namespace std; + void TestObjectStoreState::init(int colls, int objs) { dout(5) << "init " << colls << " colls " << objs << " objs" << dendl; diff --git a/src/test/objectstore/TestObjectStoreState.h b/src/test/objectstore/TestObjectStoreState.h index 360f434fbae..d1e31bd8aec 100644 --- a/src/test/objectstore/TestObjectStoreState.h +++ b/src/test/objectstore/TestObjectStoreState.h @@ -31,7 +31,7 @@ public: coll_t m_cid; ghobject_t m_meta_obj; ObjectStore::CollectionHandle m_ch; - map<int, hobject_t*> m_objects; + std::map<int, hobject_t*> m_objects; int m_next_object_id; coll_entry_t(spg_t pgid, ObjectStore::CollectionHandle& ch, @@ -62,8 +62,8 @@ public: protected: boost::shared_ptr<ObjectStore> m_store; - map<coll_t, coll_entry_t*> m_collections; - vector<coll_t> m_collections_ids; + std::map<coll_t, coll_entry_t*> m_collections; + std::vector<coll_t> m_collections_ids; int m_next_coll_nr; int m_num_objs_per_coll; int m_num_objects; diff --git a/src/test/objectstore/allocator_replay_test.cc b/src/test/objectstore/allocator_replay_test.cc index 3fe0d362b35..f9a35bbe4be 100644 --- a/src/test/objectstore/allocator_replay_test.cc +++ b/src/test/objectstore/allocator_replay_test.cc @@ -15,6 +15,7 @@ #include "global/global_init.h" #include "os/bluestore/Allocator.h" +using namespace std; void usage(const string &name) { cerr << "Usage: " << name << " <log_to_replay> <raw_duplicate|free_dump>" diff --git a/src/test/objectstore/test_idempotent.cc b/src/test/objectstore/test_idempotent.cc index 0889375ed17..267f4e7c96b 100644 --- a/src/test/objectstore/test_idempotent.cc +++ b/src/test/objectstore/test_idempotent.cc @@ -25,6 +25,8 @@ #include "kv/KeyValueDB.h" #include "os/ObjectStore.h" +using namespace std; + void usage(const string &name) { std::cerr << "Usage: " << name << " [new|continue] store_path store_journal db_path" << std::endl; diff --git a/src/test/objectstore/test_idempotent_sequence.cc b/src/test/objectstore/test_idempotent_sequence.cc index 7cf31fa9298..de053859e7a 100644 --- a/src/test/objectstore/test_idempotent_sequence.cc +++ b/src/test/objectstore/test_idempotent_sequence.cc @@ -32,6 +32,8 @@ #undef dout_prefix #define dout_prefix *_dout << "test_idempotent_sequence " +using namespace std; + void usage(const char *name, std::string command = "") { ceph_assert(name != NULL); diff --git a/src/test/objectstore/test_kv.cc b/src/test/objectstore/test_kv.cc index c6efb44afdc..1de904adc23 100644 --- a/src/test/objectstore/test_kv.cc +++ b/src/test/objectstore/test_kv.cc @@ -27,6 +27,8 @@ #include "include/stringify.h" #include <gtest/gtest.h> +using namespace std; + class KVTest : public ::testing::TestWithParam<const char*> { public: boost::scoped_ptr<KeyValueDB> db; diff --git a/src/test/objectstore_bench.cc b/src/test/objectstore_bench.cc index 7bcc7b2af08..da29599cf83 100644 --- a/src/test/objectstore_bench.cc +++ b/src/test/objectstore_bench.cc @@ -18,6 +18,8 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_filestore +using namespace std; + static void usage() { cout << "usage: ceph_objectstore_bench [flags]\n" diff --git a/src/test/omap_bench.h b/src/test/omap_bench.h index 6fc57583a48..1874bd8d60c 100644 --- a/src/test/omap_bench.h +++ b/src/test/omap_bench.h @@ -31,7 +31,7 @@ struct o_bench_data { int started_ops; int completed_ops; std::map<int,int> freq_map; - pair<int,int> mode; + std::pair<int,int> mode; o_bench_data() : avg_latency(0.0), min_latency(DBL_MAX), max_latency(0.0), total_latency(0.0), @@ -49,7 +49,7 @@ typedef int (OmapBench::*test_t)(omap_generator_t omap_gen); class Writer{ protected: - string oid; + std::string oid; utime_t begin_time; utime_t end_time; std::map<std::string,bufferlist> omap; @@ -61,7 +61,7 @@ public: virtual void start_time(); virtual void stop_time(); virtual double get_time(); - virtual string get_oid(); + virtual std::string get_oid(); virtual std::map<std::string,bufferlist> & get_omap(); }; @@ -94,9 +94,9 @@ protected: int busythreads_count; librados::callback_t comp; - string pool_name; - string rados_id; - string prefix; + std::string pool_name; + std::string rados_id; + std::string prefix; int threads; int objects; int entries_per_omap; @@ -137,7 +137,7 @@ public: /** * Generates a random string len characters long */ - static string random_string(int len); + static std::string random_string(int len); /* * runs the test specified by test using the omap generator specified by diff --git a/src/test/osd/TestECBackend.cc b/src/test/osd/TestECBackend.cc index affff369442..1c13fb4c95c 100644 --- a/src/test/osd/TestECBackend.cc +++ b/src/test/osd/TestECBackend.cc @@ -19,6 +19,8 @@ #include "osd/ECBackend.h" #include "gtest/gtest.h" +using namespace std; + TEST(ECUtil, stripe_info_t) { const uint64_t swidth = 4096; diff --git a/src/test/osd/TestOpStat.h b/src/test/osd/TestOpStat.h index a279287fde6..2c680558ff1 100644 --- a/src/test/osd/TestOpStat.h +++ b/src/test/osd/TestOpStat.h @@ -23,8 +23,8 @@ public: class TypeStatus { public: - map<TestOp*,uint64_t> inflight; - multiset<uint64_t> latencies; + std::map<TestOp*,uint64_t> inflight; + std::multiset<uint64_t> latencies; void begin(TestOp *in) { ceph_assert(!inflight.count(in)); @@ -39,9 +39,9 @@ public: inflight.erase(in); } - void export_latencies(map<double,uint64_t> &in) const; + void export_latencies(std::map<double,uint64_t> &in) const; }; - map<string,TypeStatus> stats; + std::map<std::string,TypeStatus> stats; void begin(TestOp *in); void end(TestOp *in); diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index 3c45d1212e4..3aab689a6d2 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -27,6 +27,7 @@ #include "include/coredumpctl.h" #include "../objectstore/store_test_fixture.h" +using namespace std; struct PGLogTestBase { static hobject_t mk_obj(unsigned id) { diff --git a/src/test/osd/ceph_test_osd_stale_read.cc b/src/test/osd/ceph_test_osd_stale_read.cc index 41b5aa6d348..5623d47f65e 100644 --- a/src/test/osd/ceph_test_osd_stale_read.cc +++ b/src/test/osd/ceph_test_osd_stale_read.cc @@ -21,10 +21,8 @@ #include <sstream> #include <string> +using namespace std; using namespace librados; -using std::map; -using std::ostringstream; -using std::string; int get_primary_osd(Rados& rados, const string& pool_name, const string& oid, int *pprimary) diff --git a/src/test/osd/osdcap.cc b/src/test/osd/osdcap.cc index f1b80faaea4..f8e29aa3766 100644 --- a/src/test/osd/osdcap.cc +++ b/src/test/osd/osdcap.cc @@ -19,6 +19,8 @@ #include "gtest/gtest.h" +using namespace std; + const char *parse_good[] = { "allow *", "allow r", diff --git a/src/test/osd/test_extent_cache.cc b/src/test/osd/test_extent_cache.cc index 04b638a9a90..9c789ca3274 100644 --- a/src/test/osd/test_extent_cache.cc +++ b/src/test/osd/test_extent_cache.cc @@ -17,6 +17,8 @@ #include "osd/ExtentCache.h" #include <iostream> +using namespace std; + extent_map imap_from_vector(vector<pair<uint64_t, uint64_t> > &&in) { extent_map out; diff --git a/src/test/osd/test_pg_transaction.cc b/src/test/osd/test_pg_transaction.cc index 63b6197bf2d..6aa26920d46 100644 --- a/src/test/osd/test_pg_transaction.cc +++ b/src/test/osd/test_pg_transaction.cc @@ -15,6 +15,8 @@ #include <gtest/gtest.h> #include "osd/PGTransaction.h" +using namespace std; + TEST(pgtransaction, simple) { hobject_t h; diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index c452176bcfc..d7b7862f513 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -25,6 +25,8 @@ #include "osd/ReplicatedBackend.h" #include <sstream> +using namespace std; + TEST(hobject, prefixes0) { uint32_t mask = 0xE947FA20; diff --git a/src/test/osdc/object_cacher_stress.cc b/src/test/osdc/object_cacher_stress.cc index 371117ef6f2..f69905017f1 100644 --- a/src/test/osdc/object_cacher_stress.cc +++ b/src/test/osdc/object_cacher_stress.cc @@ -24,6 +24,8 @@ #include <atomic> +using namespace std; + // XXX: Only tests default namespace struct op_data { op_data(const std::string &oid, uint64_t offset, uint64_t len, bool read) diff --git a/src/test/perf_counters.cc b/src/test/perf_counters.cc index cacf218912e..a4dfe48d1e7 100644 --- a/src/test/perf_counters.cc +++ b/src/test/perf_counters.cc @@ -46,6 +46,8 @@ #include "common/common_init.h" +using namespace std; + int main(int argc, char **argv) { map<string,string> defaults = { { "admin_socket", get_rand_socket_path() } @@ -252,4 +254,4 @@ TEST(PerfCounters, read_avg) { std::thread t2(counters_readavg_test, fake_pf); t2.join(); t1.join(); -}
\ No newline at end of file +} diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index ecd7dc79246..460411fc0d5 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -58,6 +58,7 @@ #include <atomic> +using namespace std; using namespace ceph; /** diff --git a/src/test/rbd_mirror/random_write.cc b/src/test/rbd_mirror/random_write.cc index 373d004a71f..4a473ed3466 100644 --- a/src/test/rbd_mirror/random_write.cc +++ b/src/test/rbd_mirror/random_write.cc @@ -67,6 +67,7 @@ struct rbd_bencher { } void wait_for(int max) { + using namespace std::chrono_literals; std::unique_lock l{lock}; while (in_flight > max) { cond.wait_for(l, 200ms); diff --git a/src/test/rgw/test_cls_fifo_legacy.cc b/src/test/rgw/test_cls_fifo_legacy.cc index 02678c52212..e4c4375c4de 100644 --- a/src/test/rgw/test_cls_fifo_legacy.cc +++ b/src/test/rgw/test_cls_fifo_legacy.cc @@ -30,6 +30,9 @@ #include "gtest/gtest.h" +using namespace std::literals; +using namespace std::string_literals; + namespace R = librados; namespace cb = ceph::buffer; namespace fifo = rados::cls::fifo; diff --git a/src/test/rgw/test_log_backing.cc b/src/test/rgw/test_log_backing.cc index c67debb9f59..6c9a1b9e3c0 100644 --- a/src/test/rgw/test_log_backing.cc +++ b/src/test/rgw/test_log_backing.cc @@ -189,7 +189,7 @@ TEST_F(LogBacking, TestFIFOEmpty) } TEST(CursorGen, RoundTrip) { - const auto pcurs = "fded"sv; + const std::string_view pcurs = "fded"; { auto gc = gencursor(0, pcurs); ASSERT_EQ(pcurs, gc); diff --git a/src/test/rgw/test_rgw_common.h b/src/test/rgw/test_rgw_common.h index 29ab3e4ac38..40a48ee320a 100644 --- a/src/test/rgw/test_rgw_common.h +++ b/src/test/rgw/test_rgw_common.h @@ -101,7 +101,7 @@ struct old_rgw_bucket { void dump(Formatter *f) const; void decode_json(JSONObj *obj); - static void generate_test_instances(list<old_rgw_bucket*>& o); + static void generate_test_instances(std::list<old_rgw_bucket*>& o); bool operator<(const old_rgw_bucket& b) const { return name.compare(b.name) < 0; @@ -167,7 +167,7 @@ public: } int clear_instance() { - return set_instance(string()); + return set_instance(std::string()); } void set_loc(const std::string& k) { @@ -217,7 +217,7 @@ public: object = "_"; object.append(ns); if (need_to_encode_instance()) { - object.append(string(":") + instance); + object.append(std::string(":") + instance); } object.append("_"); object.append(o); @@ -269,7 +269,7 @@ public: key->instance = instance; } - static void parse_ns_field(string& ns, std::string& instance) { + static void parse_ns_field(std::string& ns, std::string& instance) { int pos = ns.find(':'); if (pos >= 0) { instance = ns.substr(pos + 1); @@ -290,7 +290,7 @@ public: * and cuts down the name to the unmangled version. If it is not * part of the given namespace, it returns false. */ - static bool translate_raw_obj_to_obj_in_ns(string& obj, std::string& instance, std::string& ns) { + static bool translate_raw_obj_to_obj_in_ns(std::string& obj, std::string& instance, std::string& ns) { if (obj[0] != '_') { if (ns.empty()) { return true; @@ -342,7 +342,7 @@ public: * It returns true after successfully doing so, or * false if it fails. */ - static bool strip_namespace_from_object(string& obj, std::string& ns, std::string& instance) { + static bool strip_namespace_from_object(std::string& obj, std::string& ns, std::string& instance) { ns.clear(); instance.clear(); if (obj[0] != '_') { @@ -448,7 +448,7 @@ public: }; WRITE_CLASS_ENCODER(old_rgw_obj) -static inline void prepend_old_bucket_marker(const old_rgw_bucket& bucket, const string& orig_oid, string& oid) +static inline void prepend_old_bucket_marker(const old_rgw_bucket& bucket, const std::string& orig_oid, std::string& oid) { if (bucket.marker.empty() || orig_oid.empty()) { oid = orig_oid; diff --git a/src/test/test_addrs.cc b/src/test/test_addrs.cc index c8d492c7d3c..442931947b1 100644 --- a/src/test/test_addrs.cc +++ b/src/test/test_addrs.cc @@ -19,6 +19,8 @@ #include <sstream> +using namespace std; + // input, parsed+printed addr output, leftover // if the parse fails, output + leftover should both be blank. const char *addr_checks[][3] = { diff --git a/src/test/test_c2c.cc b/src/test/test_c2c.cc index 07f6752d777..a8b12dadd41 100644 --- a/src/test/test_c2c.cc +++ b/src/test/test_c2c.cc @@ -27,14 +27,14 @@ void sigterm_handler(int signum) for (auto& shard : shards) { total += shard.bytes; } - cout << total << std::endl; + std::cout << total << std::endl; exit(0); } int main(int argc, const char **argv) { int ret = 0; - vector<const char*> args; + std::vector<const char*> args; argv_to_vec(argc, argv, args); auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, diff --git a/src/test/test_denc.cc b/src/test/test_denc.cc index 0924ee4eda2..0aae8dbbcc4 100644 --- a/src/test/test_denc.cc +++ b/src/test/test_denc.cc @@ -24,6 +24,8 @@ #include "include/denc.h" +using namespace std; + // test helpers template<typename T> diff --git a/src/test/test_features.cc b/src/test/test_features.cc index bfd2c537c2a..5a13647e9f1 100644 --- a/src/test/test_features.cc +++ b/src/test/test_features.cc @@ -10,6 +10,7 @@ #include "gtest/gtest.h" #include "include/ceph_features.h" +using namespace std; TEST(features, release_features) { diff --git a/src/test/test_filejournal.cc b/src/test/test_filejournal.cc index b34c1d028bb..356b1932328 100644 --- a/src/test/test_filejournal.cc +++ b/src/test/test_filejournal.cc @@ -14,6 +14,8 @@ #include "common/safe_io.h" #include "os/filestore/JournalingObjectStore.h" +using namespace std; + Finisher *finisher; ceph::condition_variable sync_cond; char path[200]; diff --git a/src/test/test_ipaddr.cc b/src/test/test_ipaddr.cc index c7f42dad34c..bc8dbef70d7 100644 --- a/src/test/test_ipaddr.cc +++ b/src/test/test_ipaddr.cc @@ -19,6 +19,8 @@ #include <net/if.h> #endif +using namespace std; + static void ipv4(struct sockaddr_in *addr, const char *s) { int err; diff --git a/src/test/test_mempool.cc b/src/test/test_mempool.cc index 6ac3bc31e6a..4b8c144be23 100644 --- a/src/test/test_mempool.cc +++ b/src/test/test_mempool.cc @@ -23,6 +23,8 @@ #include "include/btree_map.h" #include "include/mempool.h" +using namespace std; + void check_usage(mempool::pool_index_t ix) { mempool::pool_t *pool = &mempool::get_pool(ix); diff --git a/src/test/test_mutate.cc b/src/test/test_mutate.cc index b453895ccc1..98841e7cc09 100644 --- a/src/test/test_mutate.cc +++ b/src/test/test_mutate.cc @@ -41,7 +41,7 @@ static void usage(void) int main(int argc, const char **argv) { int ret = 0; - vector<const char*> args; + std::vector<const char*> args; argv_to_vec(argc, argv, args); auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, diff --git a/src/test/test_rgw_ldap.cc b/src/test/test_rgw_ldap.cc index 7c36149ade5..0369c933909 100644 --- a/src/test/test_rgw_ldap.cc +++ b/src/test/test_rgw_ldap.cc @@ -28,6 +28,8 @@ #define dout_subsys ceph_subsys_rgw +using namespace std; + namespace { struct { diff --git a/src/test/test_rgw_token.cc b/src/test/test_rgw_token.cc index b9174781933..321e26fcc9c 100644 --- a/src/test/test_rgw_token.cc +++ b/src/test/test_rgw_token.cc @@ -49,6 +49,8 @@ namespace { bool verbose {false}; } +using namespace std; + TEST(TOKEN, INIT) { formatter = new JSONFormatter(true /* pretty */); ASSERT_NE(formatter, nullptr); diff --git a/src/test/test_striper.cc b/src/test/test_striper.cc index c294d646820..ee70304ebc8 100644 --- a/src/test/test_striper.cc +++ b/src/test/test_striper.cc @@ -3,6 +3,8 @@ #include "osdc/Striper.h" +using namespace std; + TEST(Striper, Stripe1) { file_layout_t l; diff --git a/src/test/test_trans.cc b/src/test/test_trans.cc index b52c6109cbf..98e407927e4 100644 --- a/src/test/test_trans.cc +++ b/src/test/test_trans.cc @@ -24,6 +24,8 @@ #undef dout_prefix #define dout_prefix *_dout +using namespace std; + struct Foo : public Thread { void *entry() override { dout(0) << "foo started" << dendl; diff --git a/src/test/test_utime.cc b/src/test/test_utime.cc index dd26093c089..b1cee0e805c 100644 --- a/src/test/test_utime.cc +++ b/src/test/test_utime.cc @@ -3,6 +3,8 @@ #include "include/stringify.h" #include "common/ceph_context.h" +using namespace std; + TEST(utime_t, localtime) { utime_t t(1556122013, 839991182); diff --git a/src/test/test_workqueue.cc b/src/test/test_workqueue.cc index 5995015addc..d3354d633ca 100644 --- a/src/test/test_workqueue.cc +++ b/src/test/test_workqueue.cc @@ -3,6 +3,8 @@ #include "common/WorkQueue.h" #include "common/ceph_argparse.h" +using namespace std; + TEST(WorkQueue, StartStop) { ThreadPool tp(g_ceph_context, "foo", "tp_foo", 10, ""); diff --git a/src/test/testcrypto.cc b/src/test/testcrypto.cc index 4e8a7e2c86e..2efb9b219b9 100644 --- a/src/test/testcrypto.cc +++ b/src/test/testcrypto.cc @@ -10,6 +10,8 @@ #define dout_context g_ceph_context +using namespace std; + int main(int argc, char *argv[]) { char aes_key[AES_KEY_LEN]; diff --git a/src/test/testkeys.cc b/src/test/testkeys.cc index 16e52d6db1c..3ad794f5eda 100644 --- a/src/test/testkeys.cc +++ b/src/test/testkeys.cc @@ -8,6 +8,8 @@ #define AES_KEY_LEN 16 +using namespace std; + int main(int argc, const char **argv) { vector<const char*> args; |