change(console): changed unit tests according to sorted help

Merges https://github.com/espressif/esp-idf/pull/12525
This commit is contained in:
Jakob Hasse
2023-11-10 16:53:01 +08:00
parent 07a9137fd7
commit dad563cfaf
3 changed files with 101 additions and 61 deletions
@@ -15,27 +15,34 @@ def do_test_quit(dut: Dut) -> None:
dut.expect_exact('ByeBye', timeout=5)
def do_test_help_generic(dut: Dut) -> None:
def do_test_help_generic(dut: Dut, registration_order: str) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"esp console help command"')
dut.write('"esp console help command - {} registration"'.format(registration_order))
dut.expect_exact('esp>', timeout=5)
dut.write('help')
dut.expect_exact('quit', timeout=5)
dut.expect_exact('Quit REPL environment', timeout=5)
dut.expect_exact('aaa', timeout=5)
dut.expect_exact('should appear first in help', timeout=5)
dut.expect(r'help\s+\[<string>\]', timeout=5)
# Note: repl seems to do the line breaks by itself, this needs to be adjusted if repl changes its line width
dut.expect_exact('Print the summary of all registered commands if no arguments are given,', timeout=5)
dut.expect_exact('otherwise print summary of given command.', timeout=5)
dut.expect(r'<string>\s+Name of command\s+esp>', timeout=5)
dut.expect(r'<string>\s+Name of command', timeout=5)
dut.expect_exact('quit', timeout=5)
dut.expect_exact('Quit REPL environment', timeout=5)
dut.expect_exact('zzz', timeout=5)
dut.expect_exact('should appear last in help', timeout=5)
dut.expect_exact('esp>', timeout=5)
def do_test_help_quit(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"esp console help command"')
dut.write('"esp console help command - sorted registration"')
dut.expect_exact('esp>', timeout=5)
dut.write('help quit')
@@ -43,54 +50,51 @@ def do_test_help_quit(dut: Dut) -> None:
dut.expect(r'quit\s+Quit REPL environment\s+esp>', timeout=5)
@pytest.mark.generic
@pytest.mark.supported_targets
def test_console(dut: Dut) -> None:
@pytest.mark.parametrize(
'test_on', [
pytest.param('target', marks=[pytest.mark.supported_targets, pytest.mark.generic]),
pytest.param('qemu', marks=[pytest.mark.esp32, pytest.mark.host_test, pytest.mark.qemu]),
]
)
def test_console(dut: Dut, test_on: str) -> None:
dut.run_all_single_board_cases()
@pytest.mark.generic
@pytest.mark.supported_targets
def test_console_repl(dut: Dut) -> None:
@pytest.mark.parametrize(
'test_on', [
pytest.param('target', marks=[pytest.mark.supported_targets, pytest.mark.generic]),
pytest.param('qemu', marks=[pytest.mark.esp32, pytest.mark.host_test, pytest.mark.qemu]),
]
)
def test_console_repl(dut: Dut, test_on: str) -> None:
do_test_quit(dut)
@pytest.mark.generic
@pytest.mark.supported_targets
def test_console_help_generic(dut: Dut) -> None:
do_test_help_generic(dut)
@pytest.mark.parametrize(
'test_on', [
pytest.param('target', marks=[pytest.mark.supported_targets, pytest.mark.generic]),
pytest.param('qemu', marks=[pytest.mark.esp32, pytest.mark.host_test, pytest.mark.qemu]),
]
)
def test_console_help_sorted_registration(dut: Dut, test_on: str) -> None:
do_test_help_generic(dut, 'sorted')
@pytest.mark.generic
@pytest.mark.supported_targets
def test_console_help_quit(dut: Dut) -> None:
do_test_help_quit(dut)
@pytest.mark.host_test
@pytest.mark.qemu
@pytest.mark.esp32
@pytest.mark.esp32c3
def test_console_qemu(dut: Dut) -> None:
dut.run_all_single_board_cases()
@pytest.mark.host_test
@pytest.mark.qemu
@pytest.mark.esp32
def test_console_repl_qemu(dut: Dut) -> None:
do_test_quit(dut)
@pytest.mark.host_test
@pytest.mark.qemu
@pytest.mark.esp32
def test_console_help_generic_qemu(dut: Dut) -> None:
do_test_help_generic(dut)
@pytest.mark.host_test
@pytest.mark.qemu
@pytest.mark.esp32
def test_console_help_quit_qemu(dut: Dut) -> None:
@pytest.mark.parametrize(
'test_on', [
pytest.param('target', marks=[pytest.mark.supported_targets, pytest.mark.generic]),
pytest.param('qemu', marks=[pytest.mark.esp32, pytest.mark.host_test, pytest.mark.qemu]),
]
)
def test_console_help_reverse_registration(dut: Dut, test_on: str) -> None:
do_test_help_generic(dut, 'reverse')
@pytest.mark.parametrize(
'test_on', [
pytest.param('target', marks=[pytest.mark.supported_targets, pytest.mark.generic]),
pytest.param('qemu', marks=[pytest.mark.esp32, pytest.mark.host_test, pytest.mark.qemu]),
]
)
def test_console_help_quit(dut: Dut, test_on: str) -> None:
do_test_help_quit(dut)