mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 16:31:27 -04:00
Fix the regression test checking block manager boundaries
This commit is contained in:
parent
3aad70bb3c
commit
69750eaac5
@ -166,6 +166,8 @@ class filesystem_v2 {
|
||||
return impl_->set_cache_tidy_config(cfg);
|
||||
}
|
||||
|
||||
size_t num_blocks() const { return impl_->num_blocks(); }
|
||||
|
||||
class impl {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
@ -203,6 +205,7 @@ class filesystem_v2 {
|
||||
virtual std::optional<std::span<uint8_t const>> header() const = 0;
|
||||
virtual void set_num_workers(size_t num) = 0;
|
||||
virtual void set_cache_tidy_config(cache_tidy_config const& cfg) = 0;
|
||||
virtual size_t num_blocks() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -75,6 +75,8 @@ class inode_reader_v2 {
|
||||
impl_->set_cache_tidy_config(cfg);
|
||||
}
|
||||
|
||||
size_t num_blocks() const { return impl_->num_blocks(); }
|
||||
|
||||
class impl {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
@ -90,6 +92,7 @@ class inode_reader_v2 {
|
||||
chunk_range chunks) const = 0;
|
||||
virtual void set_num_workers(size_t num) = 0;
|
||||
virtual void set_cache_tidy_config(cache_tidy_config const& cfg) = 0;
|
||||
virtual size_t num_blocks() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -355,6 +355,7 @@ class filesystem_ final : public filesystem_v2::impl {
|
||||
void set_cache_tidy_config(cache_tidy_config const& cfg) override {
|
||||
ir_.set_cache_tidy_config(cfg);
|
||||
}
|
||||
size_t num_blocks() const override { return ir_.num_blocks(); }
|
||||
|
||||
private:
|
||||
filesystem_info const& get_info() const;
|
||||
|
@ -126,6 +126,7 @@ class inode_reader_ final : public inode_reader_v2::impl {
|
||||
void set_cache_tidy_config(cache_tidy_config const& cfg) override {
|
||||
cache_.set_tidy_config(cfg);
|
||||
}
|
||||
size_t num_blocks() const override { return cache_.block_count(); }
|
||||
|
||||
private:
|
||||
folly::Expected<std::vector<std::future<block_range>>, int>
|
||||
|
@ -636,7 +636,7 @@ TEST(block_manager, regression_block_boundary) {
|
||||
stream_logger lgr(logss); // TODO: mock
|
||||
lgr.set_policy<prod_logger_policy>();
|
||||
|
||||
std::vector<size_t> fs_sizes;
|
||||
std::vector<size_t> fs_blocks;
|
||||
|
||||
for (auto size : {1023, 1024, 1025}) {
|
||||
auto input = std::make_shared<test::os_access_mock>();
|
||||
@ -646,8 +646,6 @@ TEST(block_manager, regression_block_boundary) {
|
||||
|
||||
auto fsdata = build_dwarfs(lgr, input, "null", cfg);
|
||||
|
||||
fs_sizes.push_back(fsdata.size());
|
||||
|
||||
auto mm = std::make_shared<test::mmap_mock>(fsdata);
|
||||
|
||||
filesystem_v2 fs(lgr, mm, opts);
|
||||
@ -657,10 +655,13 @@ TEST(block_manager, regression_block_boundary) {
|
||||
|
||||
EXPECT_EQ(2, vfsbuf.files);
|
||||
EXPECT_EQ(size, vfsbuf.blocks);
|
||||
|
||||
fs_blocks.push_back(fs.num_blocks());
|
||||
}
|
||||
|
||||
EXPECT_TRUE(std::is_sorted(fs_sizes.begin(), fs_sizes.end()))
|
||||
<< folly::join(", ", fs_sizes);
|
||||
std::vector<size_t> const fs_blocks_expected{1, 1, 2};
|
||||
|
||||
EXPECT_EQ(fs_blocks_expected, fs_blocks);
|
||||
}
|
||||
|
||||
class compression_regression : public testing::TestWithParam<std::string> {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user