Skip to content

Commit

Permalink
test: add override in test submodule
Browse files Browse the repository at this point in the history
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
  • Loading branch information
liuchang0812 committed Mar 3, 2017
1 parent 4ac46fb commit 51f87e2
Show file tree
Hide file tree
Showing 43 changed files with 307 additions and 306 deletions.
4 changes: 2 additions & 2 deletions src/test/ObjectMap/KeyValueDBMemory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WholeSpaceMemIterator : public KeyValueDB::WholeSpaceIteratorImpl {

public:
explicit WholeSpaceMemIterator(KeyValueDBMemory *db) : db(db), ready(false) { }
~WholeSpaceMemIterator() { }
~WholeSpaceMemIterator() override { }

int seek_to_first() override {
if (db->db.empty()) {
Expand Down Expand Up @@ -240,7 +240,7 @@ class WholeSpaceSnapshotMemIterator : public WholeSpaceMemIterator {

explicit WholeSpaceSnapshotMemIterator(KeyValueDBMemory *db) :
WholeSpaceMemIterator(db) { }
~WholeSpaceSnapshotMemIterator() {
~WholeSpaceSnapshotMemIterator() override {
delete db;
}
};
Expand Down
32 changes: 16 additions & 16 deletions src/test/ObjectMap/KeyValueDBMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ class KeyValueDBMemory : public KeyValueDB {

KeyValueDBMemory() { }
explicit KeyValueDBMemory(KeyValueDBMemory *db) : db(db->db) { }
virtual ~KeyValueDBMemory() { }
~KeyValueDBMemory() override { }

virtual int init(string _opt) {
int init(string _opt) override {
return 0;
}
virtual int open(ostream &out) {
int open(ostream &out) override {
return 0;
}
virtual int create_and_open(ostream &out) {
int create_and_open(ostream &out) override {
return 0;
}

int get(
const string &prefix,
const std::set<string> &key,
std::map<string, bufferlist> *out
);
) override;
using KeyValueDB::get;

int get_keys(
Expand Down Expand Up @@ -73,12 +73,12 @@ class KeyValueDBMemory : public KeyValueDB {
const std::pair<string,string> &key,
const bufferlist &value)
: db(db), key(key), value(value) {}
void finish(int r) {
void finish(int r) override {
db->set(key.first, key.second, value);
}
};

void set(const string &prefix, const string &k, const bufferlist& bl) {
void set(const string &prefix, const string &k, const bufferlist& bl) override {
on_commit.push_back(new SetOp(db, std::make_pair(prefix, k), bl));
}

Expand All @@ -88,12 +88,12 @@ class KeyValueDBMemory : public KeyValueDB {
RmKeysOp(KeyValueDBMemory *db,
const std::pair<string,string> &key)
: db(db), key(key) {}
void finish(int r) {
void finish(int r) override {
db->rmkey(key.first, key.second);
}
};

void rmkey(const string &prefix, const string &key) {
void rmkey(const string &prefix, const string &key) override {
on_commit.push_back(new RmKeysOp(db, std::make_pair(prefix, key)));
}

Expand All @@ -103,11 +103,11 @@ class KeyValueDBMemory : public KeyValueDB {
RmKeysByPrefixOp(KeyValueDBMemory *db,
const string &prefix)
: db(db), prefix(prefix) {}
void finish(int r) {
void finish(int r) override {
db->rmkeys_by_prefix(prefix);
}
};
void rmkeys_by_prefix(const string &prefix) {
void rmkeys_by_prefix(const string &prefix) override {
on_commit.push_back(new RmKeysByPrefixOp(db, prefix));
}

Expand All @@ -120,7 +120,7 @@ class KeyValueDBMemory : public KeyValueDB {
return 0;
}

~TransactionImpl_() {
~TransactionImpl_() override {
for (list<Context *>::iterator i = on_commit.begin();
i != on_commit.end();
on_commit.erase(i++)) {
Expand All @@ -129,15 +129,15 @@ class KeyValueDBMemory : public KeyValueDB {
}
};

Transaction get_transaction() {
Transaction get_transaction() override {
return Transaction(new TransactionImpl_(this));
}

int submit_transaction(Transaction trans) {
int submit_transaction(Transaction trans) override {
return static_cast<TransactionImpl_*>(trans.get())->complete();
}

uint64_t get_estimated_size(map<string,uint64_t> &extras) {
uint64_t get_estimated_size(map<string,uint64_t> &extras) override {
uint64_t total_size = 0;

for (map<pair<string,string>,bufferlist>::iterator p = db.begin();
Expand Down Expand Up @@ -165,5 +165,5 @@ class KeyValueDBMemory : public KeyValueDB {
friend class WholeSpaceMemIterator;

protected:
WholeSpaceIterator _get_iterator();
WholeSpaceIterator _get_iterator() override;
};
4 changes: 2 additions & 2 deletions src/test/TestTimers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TestContext : public Context
array_lock.Unlock();
}

~TestContext()
~TestContext() override
{
}

Expand All @@ -63,7 +63,7 @@ class StrictOrderTestContext : public TestContext
array_lock.Unlock();
}

~StrictOrderTestContext()
~StrictOrderTestContext() override
{
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/bencher.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Bencher : public Thread {
);

void run_bench();
void *entry() {
void *entry() override {
run_bench();
return 0;
}
Expand Down Expand Up @@ -131,7 +131,7 @@ class SequentialLoad :
op_dist(op_dist) {}

boost::tuple<string, uint64_t, uint64_t, Bencher::OpType>
operator()() {
operator()() override {
boost::tuple<string, uint64_t, uint64_t, Bencher::OpType> ret =
boost::make_tuple(*object_pos, cur_pos, length, (*op_dist)());
cur_pos += length;
Expand Down
12 changes: 6 additions & 6 deletions src/test/bench/detailed_stat_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ class DetailedStatCollector : public StatCollector {
AdditionalPrinting *details = 0
);

uint64_t next_seq();
void start_write(uint64_t seq, uint64_t size);
void start_read(uint64_t seq, uint64_t size);
void write_applied(uint64_t seq);
void write_committed(uint64_t seq);
void read_complete(uint64_t seq);
uint64_t next_seq() override;
void start_write(uint64_t seq, uint64_t size) override;
void start_read(uint64_t seq, uint64_t size) override;
void write_applied(uint64_t seq) override;
void write_committed(uint64_t seq) override;
void read_complete(uint64_t seq) override;

};

Expand Down
12 changes: 6 additions & 6 deletions src/test/bench/distribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FourTupleDist : public Distribution<boost::tuple<T, U, V, W> > {
Distribution<V> *v,
Distribution<W> *w)
: t(t), u(u), v(v), w(w) {}
boost::tuple<T, U, V, W> operator()() {
boost::tuple<T, U, V, W> operator()() override {
return boost::make_tuple((*t)(), (*u)(), (*v)(), (*w)());
}
};
Expand All @@ -53,7 +53,7 @@ class RandomDist : public Distribution<T> {
contents.insert(std::make_pair(count, *i));
}
}
virtual T operator()() {
T operator()() override {
assert(contents.size());
boost::uniform_int<> value(0, contents.size() - 1);
return contents.find(value(rng))->second;
Expand All @@ -76,7 +76,7 @@ class WeightedDist : public Distribution<T> {
contents.insert(std::make_pair(total, i->second));
}
}
virtual T operator()() {
T operator()() override {
return contents.lower_bound(
boost::uniform_real<>(0, total)(rng))->second;
}
Expand Down Expand Up @@ -107,7 +107,7 @@ class UniformRandom : public Distribution<uint64_t> {
public:
UniformRandom(const rngen_t &rng, uint64_t min, uint64_t max) :
rng(rng), min(min), max(max) {}
virtual uint64_t operator()() {
uint64_t operator()() override {
return boost::uniform_int<uint64_t>(min, max)(rng);
}
};
Expand All @@ -118,7 +118,7 @@ class Align : public Distribution<uint64_t> {
public:
Align(Distribution<uint64_t> *dist, uint64_t align) :
dist(dist), align(align) {}
virtual uint64_t operator()() {
uint64_t operator()() override {
uint64_t ret = (*dist)();
return ret - (ret % align);
}
Expand All @@ -128,7 +128,7 @@ class Uniform : public Distribution<uint64_t> {
uint64_t val;
public:
explicit Uniform(uint64_t val) : val(val) {}
virtual uint64_t operator()() {
uint64_t operator()() override {
return val;
}
};
Expand Down
18 changes: 9 additions & 9 deletions src/test/bench/dumb_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DumbBackend : public Backend {
DumbBackend *backend;
public:
explicit SyncThread(DumbBackend *backend) : backend(backend) {}
void *entry() {
void *entry() override {
backend->sync_loop();
return 0;
}
Expand All @@ -69,19 +69,19 @@ class DumbBackend : public Backend {
ThreadPool *tp) :
ThreadPool::WorkQueue<write_item>("DumbBackend::queue", ti, ti*10, tp),
backend(_backend) {}
bool _enqueue(write_item *item) {
bool _enqueue(write_item *item) override {
item_queue.push_back(item);
return true;
}
void _dequeue(write_item*) { ceph_abort(); }
write_item *_dequeue() {
void _dequeue(write_item*) override { ceph_abort(); }
write_item *_dequeue() override {
if (item_queue.empty())
return 0;
write_item *retval = item_queue.front();
item_queue.pop_front();
return retval;
}
bool _empty() {
bool _empty() override {
return item_queue.empty();
}
void _process(write_item *item, ThreadPool::TPHandle &) override {
Expand All @@ -92,7 +92,7 @@ class DumbBackend : public Backend {
item->on_applied,
item->on_commit);
}
void _clear() {
void _clear() override {
return item_queue.clear();
}
} queue;
Expand Down Expand Up @@ -134,7 +134,7 @@ class DumbBackend : public Backend {
sem.Put();
}
}
~DumbBackend() {
~DumbBackend() override {
{
Mutex::Locker l(sync_loop_mutex);
if (sync_loop_stop == 0)
Expand All @@ -150,7 +150,7 @@ class DumbBackend : public Backend {
uint64_t offset,
const bufferlist &bl,
Context *on_applied,
Context *on_commit) {
Context *on_commit) override {
sem.Get();
queue.queue(
new write_item(
Expand All @@ -162,7 +162,7 @@ class DumbBackend : public Backend {
uint64_t offset,
uint64_t length,
bufferlist *bl,
Context *on_complete);
Context *on_complete) override;
};

#endif
4 changes: 2 additions & 2 deletions src/test/bench/rados_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class RadosBackend : public Backend {
uint64_t offset,
const bufferlist &bl,
Context *on_applied,
Context *on_commit);
Context *on_commit) override;

void read(
const string &oid,
uint64_t offset,
uint64_t length,
bufferlist *bl,
Context *on_complete);
Context *on_complete) override;
};

#endif
4 changes: 2 additions & 2 deletions src/test/bench/rbd_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class RBDBackend : public Backend {
uint64_t offset,
const bufferlist &bl,
Context *on_applied,
Context *on_commit);
Context *on_commit) override;

void read(
const string &oid,
uint64_t offset,
uint64_t length,
bufferlist *bl,
Context *on_complete);
Context *on_complete) override;
};

#endif
6 changes: 3 additions & 3 deletions src/test/bench/testfilestore_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ class TestFileStoreBackend : public Backend {

public:
TestFileStoreBackend(ObjectStore *os, bool write_infos);
~TestFileStoreBackend() {
~TestFileStoreBackend() override {
finisher.stop();
}
void write(
const string &oid,
uint64_t offset,
const bufferlist &bl,
Context *on_applied,
Context *on_commit);
Context *on_commit) override;

void read(
const string &oid,
uint64_t offset,
uint64_t length,
bufferlist *bl,
Context *on_complete);
Context *on_complete) override;
};

#endif
8 changes: 4 additions & 4 deletions src/test/compressor/compressor_example.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
class CompressorExample : public Compressor {
public:
CompressorExample() : Compressor(COMP_ALG_NONE, "example") {}
virtual ~CompressorExample() {}
~CompressorExample() override {}

virtual int compress(const bufferlist &in, bufferlist &out)
int compress(const bufferlist &in, bufferlist &out) override
{
out = in;
return 0;
}

virtual int decompress(const bufferlist &in, bufferlist &out)
int decompress(const bufferlist &in, bufferlist &out) override
{
out = in;
return 0;
}
virtual int decompress(bufferlist::iterator &p, size_t compressed_len, bufferlist &out)
int decompress(bufferlist::iterator &p, size_t compressed_len, bufferlist &out) override
{
p.copy(MIN(p.get_remaining(), compressed_len), out);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/test/compressor/test_compression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CompressorTest : public ::testing::Test,
}
cout << "[plugin " << plugin << " (" << GetParam() << ")]" << std::endl;
}
~CompressorTest() {
~CompressorTest() override {
g_conf->set_val("compressor_zlib_isal", old_zlib_isal ? "true" : "false");
g_ceph_context->_conf->apply_changes(NULL);
}
Expand Down

0 comments on commit 51f87e2

Please sign in to comment.