mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
Merge branch 'feature/console_repl_test' into 'master'
console: add running repl test in CI Closes IDF-6611 See merge request espressif/esp-idf!23016
This commit is contained in:
commit
1a1b0036a6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -7,10 +7,10 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_runner.h"
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
// Some resources are lazy allocated (newlib locks) in the console code, the threshold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (-100)
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (-150)
|
||||
|
||||
static size_t before_free_8bit;
|
||||
static size_t before_free_32bit;
|
||||
@ -40,6 +40,12 @@ void tearDown(void)
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
/* Preallocate some newlib locks to avoid it from
|
||||
registering as memory leaks */
|
||||
|
||||
struct timeval tv = { 0 };
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
printf("Running console component tests\n");
|
||||
unity_run_menu();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -9,6 +9,7 @@
|
||||
#include "unity.h"
|
||||
#include "esp_console.h"
|
||||
#include "argtable3/argtable3.h"
|
||||
#include "linenoise/linenoise.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
@ -41,10 +42,15 @@ static int do_cmd_quit(int argc, char **argv)
|
||||
{
|
||||
printf("ByeBye\r\n");
|
||||
s_repl->del(s_repl);
|
||||
|
||||
linenoiseHistoryFree(); // Free up memory
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Enter "quit" to exit REPL environment
|
||||
/* Marked as ignore since it cannot run as a normal unity test case
|
||||
ran separately in test_console_repl */
|
||||
TEST_CASE("esp console repl test", "[console][ignore]")
|
||||
{
|
||||
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
|
||||
|
@ -9,3 +9,16 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.supported_targets
|
||||
def test_console(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.supported_targets
|
||||
def test_console_repl(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('"esp console repl test"')
|
||||
|
||||
dut.expect_exact('esp>')
|
||||
dut.write('quit')
|
||||
|
||||
dut.expect_exact('ByeBye')
|
||||
dut.expect_unity_test_output()
|
||||
|
Loading…
Reference in New Issue
Block a user