From ba8742c1b8b0febd84dabedbf01cfb5aca73787b Mon Sep 17 00:00:00 2001 From: Marek Slowinski Date: Tue, 15 Apr 2025 07:19:43 +0200 Subject: [PATCH] tests: robot: renode: Use precise pause for UART keywords Remove the source of non-determinism during emulation by keeping terminal events reproducible between runs. By using the mechanism of precise pause in Renode emulator every interaction with terminal happens at the same virtual time from the perspective of an emulated system, hence makes it independent of the host. Otherwise the result of a test is susceptible to the load on the host and robot process keywords' timing. Renode emulator supports precise pausing when specified sequence of characters is received on a terminal. Besides that, char delay parameter is specified to set time interval between consecutive characters entered in the terminal. 'Start Emulation' keyword is redundant, because 'Wait For' keywords automatically continue emulation up to the nearest pause event (e.g. matched pattern on the terminal). Signed-off-by: Marek Slowinski --- samples/subsys/shell/shell_module/shell_module.robot | 1 - tests/drivers/console/line_splitting/line_splitting.robot | 1 - tests/robot/common.robot | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/subsys/shell/shell_module/shell_module.robot b/samples/subsys/shell/shell_module/shell_module.robot index 334d040a2cc..c0675287bab 100644 --- a/samples/subsys/shell/shell_module/shell_module.robot +++ b/samples/subsys/shell/shell_module/shell_module.robot @@ -7,7 +7,6 @@ Resource ${KEYWORDS} Should Read Version From Shell # `Prepare Machine` keyword comes from $ZEPHYR_BASE/tests/robot/common.robot file, which is imported as a resource Prepare Machine - Start Emulation Wait For Prompt On Uart uart:~$ Write Line To Uart version Wait For Line On Uart Zephyr version diff --git a/tests/drivers/console/line_splitting/line_splitting.robot b/tests/drivers/console/line_splitting/line_splitting.robot index 6947d6d0bf4..17f95063e74 100644 --- a/tests/drivers/console/line_splitting/line_splitting.robot +++ b/tests/drivers/console/line_splitting/line_splitting.robot @@ -6,7 +6,6 @@ Resource ${KEYWORDS} *** Test Cases *** Should Split Lines Prepare Machine - Start Emulation Wait For Next Line On Uart Write Line To Uart \rabc\nd\n waitForEcho=false Wait For Line On Uart getline: abc; diff --git a/tests/robot/common.robot b/tests/robot/common.robot index 2bebe955797..b8099de25da 100644 --- a/tests/robot/common.robot +++ b/tests/robot/common.robot @@ -4,4 +4,5 @@ Prepare Machine Execute Command $elf = ${ELF} Execute Command include ${RESC} - Create Terminal Tester ${UART} + Create Terminal Tester ${UART} defaultPauseEmulation=True + Write Char Delay 0.01