mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Renamed all prefixes to include the major version
This is needed to allow compilation of multiple versions in the same binary. Also note that the FUSE testing was removed because of related name issues. ./scripts/prefix.py lfs2
This commit is contained in:
		| @@ -8,7 +8,7 @@ LARGESIZE=8192 | ||||
| echo "=== Truncate tests ===" | ||||
| rm -rf blocks | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &cfg) => 0; | ||||
|     lfs2_format(&lfs2, &cfg) => 0; | ||||
| TEST | ||||
|  | ||||
| truncate_test() { | ||||
| @@ -17,98 +17,98 @@ STARTSEEKS="$2" | ||||
| HOTSIZES="$3" | ||||
| COLDSIZES="$4" | ||||
| tests/test.py << TEST | ||||
|     static const lfs_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs_off_t startseeks[] = {$STARTSEEKS}; | ||||
|     static const lfs_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|     static const lfs2_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs2_off_t startseeks[] = {$STARTSEEKS}; | ||||
|     static const lfs2_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|  | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs2_mount(&lfs2, &cfg) => 0; | ||||
|  | ||||
|     for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) { | ||||
|         sprintf((char*)buffer, "hairyhead%d", i); | ||||
|         lfs_file_open(&lfs, &file[0], (const char*)buffer, | ||||
|                 LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0; | ||||
|         lfs2_file_open(&lfs2, &file[0], (const char*)buffer, | ||||
|                 LFS2_O_WRONLY | LFS2_O_CREAT | LFS2_O_TRUNC) => 0; | ||||
|  | ||||
|         strcpy((char*)buffer, "hair"); | ||||
|         size = strlen((char*)buffer); | ||||
|         for (lfs_off_t j = 0; j < startsizes[i]; j += size) { | ||||
|             lfs_file_write(&lfs, &file[0], buffer, size) => size; | ||||
|         for (lfs2_off_t j = 0; j < startsizes[i]; j += size) { | ||||
|             lfs2_file_write(&lfs2, &file[0], buffer, size) => size; | ||||
|         } | ||||
|         lfs_file_size(&lfs, &file[0]) => startsizes[i]; | ||||
|         lfs2_file_size(&lfs2, &file[0]) => startsizes[i]; | ||||
|  | ||||
|         if (startseeks[i] != startsizes[i]) { | ||||
|             lfs_file_seek(&lfs, &file[0], | ||||
|                     startseeks[i], LFS_SEEK_SET) => startseeks[i]; | ||||
|             lfs2_file_seek(&lfs2, &file[0], | ||||
|                     startseeks[i], LFS2_SEEK_SET) => startseeks[i]; | ||||
|         } | ||||
|  | ||||
|         lfs_file_truncate(&lfs, &file[0], hotsizes[i]) => 0; | ||||
|         lfs_file_size(&lfs, &file[0]) => hotsizes[i]; | ||||
|         lfs2_file_truncate(&lfs2, &file[0], hotsizes[i]) => 0; | ||||
|         lfs2_file_size(&lfs2, &file[0]) => hotsizes[i]; | ||||
|  | ||||
|         lfs_file_close(&lfs, &file[0]) => 0; | ||||
|         lfs2_file_close(&lfs2, &file[0]) => 0; | ||||
|     } | ||||
|  | ||||
|     lfs_unmount(&lfs) => 0; | ||||
|     lfs2_unmount(&lfs2) => 0; | ||||
| TEST | ||||
| tests/test.py << TEST | ||||
|     static const lfs_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|     static const lfs_off_t coldsizes[]  = {$COLDSIZES}; | ||||
|     static const lfs2_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs2_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|     static const lfs2_off_t coldsizes[]  = {$COLDSIZES}; | ||||
|  | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs2_mount(&lfs2, &cfg) => 0; | ||||
|  | ||||
|     for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) { | ||||
|         sprintf((char*)buffer, "hairyhead%d", i); | ||||
|         lfs_file_open(&lfs, &file[0], (const char*)buffer, LFS_O_RDWR) => 0; | ||||
|         lfs_file_size(&lfs, &file[0]) => hotsizes[i]; | ||||
|         lfs2_file_open(&lfs2, &file[0], (const char*)buffer, LFS2_O_RDWR) => 0; | ||||
|         lfs2_file_size(&lfs2, &file[0]) => hotsizes[i]; | ||||
|  | ||||
|         size = strlen("hair"); | ||||
|         lfs_off_t j = 0; | ||||
|         lfs2_off_t j = 0; | ||||
|         for (; j < startsizes[i] && j < hotsizes[i]; j += size) { | ||||
|             lfs_file_read(&lfs, &file[0], buffer, size) => size; | ||||
|             lfs2_file_read(&lfs2, &file[0], buffer, size) => size; | ||||
|             memcmp(buffer, "hair", size) => 0; | ||||
|         } | ||||
|  | ||||
|         for (; j < hotsizes[i]; j += size) { | ||||
|             lfs_file_read(&lfs, &file[0], buffer, size) => size; | ||||
|             lfs2_file_read(&lfs2, &file[0], buffer, size) => size; | ||||
|             memcmp(buffer, "\0\0\0\0", size) => 0; | ||||
|         } | ||||
|  | ||||
|         lfs_file_truncate(&lfs, &file[0], coldsizes[i]) => 0; | ||||
|         lfs_file_size(&lfs, &file[0]) => coldsizes[i]; | ||||
|         lfs2_file_truncate(&lfs2, &file[0], coldsizes[i]) => 0; | ||||
|         lfs2_file_size(&lfs2, &file[0]) => coldsizes[i]; | ||||
|  | ||||
|         lfs_file_close(&lfs, &file[0]) => 0; | ||||
|         lfs2_file_close(&lfs2, &file[0]) => 0; | ||||
|     } | ||||
|  | ||||
|     lfs_unmount(&lfs) => 0; | ||||
|     lfs2_unmount(&lfs2) => 0; | ||||
| TEST | ||||
| tests/test.py << TEST | ||||
|     static const lfs_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|     static const lfs_off_t coldsizes[]  = {$COLDSIZES}; | ||||
|     static const lfs2_off_t startsizes[] = {$STARTSIZES}; | ||||
|     static const lfs2_off_t hotsizes[]   = {$HOTSIZES}; | ||||
|     static const lfs2_off_t coldsizes[]  = {$COLDSIZES}; | ||||
|  | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs2_mount(&lfs2, &cfg) => 0; | ||||
|  | ||||
|     for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) { | ||||
|         sprintf((char*)buffer, "hairyhead%d", i); | ||||
|         lfs_file_open(&lfs, &file[0], (const char*)buffer, LFS_O_RDONLY) => 0; | ||||
|         lfs_file_size(&lfs, &file[0]) => coldsizes[i]; | ||||
|         lfs2_file_open(&lfs2, &file[0], (const char*)buffer, LFS2_O_RDONLY) => 0; | ||||
|         lfs2_file_size(&lfs2, &file[0]) => coldsizes[i]; | ||||
|  | ||||
|         size = strlen("hair"); | ||||
|         lfs_off_t j = 0; | ||||
|         lfs2_off_t j = 0; | ||||
|         for (; j < startsizes[i] && j < hotsizes[i] && j < coldsizes[i]; | ||||
|                 j += size) { | ||||
|             lfs_file_read(&lfs, &file[0], buffer, size) => size; | ||||
|             lfs2_file_read(&lfs2, &file[0], buffer, size) => size; | ||||
|             memcmp(buffer, "hair", size) => 0; | ||||
|         } | ||||
|  | ||||
|         for (; j < coldsizes[i]; j += size) { | ||||
|             lfs_file_read(&lfs, &file[0], buffer, size) => size; | ||||
|             lfs2_file_read(&lfs2, &file[0], buffer, size) => size; | ||||
|             memcmp(buffer, "\0\0\0\0", size) => 0; | ||||
|         } | ||||
|  | ||||
|         lfs_file_close(&lfs, &file[0]) => 0; | ||||
|         lfs2_file_close(&lfs2, &file[0]) => 0; | ||||
|     } | ||||
|  | ||||
|     lfs_unmount(&lfs) => 0; | ||||
|     lfs2_unmount(&lfs2) => 0; | ||||
| TEST | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user