1*** Variables ***
2${SCRIPT}                     ${CURDIR}/../../scripts/single-node/icicle-kit.resc
3${UART_HSS}                   sysbus.mmuart0
4${UART}                       sysbus.mmuart1
5
6*** Keywords ***
7Prepare Machine
8    # we use special FDT that contains spi sensors
9    Execute Script            ${SCRIPT}
10    Set Default Uart Timeout  300
11
12*** Test Cases ***
13Should Boot HSS
14    [Documentation]           Boots Hart Software Services on Icicle Kit with PolarFire SoC
15    [Tags]                    bootloader  uart  ddr  sd
16    Prepare Machine
17
18    ${hss}=                   Create Terminal Tester          ${UART_HSS}
19
20    Start Emulation
21
22    Wait For Line On Uart     Timeout in (\\d+) seconds       testerId=${hss}  treatAsRegex=true
23    Wait For Line On Uart     u54_\\d+:sbi_init 80200000      testerId=${hss}  treatAsRegex=true
24    Wait For Line On Uart     u54_\\d+:sbi_init 80200000      testerId=${hss}  treatAsRegex=true
25    Wait For Line On Uart     u54_\\d+:sbi_init 80200000      testerId=${hss}  treatAsRegex=true
26    Wait For Line On Uart     u54_\\d+:sbi_init 80200000      testerId=${hss}  treatAsRegex=true
27
28    Provides                  booted-hss
29
30Should Boot U-Boot
31    [Documentation]           Boots U-Boot from SD card on Icicle Kit with PolarFire SoC
32    [Tags]                    bootloader  uart
33    Requires                  booted-hss
34
35    ${uart}=                  Create Terminal Tester          ${UART}
36
37    Wait For Prompt On Uart   Hit any key to stop autoboot    testerId=${uart}  treatAsRegex=true
38    Wait For Line On Uart     Loading kernel from FIT Image   testerId=${uart}  treatAsRegex=true
39    Wait For Line On Uart     Loading ramdisk from FIT Image  testerId=${uart}  treatAsRegex=true
40    Wait For Line On Uart     Loading fdt from FIT Image      testerId=${uart}  treatAsRegex=true
41    Wait For Line On Uart     Starting kernel ...             testerId=${uart}  treatAsRegex=true
42
43    Provides                  booted-uboot
44
45Should Boot Linux
46    [Documentation]           Boots Linux on Icicle Kit with PolarFire SoC.
47    [Tags]                    linux  uart  interrupts
48    Requires                  booted-uboot
49
50    ${uart}=                  Create Terminal Tester          ${UART}
51
52    Wait For Prompt On Uart   buildroot login:  testerId=${uart}
53    Write Line To Uart        root              testerId=${uart}
54    Wait For Prompt On Uart   Password          testerId=${uart}
55    Write Line To Uart        root              testerId=${uart}  waitForEcho=false
56    Wait For Prompt On Uart   \#                testerId=${uart}
57
58    Provides                  booted-linux
59
60Should Ls
61    [Documentation]           Tests shell responsiveness in Linux on Icicle Kit
62    [Tags]                    linux  uart  interrupts
63    Requires                  booted-linux
64
65    ${uart}=                  Create Terminal Tester          ${UART}
66
67    Write Line To Uart        ls /              testerId=${uart}
68    Wait For Line On Uart     proc              testerId=${uart}
69
70