Skip to content

Commit

Permalink
Improve property tests (#1058)
Browse files Browse the repository at this point in the history
### What does this PR do?

This commit improves the property tests for the filesystem model and fixes bugs in the model itself, specifically around how nodes are linked.
  • Loading branch information
blt authored Oct 29, 2024
1 parent 91381c6 commit eb78eac
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 166 deletions.
8 changes: 8 additions & 0 deletions lading/proptest-regressions/generator/file_gen/model.txt

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions lading/src/bin/logrotate_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ fn getattr_helper(
ino: attr.inode as u64,
size: attr.size,
blocks: (attr.size + 511) / 512,
// TODO these times should reflect those in the model, will need to
// be translated from the tick to systemtime. Implies we'll need to
// adjust up from start_time, knowing that a tick is one second
// wide.
atime,
mtime,
ctime,
Expand Down Expand Up @@ -233,6 +229,9 @@ impl Filesystem for LogrotateFS {
// TODO building up a vec of entries here to handle offset really does
// suggest that the model needs to be exposed in such a way that this
// needn't be done.
//
// Ah, actually, the right buffer to push into is reply.add. There's no
// need for `entries` at all.
let mut entries = Vec::new();

// '.' and '..'
Expand All @@ -248,7 +247,7 @@ impl Filesystem for LogrotateFS {
));
}

// reaming children
// remaining children
if let Some(child_inodes) = state.readdir(ino as usize) {
for child_ino in child_inodes {
let file_type = state
Expand Down Expand Up @@ -310,10 +309,13 @@ fn main() -> Result<(), Error> {
.expect("block construction"); // TODO make this an Error

let state = model::State::new(
&mut rng,
args.bytes_per_second.get_bytes() as u64, // Adjust units accordingly
5, // TODO make an argument
1_000_000, // 1MiB
block_cache,
10, // max_depth
8, // concurrent_logs
);

// Initialize the FUSE filesystem
Expand Down
Loading

0 comments on commit eb78eac

Please sign in to comment.