Skip to content

Commit eb78eac

Browse files
authored
Improve property tests (#1058)
### 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.
1 parent 91381c6 commit eb78eac

File tree

3 files changed

+192
-166
lines changed

3 files changed

+192
-166
lines changed

lading/proptest-regressions/generator/file_gen/model.txt

+8
Large diffs are not rendered by default.

lading/src/bin/logrotate_fs.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ fn getattr_helper(
119119
ino: attr.inode as u64,
120120
size: attr.size,
121121
blocks: (attr.size + 511) / 512,
122-
// TODO these times should reflect those in the model, will need to
123-
// be translated from the tick to systemtime. Implies we'll need to
124-
// adjust up from start_time, knowing that a tick is one second
125-
// wide.
126122
atime,
127123
mtime,
128124
ctime,
@@ -233,6 +229,9 @@ impl Filesystem for LogrotateFS {
233229
// TODO building up a vec of entries here to handle offset really does
234230
// suggest that the model needs to be exposed in such a way that this
235231
// needn't be done.
232+
//
233+
// Ah, actually, the right buffer to push into is reply.add. There's no
234+
// need for `entries` at all.
236235
let mut entries = Vec::new();
237236

238237
// '.' and '..'
@@ -248,7 +247,7 @@ impl Filesystem for LogrotateFS {
248247
));
249248
}
250249

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

312311
let state = model::State::new(
312+
&mut rng,
313313
args.bytes_per_second.get_bytes() as u64, // Adjust units accordingly
314314
5, // TODO make an argument
315315
1_000_000, // 1MiB
316316
block_cache,
317+
10, // max_depth
318+
8, // concurrent_logs
317319
);
318320

319321
// Initialize the FUSE filesystem

0 commit comments

Comments
 (0)