Skip to content

Commit 1c1d93f

Browse files
GaelanErik Schilling
authored and
Erik Schilling
committed
scsi: refactor tests to generate test.img programatically
1 parent 1a09c50 commit 1c1d93f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

crates/scsi/src/scsi/tests/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ fn null_image() -> File {
2020

2121
fn test_image() -> File {
2222
let mut f = tempfile().unwrap();
23-
f.write_all(include_bytes!("./test.img")).unwrap();
23+
// generate 16 512-byte sectors, each of which consist of a single
24+
// repeated hex character, i.e.
25+
// sector 00: 0000000....0000
26+
// sector 15: fffffff....ffff
27+
for chr in b'0'..=b'9' {
28+
f.write_all(&[chr; 512]).unwrap();
29+
}
30+
for chr in b'a'..=b'f' {
31+
f.write_all(&[chr; 512]).unwrap();
32+
}
2433
f
2534
}
2635

crates/scsi/src/scsi/tests/test.img

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)