Draft version of test system
This commit is contained in:
parent
95081a1e9f
commit
5ace1c5bff
12 changed files with 290 additions and 19 deletions
50
tests/spiffs/posix_fs_example.c
Normal file
50
tests/spiffs/posix_fs_example.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#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"
|
||||
|
||||
#include "test/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();
|
||||
|
||||
TEST_CHECK(fs_load_test_run(100), "Load test failed");
|
||||
|
||||
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 {
|
||||
TEST_FAIL("Speed test failed");
|
||||
}
|
||||
TEST_FINISH();
|
||||
}
|
||||
|
||||
void user_init(void)
|
||||
{
|
||||
TEST_INIT(60);
|
||||
|
||||
xTaskCreate(test_task, (signed char *)"test_task", 1024, NULL, 2, NULL);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue