def test_full_sector_folder_fat16(self) -> None: fatfs = fatfsgen.FATFS(size=17 * 1024 * 1024) fatfs.create_directory('TESTFOLD') fill_sector(fatfs) fatfs.write_content(path_from_root=['TESTFOLD', 'A0'], content=b'first') fatfs.write_content(path_from_root=['TESTFOLD', 'A126'], content=b'later') fatfs.write_filesystem(CFG['output_file']) file_system = read_filesystem(CFG['output_file']) self.assertEqual( file_system[0x1000:0x1110], b'\xf8\xff\xff\xff\x82\x00' + 258 * b'\xff' + 8 * b'\x00') self.assertEqual(file_system[0x85000:0x85005], b'later') self.assertEqual(file_system[0x86000:0x86010], b'A126 \x00\x00\x00\x00') self.assertEqual(file_system[0x86020:0x86030], b'A127 \x00\x00\x00\x00')
def test_full_sector_folder_fat16() -> None: fatfs = fatfsgen.FATFS(size=17 * 1024 * 1024) fatfs.create_directory('TESTFOLD') fill_sector(fatfs) fatfs.write_content(path_from_root=['TESTFOLD', 'A0'], content=b'first') fatfs.write_content(path_from_root=['TESTFOLD', 'A126'], content=b'later') fatfs.write_filesystem('fatfs_image.img') run(['python', '../fatfsparse.py', 'fatfs_image.img'], stderr=STDOUT) assert set(os.listdir('Espressif')) == {'TESTFOLD'} assert set(os.listdir('Espressif/TESTFOLD')) == { f'A{str(i).upper()}' for i in range(128) } with open('Espressif/TESTFOLD/A0', 'rb') as in_: assert in_.read() == b'first' with open('Espressif/TESTFOLD/A126', 'rb') as in_: assert in_.read() == b'later'