File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
samples/drivers/uart/echo_bot Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (c) 2023 Nordic Semiconductor ASA
2+ #
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ import logging
6+ import pytest
7+ from twister_harness import DeviceAdapter
8+ import re
9+
10+ logger = logging .getLogger (__name__ )
11+
12+ TESTDATA = [
13+ ('zephyr' , 'Echo: zephyr' ),
14+ ('console' , 'Echo: console' ),
15+ ]
16+ @pytest .mark .parametrize ('command,expected' , TESTDATA )
17+ def test_echo_bot (dut : DeviceAdapter , command , expected ):
18+ timeout = 10.0
19+ command_ext = f'{ command } \n \n '
20+ regex_expected = f'.*{ re .escape (expected )} '
21+ dut .clear_buffer ()
22+ dut .write (command_ext .encode ())
23+ lines : list [str ] = []
24+ lines .extend (dut .readlines_until (regex = regex_expected , timeout = timeout , print_output = True ))
25+ assert expected in lines , 'expected response not found'
Original file line number Diff line number Diff line change 1010 filter : CONFIG_SERIAL and
1111 CONFIG_UART_INTERRUPT_DRIVEN and
1212 dt_chosen_enabled("zephyr,shell-uart")
13- harness : keyboard
13+ harness : pytest
You can’t perform that action at this time.
0 commit comments