Check status for file_reader_writer_test (#7449)
Summary: Check the status for file_reader_writer_test. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7449 Test Plan: ``` ASSERT_STATUS_CHECKED=1 make -j20 file_reader_writer_test ./file_reader_writer_test ``` Reviewed By: zhichao-cao Differential Revision: D23975609 Pulled By: riversand963 fbshipit-source-id: a468eb04b386967fcc0478a56e4f0a19bdf81cdf
This commit is contained in:
parent
7a23a2175b
commit
8c7bac6491
@ -80,18 +80,22 @@ TEST_F(WritableFileWriterTest, RangeSync) {
|
||||
new WritableFileWriter(NewLegacyWritableFileWrapper(std::move(wf)),
|
||||
"" /* don't care */, env_options));
|
||||
Random r(301);
|
||||
Status s;
|
||||
std::unique_ptr<char[]> large_buf(new char[10 * kMb]);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int skew_limit = (i < 700) ? 10 : 15;
|
||||
uint32_t num = r.Skewed(skew_limit) * 100 + r.Uniform(100);
|
||||
writer->Append(Slice(large_buf.get(), num));
|
||||
s = writer->Append(Slice(large_buf.get(), num));
|
||||
ASSERT_OK(s);
|
||||
|
||||
// Flush in a chance of 1/10.
|
||||
if (r.Uniform(10) == 0) {
|
||||
writer->Flush();
|
||||
s = writer->Flush();
|
||||
ASSERT_OK(s);
|
||||
}
|
||||
}
|
||||
writer->Close();
|
||||
s = writer->Close();
|
||||
ASSERT_OK(s);
|
||||
}
|
||||
|
||||
TEST_F(WritableFileWriterTest, IncrementalBuffer) {
|
||||
@ -242,15 +246,18 @@ class ReadaheadRandomAccessFileTest
|
||||
ReadaheadRandomAccessFileTest() : control_contents_() {}
|
||||
std::string Read(uint64_t offset, size_t n) {
|
||||
Slice result;
|
||||
test_read_holder_->Read(offset, n, &result, scratch_.get());
|
||||
Status s = test_read_holder_->Read(offset, n, &result, scratch_.get());
|
||||
EXPECT_TRUE(s.ok() || s.IsInvalidArgument());
|
||||
return std::string(result.data(), result.size());
|
||||
}
|
||||
void ResetSourceStr(const std::string& str = "") {
|
||||
auto write_holder =
|
||||
std::unique_ptr<WritableFileWriter>(test::GetWritableFileWriter(
|
||||
new test::StringSink(&control_contents_), "" /* don't care */));
|
||||
write_holder->Append(Slice(str));
|
||||
write_holder->Flush();
|
||||
Status s = write_holder->Append(Slice(str));
|
||||
EXPECT_OK(s);
|
||||
s = write_holder->Flush();
|
||||
EXPECT_OK(s);
|
||||
auto read_holder = std::unique_ptr<RandomAccessFile>(
|
||||
new test::StringSource(control_contents_));
|
||||
test_read_holder_ =
|
||||
@ -340,7 +347,8 @@ class ReadaheadSequentialFileTest : public testing::Test,
|
||||
ReadaheadSequentialFileTest() {}
|
||||
std::string Read(size_t n) {
|
||||
Slice result;
|
||||
test_read_holder_->Read(n, &result, scratch_.get());
|
||||
Status s = test_read_holder_->Read(n, &result, scratch_.get());
|
||||
EXPECT_TRUE(s.ok() || s.IsInvalidArgument());
|
||||
return std::string(result.data(), result.size());
|
||||
}
|
||||
void Skip(size_t n) { test_read_holder_->Skip(n); }
|
||||
|
Loading…
Reference in New Issue
Block a user