14#include "esp_console.h"
16#if CONFIG_ENABLE_UNIT_TEST
18#define UT_CMD_MIN_ARGS 4
43 int parsed_argc =
UT_GET_ARG(3, uint16_t, argv);
52 for (
size_t i = 0; i < parsed_argc; i++)
82 const esp_console_cmd_t cmd = {
84 .help =
"Run unit tests",
88 return esp_console_cmd_register(&cmd);
103 esp_console_repl_t *repl = NULL;
104 esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
106 repl_config.prompt =
"X>";
109#if CONFIG_ESP_CONSOLE_UART
110 esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
111 ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl));
113#if CONFIG_ESP_CONSOLE_USB_CDC
114 esp_console_dev_usb_cdc_config_t cdc_config = ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT();
115 ESP_ERROR_CHECK(esp_console_new_repl_usb_cdc(&cdc_config, &repl_config, &repl));
117#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
118 esp_console_dev_usb_serial_jtag_config_t usbjtag_config = ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT();
119 ESP_ERROR_CHECK(esp_console_new_repl_usb_serial_jtag(&usbjtag_config, &repl_config, &repl));
128 err = esp_console_start_repl(repl);
meshx_err_t
MeshX Error Codes.
Logging interface for MeshX with color-coded output.
#define MESHX_LOGE(module_id, format,...)
#define MESHX_LOGD(module_id, format,...)
module_id_t
Enumeration of module IDs.
static meshx_err_t ut_command_handler(int argc, char **argv)
Handles unit test commands by invoking the appropriate callback based on the module ID.
meshx_err_t register_ut_command()
Registers the unit test (ut) command with the ESP console.
meshx_err_t init_unit_test_console()
Initialize the production console.
meshx_err_t register_unit_test(module_id_t module_id, module_callback_t callback)
Register a unit test for a specific module.
static unit_test_callback_t callback_list[MODULE_ID_MAX]
Header file for the production console unit test functionality.
meshx_err_t(* module_callback_t)(int cmd_id, int argc, char **argv)
Callback function for unit test modules.
#define UT_GET_ARG(_x, _type, _argv)
Macro to extract an argument from the argument list.
struct callback_node unit_test_callback_t
Structure to hold the unit test callback function.