1*** Variables ***
2${SCRIPT}                     ${CURDIR}/../../scripts/single-node/gr716_zephyr.resc
3${SYNCHRONIZATION_BIN}        @https://dl.antmicro.com/projects/renode/gr716a_mini-zephyr-synchronization.elf-s_326772-0b5df5d77c3c1db76ad1fe52116005ac4e2f273c
4${UART}                       sysbus.uart
5${PROMPT}                     uart:~$
6
7*** Keywords ***
8Prepare Machine
9    [Arguments]               ${bin}=${None}
10    IF  ${{$bin is not None}}
11        Execute Command           $bin = ${bin}
12    END
13    Execute Script            ${SCRIPT}
14
15    Create Terminal Tester    ${UART}  defaultPauseEmulation=true
16
17*** Test Cases ***
18Should Boot Zephyr
19    [Documentation]           Boots Zephyr on the GR716 platform.
20    [Tags]                    zephyr  uart
21    Prepare Machine
22
23    Start Emulation
24
25    Wait For Prompt On Uart   ${PROMPT}
26
27    Provides                  booted-zephyr
28
29Should Print Version
30    [Documentation]           Tests shell responsiveness in Zephyr on the GR716 platform.
31    [Tags]                    zephyr  uart
32    Requires                  booted-zephyr
33
34    Write Line To Uart        version
35    Wait For Line On Uart     Zephyr version 2.6.99
36
37Should Run Zephyr Synchronization Sample
38    Prepare Machine           ${SYNCHRONIZATION_BIN}
39
40    Wait For Line On Uart     thread_a: Hello World from cpu 0 on gr716a_mini!
41
42    # The sample does k_busy_wait(100000) + k_msleep(500) = 600 ms
43    Execute Command           emulation RunFor "0.59"
44    Should Not Be On Uart     thread_b: Hello World from cpu 0 on gr716a_mini!  timeout=0
45    Wait For Line On Uart     thread_b: Hello World from cpu 0 on gr716a_mini!  timeout=0.02
46
47    Execute Command           emulation RunFor "0.59"
48    Should Not Be On Uart     thread_a: Hello World from cpu 0 on gr716a_mini!  timeout=0
49    Wait For Line On Uart     thread_a: Hello World from cpu 0 on gr716a_mini!  timeout=0.02
50