summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam C. Emerson <aemerson@redhat.com>2022-01-21 19:57:00 -0500
committerAdam C. Emerson <aemerson@redhat.com>2022-01-21 22:28:28 -0500
commitae07ccb15239383771cd7c95985b08ca459ba05b (patch)
treef8ab8cf4136a5cca58ca9bf1782621aa3a3342c8
parent6bb7dce6a5a3501d5f13da81cad582d366883502 (diff)
downloadceph-ae07ccb15239383771cd7c95985b08ca459ba05b.tar.gz
test: Remove straggling `using namespace std` from headers
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
-rw-r--r--src/test/erasure-code/ErasureCodeExample.h10
-rw-r--r--src/test/erasure-code/TestErasureCodeExample.cc6
-rw-r--r--src/test/erasure-code/ceph_erasure_code_benchmark.cc11
-rw-r--r--src/test/erasure-code/ceph_erasure_code_benchmark.h22
-rw-r--r--src/test/kv_store_bench.h25
-rw-r--r--src/test/librados_test_stub/NeoradosTestStub.cc4
6 files changed, 47 insertions, 31 deletions
diff --git a/src/test/erasure-code/ErasureCodeExample.h b/src/test/erasure-code/ErasureCodeExample.h
index 1185b38d736..4226361c47e 100644
--- a/src/test/erasure-code/ErasureCodeExample.h
+++ b/src/test/erasure-code/ErasureCodeExample.h
@@ -35,15 +35,13 @@
#define MINIMUM_TO_RECOVER 2u
-using namespace std;
-
class ErasureCodeExample final : public ErasureCode {
public:
~ErasureCodeExample() override {}
int create_rule(const std::string &name,
CrushWrapper &crush,
- ostream *ss) const override {
+ std::ostream *ss) const override {
return crush.add_simple_rule(name, "default", "host", "",
"indep", pg_pool_t::TYPE_ERASURE, ss);
}
@@ -70,7 +68,7 @@ public:
c2c[CODING_CHUNK] > c2c[SECOND_DATA_CHUNK])
c2c.erase(CODING_CHUNK);
}
- set <int> available_chunks;
+ std::set <int> available_chunks;
for (std::map<int, int>::const_iterator i = c2c.begin();
i != c2c.end();
++i)
@@ -116,7 +114,7 @@ public:
// to chunk boundaries
//
const bufferptr &ptr = out.front();
- for (set<int>::iterator j = want_to_encode.begin();
+ for (auto j = want_to_encode.begin();
j != want_to_encode.end();
++j) {
bufferlist tmp;
@@ -136,7 +134,7 @@ public:
int _decode(const std::set<int> &want_to_read,
const std::map<int, bufferlist> &chunks,
- std::map<int, bufferlist> *decoded) {
+ std::map<int, bufferlist> *decoded) override {
//
// All chunks have the same size
//
diff --git a/src/test/erasure-code/TestErasureCodeExample.cc b/src/test/erasure-code/TestErasureCodeExample.cc
index 826f3bef177..b488a604b61 100644
--- a/src/test/erasure-code/TestErasureCodeExample.cc
+++ b/src/test/erasure-code/TestErasureCodeExample.cc
@@ -1,4 +1,4 @@
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph distributed storage system
@@ -11,7 +11,7 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
*/
#include <stdlib.h>
@@ -20,6 +20,8 @@
#include "global/global_context.h"
#include "gtest/gtest.h"
+using namespace std;
+
TEST(ErasureCodeExample, chunk_size)
{
ErasureCodeExample example;
diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.cc b/src/test/erasure-code/ceph_erasure_code_benchmark.cc
index 2bcb5f3cd3b..c86e58697c0 100644
--- a/src/test/erasure-code/ceph_erasure_code_benchmark.cc
+++ b/src/test/erasure-code/ceph_erasure_code_benchmark.cc
@@ -35,6 +35,15 @@
#include "erasure-code/ErasureCode.h"
#include "ceph_erasure_code_benchmark.h"
+using std::endl;
+using std::cerr;
+using std::cout;
+using std::map;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
namespace po = boost::program_options;
int ErasureCodeBench::setup(int argc, char** argv) {
@@ -175,7 +184,7 @@ int ErasureCodeBench::encode()
}
utime_t begin_time = ceph_clock_now();
for (int i = 0; i < max_iterations; i++) {
- map<int,bufferlist> encoded;
+ std::map<int,bufferlist> encoded;
code = erasure_code->encode(want_to_encode, in, &encoded);
if (code)
return code;
diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.h b/src/test/erasure-code/ceph_erasure_code_benchmark.h
index c65f716b1e1..59149a74c16 100644
--- a/src/test/erasure-code/ceph_erasure_code_benchmark.h
+++ b/src/test/erasure-code/ceph_erasure_code_benchmark.h
@@ -19,8 +19,16 @@
#define CEPH_ERASURE_CODE_BENCHMARK_H
#include <string>
+#include <map>
+#include <vector>
-using namespace std;
+#include <boost/intrusive_ptr.hpp>
+
+#include "include/buffer.h"
+
+#include "common/ceph_context.h"
+
+#include "erasure-code/ErasureCodeInterface.h"
class ErasureCodeBench {
int in_size;
@@ -29,21 +37,21 @@ class ErasureCodeBench {
int k;
int m;
- string plugin;
+ std::string plugin;
bool exhaustive_erasures;
- vector<int> erased;
- string workload;
+ std::vector<int> erased;
+ std::string workload;
- ErasureCodeProfile profile;
+ ceph::ErasureCodeProfile profile;
bool verbose;
boost::intrusive_ptr<CephContext> cct;
public:
int setup(int argc, char** argv);
int run();
- int decode_erasures(const map<int,bufferlist> &all_chunks,
- const map<int,bufferlist> &chunks,
+ int decode_erasures(const std::map<int, ceph::buffer::list> &all_chunks,
+ const std::map<int, ceph::buffer::list> &chunks,
unsigned i,
unsigned want_erasures,
ErasureCodeInterfaceRef erasure_code);
diff --git a/src/test/kv_store_bench.h b/src/test/kv_store_bench.h
index 733594b70c5..689c769ce52 100644
--- a/src/test/kv_store_bench.h
+++ b/src/test/kv_store_bench.h
@@ -25,9 +25,6 @@
#include <cfloat>
#include <iostream>
-using namespace std;
-using ceph::bufferlist;
-
/**
* stores pairings from op type to time taken for that op (for latency), and to
* time that op completed to the nearest second (for throughput).
@@ -69,7 +66,7 @@ struct timed_args {
StopWatch sw;
//kv_bench_data data;
KvStoreBench * kvsb;
- bufferlist val;
+ ceph::buffer::list val;
int err;
char op;
@@ -86,7 +83,7 @@ struct timed_args {
{}
};
-typedef pair<string, bufferlist> (KvStoreBench::*next_gen_t)(bool new_elem);
+typedef std::pair<std::string, ceph::buffer::list> (KvStoreBench::*next_gen_t)(bool new_elem);
class KvStoreBench {
@@ -107,13 +104,13 @@ protected:
int cache_size; //number of index entries to store in cache
double cache_refresh; //cache_size / cache_refresh entries are read each time
//the index is read
- string client_name;
+ std::string client_name;
bool verbose;//if true, display debug output
//internal
- map<int, char> probs;//map of numbers from 1 to 100 to chars representing
+ std::map<int, char> probs;//map of numbers from 1 to 100 to chars representing
//operation types - used to generate random operations
- set<string> key_set;//set of keys already in the data set
+ std::set<std::string> key_set;//set of keys already in the data set
KeyValueStructure * kvs;
kv_bench_data data;//stores throughput and latency from completed tests
ceph::mutex data_lock = ceph::make_mutex("data lock");
@@ -123,8 +120,8 @@ protected:
ceph::make_mutex("KvStoreBench::ops_in_flight_lock");
//these are used for cleanup and setup purposes - they are NOT passed to kvs!
librados::Rados rados;
- string rados_id;
- string pool_name;
+ std::string rados_id;
+ std::string pool_name;
bool io_ctx_ready;
librados::IoCtx io_ctx;
@@ -153,7 +150,7 @@ public:
/**
* Returns a string of random characters of length len
*/
- string random_string(int len);
+ std::string random_string(int len);
/**
* Inserts entries random keys and values asynchronously.
@@ -164,20 +161,20 @@ public:
* calls test_random_insertions, then does ops randomly chosen operations
* asynchronously, with max_ops_in_flight operations at a time.
*/
- int test_teuthology_aio(next_gen_t distr, const map<int, char> &probs);
+ int test_teuthology_aio(next_gen_t distr, const std::map<int, char> &probs);
/**
* calls test_random_insertions, then does ops randomly chosen operations
* synchronously.
*/
- int test_teuthology_sync(next_gen_t distr, const map<int, char> &probs);
+ int test_teuthology_sync(next_gen_t distr, const std::map<int, char> &probs);
/**
* returns a key-value pair. If new_elem is true, the key is randomly
* generated. If it is false, the key is selected from the keys currently in
* the key set.
*/
- pair<string, bufferlist> rand_distr(bool new_elem);
+ std::pair<std::string, ceph::buffer::list> rand_distr(bool new_elem);
/**
* Called when aio operations complete. Updates data.
diff --git a/src/test/librados_test_stub/NeoradosTestStub.cc b/src/test/librados_test_stub/NeoradosTestStub.cc
index 882e80820c7..c46660c6cd1 100644
--- a/src/test/librados_test_stub/NeoradosTestStub.cc
+++ b/src/test/librados_test_stub/NeoradosTestStub.cc
@@ -22,12 +22,14 @@
#include <boost/system/system_error.hpp>
namespace bs = boost::system;
+using namespace std::literals;
using namespace std::placeholders;
namespace neorados {
namespace detail {
-struct Client {
+class Client {
+public:
ceph::mutex mutex = ceph::make_mutex("NeoradosTestStub::Client");
librados::TestRadosClient* test_rados_client;