mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Added/fixed tests for noop writes (where bd error can't be trusted)
It's interesting how many ways block devices can show failed writes: 1. prog can error 2. erase can error 3. read can error after writing (ECC failure) 4. prog doesn't error but doesn't write the data correctly 5. erase doesn't error but doesn't erase correctly Can read fail without an error? Yes, though this appears the same as prog and erase failing. These weren't all simulated by testbd since I unintentionally assumed the block device could always error. Fixed by added additional bad-black behaviors to testbd. Note: This also includes a small fix where we can miss bad writes if the underlying block device contains a valid commit with the exact same size in the exact same offset.
This commit is contained in:
		
							
								
								
									
										6
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -1300,9 +1300,9 @@ static int lfs_dir_commitcrc(lfs_t *lfs, struct lfs_commit *commit) { | ||||
|             // check against written crc to detect if block is readonly | ||||
|             // (we may pick up old commits) | ||||
| // TODO rm me? | ||||
| //            if (i == noff && crc != ncrc) { | ||||
| //                return LFS_ERR_CORRUPT; | ||||
| //            } | ||||
|             if (i == noff && crc != ncrc) { | ||||
|                 return LFS_ERR_CORRUPT; | ||||
|             } | ||||
|  | ||||
|             crc = lfs_crc(crc, &dat, 1); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user