mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			v2.4.2
			...
			fix-overwr
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 013be2665b | 
| @@ -20,6 +20,7 @@ script: | ||||
|   # run tests with a few different configurations | ||||
|   - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1      -DLFS_CACHE_SIZE=4" | ||||
|   - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512    -DLFS_CACHE_SIZE=512 -DLFS_BLOCK_CYCLES=16" | ||||
|   - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=8      -DLFS_CACHE_SIZE=16  -DLFS_BLOCK_CYCLES=2" | ||||
|   - make test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD_SIZE=256" | ||||
|  | ||||
|   - make clean test QUIET=1 CFLAGS+="-DLFS_INLINE_MAX=0" | ||||
|   | ||||
							
								
								
									
										6
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -929,6 +929,11 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs, | ||||
|                 if (res == LFS_CMP_EQ) { | ||||
|                     // found a match | ||||
|                     tempbesttag = tag; | ||||
|                 } else if ((LFS_MKTAG(0x7ff, 0x3ff, 0) & tag) == | ||||
|                         (LFS_MKTAG(0x7ff, 0x3ff, 0) & tempbesttag)) { | ||||
|                     // found an identical tag, but contents didn't match | ||||
|                     // this must mean that our besttag has been overwritten | ||||
|                     tempbesttag = -1; | ||||
|                 } else if (res == LFS_CMP_GT && | ||||
|                         lfs_tag_id(tag) <= lfs_tag_id(tempbesttag)) { | ||||
|                     // found a greater match, keep track to keep things sorted | ||||
| @@ -1378,6 +1383,7 @@ static int lfs_dir_split(lfs_t *lfs, | ||||
|         lfs_mdir_t *dir, const struct lfs_mattr *attrs, int attrcount, | ||||
|         lfs_mdir_t *source, uint16_t split, uint16_t end) { | ||||
|     // create tail directory | ||||
|     lfs_alloc_ack(lfs); | ||||
|     lfs_mdir_t tail; | ||||
|     int err = lfs_dir_alloc(lfs, &tail); | ||||
|     if (err) { | ||||
|   | ||||
| @@ -250,6 +250,14 @@ scripts/test.py << TEST | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
| ## Below, these tests depend _very_ heavily on the geometry of the | ||||
| ## block device being tested, they should be removed and replaced | ||||
| ## by generalized tests. For now we'll just skip if the geometry | ||||
| ## is customized. | ||||
|  | ||||
| if [[ ! $MAKEFLAGS =~ "LFS_BLOCK_CYCLES" ]] | ||||
| then | ||||
|  | ||||
| echo "--- Chained dir exhaustion test ---" | ||||
| scripts/test.py << TEST | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
| @@ -481,4 +489,6 @@ scripts/test.py << TEST | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
| fi | ||||
|  | ||||
| scripts/results.py | ||||
|   | ||||
| @@ -23,6 +23,57 @@ scripts/test.py << TEST | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
| echo "--- Dangling split dir test ---" | ||||
| scripts/test.py << TEST | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     for (int j = 0; j < $ITERATIONS; j++) { | ||||
|         for (int i = 0; i < $COUNT; i++) { | ||||
|             sprintf(path, "child/test%03d_loooooooooooooooooong_name", i); | ||||
|             lfs_file_open(&lfs, &file, path, LFS_O_CREAT | LFS_O_WRONLY) => 0; | ||||
|             lfs_file_close(&lfs, &file) => 0; | ||||
|         } | ||||
|  | ||||
|         lfs_dir_open(&lfs, &dir, "child") => 0; | ||||
|         lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|         lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|         for (int i = 0; i < $COUNT; i++) { | ||||
|             sprintf(path, "test%03d_loooooooooooooooooong_name", i); | ||||
|             lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|             strcmp(info.name, path) => 0; | ||||
|         } | ||||
|         lfs_dir_read(&lfs, &dir, &info) => 0; | ||||
|         lfs_dir_close(&lfs, &dir) => 0; | ||||
|  | ||||
|         if (j == $ITERATIONS-1) { | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|         for (int i = 0; i < $COUNT; i++) { | ||||
|             sprintf(path, "child/test%03d_loooooooooooooooooong_name", i); | ||||
|             lfs_remove(&lfs, path) => 0; | ||||
|         } | ||||
|     } | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
| scripts/test.py << TEST | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs_dir_open(&lfs, &dir, "child") => 0; | ||||
|     lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|     lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|     for (int i = 0; i < $COUNT; i++) { | ||||
|         sprintf(path, "test%03d_loooooooooooooooooong_name", i); | ||||
|         lfs_dir_read(&lfs, &dir, &info) => 1; | ||||
|         strcmp(info.name, path) => 0; | ||||
|     } | ||||
|     lfs_dir_read(&lfs, &dir, &info) => 0; | ||||
|     lfs_dir_close(&lfs, &dir) => 0; | ||||
|     for (int i = 0; i < $COUNT; i++) { | ||||
|         sprintf(path, "child/test%03d_loooooooooooooooooong_name", i); | ||||
|         lfs_remove(&lfs, path) => 0; | ||||
|     } | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
| echo "--- Outdated head test ---" | ||||
| scripts/test.py << TEST | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user