clang format files under test_util/ (#10855)

Summary:
Ran `find . -iname '*.h' -o -iname '*.cc' | xargs clang-format -i` under test_util/.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10855

Test Plan: existing CI.

Reviewed By: siying

Differential Revision: D40652583

Pulled By: cbi42

fbshipit-source-id: ed0fbcfe17b6f9ec217a64b80d6d43dfbf1cc34e
main
changyubi 2 years ago committed by Facebook GitHub Bot
parent 671753c43d
commit aca00006bf
  1. 20
      test_util/sync_point.cc
  2. 3
      test_util/sync_point_impl.cc
  3. 11
      test_util/sync_point_impl.h
  4. 3
      test_util/testharness.cc
  5. 9
      test_util/testutil.h
  6. 7
      test_util/transaction_test_util.cc
  7. 2
      test_util/transaction_test_util.h

@ -21,9 +21,7 @@ SyncPoint* SyncPoint::GetInstance() {
SyncPoint::SyncPoint() : impl_(new Data) {} SyncPoint::SyncPoint() : impl_(new Data) {}
SyncPoint:: ~SyncPoint() { SyncPoint::~SyncPoint() { delete impl_; }
delete impl_;
}
void SyncPoint::LoadDependency(const std::vector<SyncPointPair>& dependencies) { void SyncPoint::LoadDependency(const std::vector<SyncPointPair>& dependencies) {
impl_->LoadDependency(dependencies); impl_->LoadDependency(dependencies);
@ -44,21 +42,13 @@ void SyncPoint::ClearCallBack(const std::string& point) {
impl_->ClearCallBack(point); impl_->ClearCallBack(point);
} }
void SyncPoint::ClearAllCallBacks() { void SyncPoint::ClearAllCallBacks() { impl_->ClearAllCallBacks(); }
impl_->ClearAllCallBacks();
}
void SyncPoint::EnableProcessing() { void SyncPoint::EnableProcessing() { impl_->EnableProcessing(); }
impl_->EnableProcessing();
}
void SyncPoint::DisableProcessing() { void SyncPoint::DisableProcessing() { impl_->DisableProcessing(); }
impl_->DisableProcessing();
}
void SyncPoint::ClearTrace() { void SyncPoint::ClearTrace() { impl_->ClearTrace(); }
impl_->ClearTrace();
}
void SyncPoint::Process(const Slice& point, void* cb_arg) { void SyncPoint::Process(const Slice& point, void* cb_arg) {
impl_->Process(point, cb_arg); impl_->Process(point, cb_arg);

@ -37,7 +37,8 @@ void KillPoint::TestKillRandom(std::string kill_point, int odds_weight,
} }
} }
void SyncPoint::Data::LoadDependency(const std::vector<SyncPointPair>& dependencies) { void SyncPoint::Data::LoadDependency(
const std::vector<SyncPointPair>& dependencies) {
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
successors_.clear(); successors_.clear();
predecessors_.clear(); predecessors_.clear();

@ -79,18 +79,13 @@ struct SyncPoint::Data {
void ClearCallBack(const std::string& point); void ClearCallBack(const std::string& point);
void ClearAllCallBacks(); void ClearAllCallBacks();
void EnableProcessing() { void EnableProcessing() { enabled_ = true; }
enabled_ = true; void DisableProcessing() { enabled_ = false; }
}
void DisableProcessing() {
enabled_ = false;
}
void ClearTrace() { void ClearTrace() {
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
cleared_points_.clear(); cleared_points_.clear();
} }
bool DisabledByMarker(const std::string& point, bool DisabledByMarker(const std::string& point, std::thread::id thread_id) {
std::thread::id thread_id) {
auto marked_point_iter = marked_thread_id_.find(point); auto marked_point_iter = marked_thread_id_.find(point);
return marked_point_iter != marked_thread_id_.end() && return marked_point_iter != marked_thread_id_.end() &&
thread_id != marked_point_iter->second; thread_id != marked_point_iter->second;

@ -28,8 +28,7 @@ std::string GetPidStr() { return std::to_string(getpid()); }
if (s.ok()) { if (s.ok()) {
return ::testing::AssertionSuccess(); return ::testing::AssertionSuccess();
} else { } else {
return ::testing::AssertionFailure() << s_expr << std::endl return ::testing::AssertionFailure() << s_expr << std::endl << s.ToString();
<< s.ToString();
} }
} }

@ -144,9 +144,8 @@ class StringSink : public FSWritableFile {
if (reader_contents_ != nullptr) { if (reader_contents_ != nullptr) {
assert(reader_contents_->size() <= last_flush_); assert(reader_contents_->size() <= last_flush_);
size_t offset = last_flush_ - reader_contents_->size(); size_t offset = last_flush_ - reader_contents_->size();
*reader_contents_ = Slice( *reader_contents_ =
contents_.data() + offset, Slice(contents_.data() + offset, contents_.size() - offset);
contents_.size() - offset);
last_flush_ = contents_.size(); last_flush_ = contents_.size();
} }
@ -165,8 +164,8 @@ class StringSink : public FSWritableFile {
void Drop(size_t bytes) { void Drop(size_t bytes) {
if (reader_contents_ != nullptr) { if (reader_contents_ != nullptr) {
contents_.resize(contents_.size() - bytes); contents_.resize(contents_.size() - bytes);
*reader_contents_ = Slice( *reader_contents_ =
reader_contents_->data(), reader_contents_->size() - bytes); Slice(reader_contents_->data(), reader_contents_->size() - bytes);
last_flush_ = contents_.size(); last_flush_ = contents_.size();
} }
} }

@ -13,14 +13,13 @@
#include <string> #include <string>
#include <thread> #include <thread>
#include "db/dbformat.h"
#include "db/snapshot_impl.h"
#include "logging/logging.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/utilities/optimistic_transaction_db.h" #include "rocksdb/utilities/optimistic_transaction_db.h"
#include "rocksdb/utilities/transaction.h" #include "rocksdb/utilities/transaction.h"
#include "rocksdb/utilities/transaction_db.h" #include "rocksdb/utilities/transaction_db.h"
#include "db/dbformat.h"
#include "db/snapshot_impl.h"
#include "logging/logging.h"
#include "util/random.h" #include "util/random.h"
#include "util/string_util.h" #include "util/string_util.h"

@ -7,8 +7,8 @@
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
#include "rocksdb/options.h"
#include "port/port.h" #include "port/port.h"
#include "rocksdb/options.h"
#include "rocksdb/utilities/optimistic_transaction_db.h" #include "rocksdb/utilities/optimistic_transaction_db.h"
#include "rocksdb/utilities/transaction_db.h" #include "rocksdb/utilities/transaction_db.h"

Loading…
Cancel
Save