Skip to content

Commit

Permalink
Merge pull request #734 from ReFirmLabs/fs_integration_tests
Browse files Browse the repository at this point in the history
Fs integration tests
  • Loading branch information
devttys0 authored Nov 2, 2024
2 parents 516db49 + 5eb775a commit d386349
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/structures/romfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ fn romfs_crc_valid(crc_data: &[u8]) -> bool {

// Sum each word
while i < crc_data.len() {
sum += u32::from_be_bytes(crc_data[i..i + word_size].try_into().unwrap());
sum = sum.wrapping_add(u32::from_be_bytes(
crc_data[i..i + word_size].try_into().unwrap(),
));
i += word_size;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/cramfs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mod common;

#[test]
fn integration_test() {
const SIGNATURE_TYPE: &str = "cramfs";
const INPUT_FILE_NAME: &str = "cramfs.bin";
common::integration_test(SIGNATURE_TYPE, INPUT_FILE_NAME);
}
Binary file added tests/inputs/cramfs.bin
Binary file not shown.
Binary file added tests/inputs/mbr.bin
Binary file not shown.
Binary file added tests/inputs/romfs.bin
Binary file not shown.
Binary file added tests/inputs/squashfs.bin
Binary file not shown.
Binary file added tests/inputs/yaffs2.bin
Binary file not shown.
8 changes: 8 additions & 0 deletions tests/mbr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mod common;

#[test]
fn integration_test() {
const SIGNATURE_TYPE: &str = "mbr";
const INPUT_FILE_NAME: &str = "mbr.bin";
common::integration_test(SIGNATURE_TYPE, INPUT_FILE_NAME);
}
8 changes: 8 additions & 0 deletions tests/romfs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mod common;

#[test]
fn integration_test() {
const SIGNATURE_TYPE: &str = "romfs";
const INPUT_FILE_NAME: &str = "romfs.bin";
common::integration_test(SIGNATURE_TYPE, INPUT_FILE_NAME);
}
8 changes: 8 additions & 0 deletions tests/squashfs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mod common;

#[test]
fn integration_test() {
const SIGNATURE_TYPE: &str = "squashfs";
const INPUT_FILE_NAME: &str = "squashfs.bin";
common::integration_test(SIGNATURE_TYPE, INPUT_FILE_NAME);
}
8 changes: 8 additions & 0 deletions tests/yaffs2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mod common;

#[test]
fn integration_test() {
const SIGNATURE_TYPE: &str = "yaffs";
const INPUT_FILE_NAME: &str = "yaffs2.bin";
common::integration_test(SIGNATURE_TYPE, INPUT_FILE_NAME);
}

0 comments on commit d386349

Please sign in to comment.