1*** Variables ***
2${UART}                       sysbus.uart
3${URI}                        @https://dl.antmicro.com/projects/renode
4${HELLO-WORLD}                microwatt--zephyr-hello_world.elf-s_296848-426bddb72e49a17eb03f8634baa0afe49f968b69
5${MICROPYTHON}                microwatt--micropython.elf-s_2282296-072a8aac5d4d9897425f72ec2ca8ca123e6d624f
6
7*** Keywords ***
8Create Machine
9    [Arguments]  ${elf}
10
11    Execute Command           mach create
12    Execute Command           machine LoadPlatformDescription @platforms/cpus/microwatt.repl
13
14    Execute Command           sysbus LoadELF ${URI}/${elf}
15
16*** Test Cases ***
17Should Read Hello World
18    Create Machine            ${HELLO-WORLD}
19    Create Terminal Tester    ${UART}
20
21    Start Emulation
22
23    Wait For Line On Uart     Hello World! microwatt
24
25Should Start MicroPython
26    Create Machine            ${MICROPYTHON}
27    Create Terminal Tester    ${UART}
28
29    Execute Command           sysbus.cpu NIP 0
30    Start Emulation
31
32    Wait For Prompt On Uart   >>>
33
34Should Perform Simple Mathematical Operation in MicroPython
35    Create Machine            ${MICROPYTHON}
36    Create Terminal Tester    ${UART}
37
38    Execute Command           sysbus.cpu NIP 0
39    Start Emulation
40
41    Wait For Prompt On Uart   >>>
42
43    Write Line To Uart        7**3
44    Wait For Line On Uart     343
45
46Should Define And Execute Function in MicroPython
47    Create Machine            ${MICROPYTHON}
48    Create Terminal Tester    ${UART}
49
50    Execute Command           sysbus.cpu NIP 0
51    Start Emulation
52
53    Wait For Prompt On Uart   >>>
54
55    Write Line To Uart        def fib(n):
56    Write Line To Uart        ${SPACE}if n < 2:
57    Write Line To Uart        ${SPACE}${SPACE}return n
58    Write Line To Uart        ${SPACE}else:
59    Write Line To Uart        ${SPACE}${SPACE}return fib(n-1) + fib(n-2)
60    Write Line To Uart
61
62    Wait For Prompt On Uart   >>>
63
64    Write Line To Uart        fib(19)
65    Wait For Line On Uart     4181
66