Unit testing for esp-open-rtos (#253)
* Get testing system by projectgus working with master HEAD * Fix running dual test. Add basic wifi test * Moved spiff test to a test case. Reset retries in test runner * Add timers test case * test_runner: List test cases and run individual test cases * Add README for tests * Update README.md * Code clean-up * Python3.4 support. README.md update
This commit is contained in:
		
							parent
							
								
									dda384f3a1
								
							
						
					
					
						commit
						7c702d7f09
					
				
					 19 changed files with 1562 additions and 45 deletions
				
			
		|  | @ -1,11 +0,0 @@ | |||
| PROGRAM=posix_fs_example | ||||
| PROGRAM_EXTRA_SRC_FILES=./fs-test/fs_test.c | ||||
| 
 | ||||
| EXTRA_COMPONENTS = extras/spiffs | ||||
| FLASH_SIZE = 32 | ||||
| 
 | ||||
| # spiffs configuration
 | ||||
| SPIFFS_BASE_ADDR = 0x200000 | ||||
| SPIFFS_SIZE = 0x100000 | ||||
| 
 | ||||
| include ../../common.mk | ||||
|  | @ -1,10 +0,0 @@ | |||
| # POSIX file access example | ||||
| 
 | ||||
| This example runs several file system tests on ESP8266. | ||||
| It uses fs-test library to perform file operations test. fs-test library uses | ||||
| only POSIX file functions so can be run on host system as well. | ||||
| 
 | ||||
| Currently included tests: | ||||
|  * File system load test. Perform multiple file operations in random order. | ||||
|  * File system speed test. Measures files read/write speed. | ||||
| 
 | ||||
|  | @ -1 +0,0 @@ | |||
| Subproject commit 2ad547adc5f725594b3c6752f036ff4401b221fc | ||||
|  | @ -1,55 +0,0 @@ | |||
| #include "espressif/esp_common.h" | ||||
| #include "esp/uart.h" | ||||
| #include "esp/timer.h" | ||||
| #include "FreeRTOS.h" | ||||
| #include "task.h" | ||||
| #include "esp8266.h" | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| #include "esp_spiffs.h" | ||||
| #include "spiffs.h" | ||||
| 
 | ||||
| #include "fs-test/fs_test.h" | ||||
| 
 | ||||
| static fs_time_t get_current_time() | ||||
| { | ||||
|      return timer_get_count(FRC2) / 5000;  // to get roughly 1ms resolution
 | ||||
| } | ||||
| 
 | ||||
| void test_task(void *pvParameters) | ||||
| { | ||||
|     esp_spiffs_init(); | ||||
|     esp_spiffs_mount(); | ||||
|     SPIFFS_unmount(&fs);  // FS must be unmounted before formating
 | ||||
|     if (SPIFFS_format(&fs) == SPIFFS_OK) { | ||||
|         printf("Format complete\n"); | ||||
|     } else { | ||||
|         printf("Format failed\n"); | ||||
|     } | ||||
|     esp_spiffs_mount(); | ||||
| 
 | ||||
|     while (1) { | ||||
|         vTaskDelay(5000 / portTICK_PERIOD_MS); | ||||
|         if (fs_load_test_run(100)) { | ||||
|             printf("PASS\n"); | ||||
|         } else { | ||||
|             printf("FAIL\n"); | ||||
|         } | ||||
| 
 | ||||
|         vTaskDelay(5000 / portTICK_PERIOD_MS); | ||||
|         float write_rate, read_rate; | ||||
|         if (fs_speed_test_run(get_current_time, &write_rate, &read_rate)) { | ||||
|             printf("Read speed: %.0f bytes/s\n", read_rate * 1000);  | ||||
|             printf("Write speed: %.0f bytes/s\n", write_rate * 1000);  | ||||
|         } else { | ||||
|             printf("FAIL\n"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void user_init(void) | ||||
| { | ||||
|     uart_set_baud(0, 115200); | ||||
| 
 | ||||
|     xTaskCreate(test_task, "test_task", 1024, NULL, 2, NULL); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue