Test dirty flags on all FAT variants
Flags field offset is different is it makes sense.
This commit is contained in:
parent
dc1ad7d2f7
commit
5dea8b5f8a
@ -306,26 +306,38 @@ fn test_rename_file_fat32() {
|
|||||||
call_with_fs(&test_rename_file, FAT32_IMG, 6)
|
call_with_fs(&test_rename_file, FAT32_IMG, 6)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
fn test_dirty_flag(tmp_path: &str) {
|
||||||
fn test_dirty_flag() {
|
// Open filesystem, make change, and forget it - should become dirty
|
||||||
call_with_tmp_img(&|tmp_path| {
|
let fs = open_filesystem_rw(tmp_path);
|
||||||
// Open filesystem, make change, and forget it - should become dirty
|
let status_flags = fs.read_status_flags().unwrap();
|
||||||
let fs = open_filesystem_rw(tmp_path);
|
assert_eq!(status_flags.dirty(), false);
|
||||||
let status_flags = fs.read_status_flags().unwrap();
|
assert_eq!(status_flags.io_error(), false);
|
||||||
assert_eq!(status_flags.dirty(), false);
|
fs.root_dir().create_file("abc.txt").unwrap();
|
||||||
assert_eq!(status_flags.io_error(), false);
|
mem::forget(fs);
|
||||||
fs.root_dir().create_file("abc.txt").unwrap();
|
// Check if volume is dirty now
|
||||||
mem::forget(fs);
|
let fs = open_filesystem_rw(tmp_path);
|
||||||
// Check if volume is dirty now
|
let status_flags = fs.read_status_flags().unwrap();
|
||||||
let fs = open_filesystem_rw(tmp_path);
|
assert_eq!(status_flags.dirty(), true);
|
||||||
let status_flags = fs.read_status_flags().unwrap();
|
assert_eq!(status_flags.io_error(), false);
|
||||||
assert_eq!(status_flags.dirty(), true);
|
fs.unmount().unwrap();
|
||||||
assert_eq!(status_flags.io_error(), false);
|
// Make sure remounting does not clear the dirty flag
|
||||||
fs.unmount().unwrap();
|
let fs = open_filesystem_rw(tmp_path);
|
||||||
// Make sure remounting does not clear the dirty flag
|
let status_flags = fs.read_status_flags().unwrap();
|
||||||
let fs = open_filesystem_rw(tmp_path);
|
assert_eq!(status_flags.dirty(), true);
|
||||||
let status_flags = fs.read_status_flags().unwrap();
|
assert_eq!(status_flags.io_error(), false);
|
||||||
assert_eq!(status_flags.dirty(), true);
|
}
|
||||||
assert_eq!(status_flags.io_error(), false);
|
|
||||||
}, FAT32_IMG, 7);
|
#[test]
|
||||||
|
fn test_dirty_flag_fat12() {
|
||||||
|
call_with_tmp_img(&test_dirty_flag, FAT12_IMG, 7)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dirty_flag_fat16() {
|
||||||
|
call_with_tmp_img(&test_dirty_flag, FAT16_IMG, 7)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dirty_flag_fat32() {
|
||||||
|
call_with_tmp_img(&test_dirty_flag, FAT32_IMG, 7)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user