mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	- Now test errors have correct line reporting! #line directives
  are passed to the compiler that reference the relevant line in
  the test case shell script.
  --- Multi-block directory ---
  ./tests/test_dirs.sh:109: assert failed with 0, expected 1
      lfs_unmount(&lfs) => 1
- Cleaned up the number of implicit global variables provided to
  tests. A lot of these were infrequently used and made it difficult
  to remember what was provided. This isn't an MCU, so there's very
  little cost to stack allocations when needed.
- Minimized the results.py script (previously stats.py) output to
  match minimization of test output.
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| set -eu
 | |
| export TEST_FILE=$0
 | |
| trap 'export TEST_LINE=$LINENO' DEBUG
 | |
| 
 | |
| echo "=== Formatting tests ==="
 | |
| rm -rf blocks
 | |
| 
 | |
| echo "--- Basic formatting ---"
 | |
| scripts/test.py << TEST
 | |
|     lfs_format(&lfs, &cfg) => 0;
 | |
| TEST
 | |
| 
 | |
| echo "--- Basic mounting ---"
 | |
| scripts/test.py << TEST
 | |
|     lfs_format(&lfs, &cfg) => 0;
 | |
| 
 | |
|     lfs_mount(&lfs, &cfg) => 0;
 | |
|     lfs_unmount(&lfs) => 0;
 | |
| TEST
 | |
| 
 | |
| echo "--- Invalid superblocks ---"
 | |
| ln -f -s /dev/zero blocks/0
 | |
| ln -f -s /dev/zero blocks/1
 | |
| scripts/test.py << TEST
 | |
|     lfs_format(&lfs, &cfg) => LFS_ERR_NOSPC;
 | |
| TEST
 | |
| rm blocks/0 blocks/1
 | |
| 
 | |
| echo "--- Invalid mount ---"
 | |
| scripts/test.py << TEST
 | |
|     lfs_mount(&lfs, &cfg) => LFS_ERR_CORRUPT;
 | |
| TEST
 | |
| 
 | |
| echo "--- Expanding superblock ---"
 | |
| scripts/test.py << TEST
 | |
|     lfs_format(&lfs, &cfg) => 0;
 | |
|     lfs_mount(&lfs, &cfg) => 0;
 | |
|     for (int i = 0; i < 100; i++) {
 | |
|         lfs_mkdir(&lfs, "dummy") => 0;
 | |
|         lfs_remove(&lfs, "dummy") => 0;
 | |
|     }
 | |
|     lfs_unmount(&lfs) => 0;
 | |
| TEST
 | |
| scripts/test.py << TEST
 | |
|     lfs_mount(&lfs, &cfg) => 0;
 | |
|     lfs_mkdir(&lfs, "dummy") => 0;
 | |
|     lfs_unmount(&lfs) => 0;
 | |
| TEST
 | |
| 
 | |
| scripts/results.py
 |