mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 08:01:43 +01:00
test: add new test framework for different configurations
Paremeterized Test Framework ----------------------------- The SPI has a lot of parameters, which works in the same process. This framework provides a way to easily test different parameter sets. The framework can work in two different ways: - local test: which requires only one board to perform the test - master & slave test: which generates two sub test items which uses the same config set to cooperate to perform the test. The user defines a (pair if master/slave) set of init/deinit/loop functions. Then the test framework will call init once, then call loop several times with different configurations, then call deinit. Then a unit test can be appended by add a parameter group, and pass it into a macro.
This commit is contained in:
committed by
Michael (XIAO Xufeng)
parent
5c88c5996d
commit
d9c5016e08
21
components/driver/test/param_test/param_test.c
Normal file
21
components/driver/test/param_test/param_test.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "param_test.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void test_serializer(const param_group_t *param_group, const ptest_func_t* test_func)
|
||||
{
|
||||
ESP_LOGI("test", "run test: %s", param_group->name);
|
||||
//in this test case, we want to make two devices as similar as possible, so use the same context
|
||||
void *context = NULL;
|
||||
test_func->pre_test(&context);
|
||||
|
||||
void *pset = param_group->param_group;
|
||||
for (int i = param_group->pset_num; i >0; i--) {
|
||||
if (test_func->def_param) test_func->def_param(pset);
|
||||
test_func->loop(pset, context);
|
||||
pset+=param_group->pset_size;
|
||||
}
|
||||
|
||||
test_func->post_test(context);
|
||||
free(context);
|
||||
context = NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user