Add shodan boot test. * Update test runner script. * Add example robot test. * To run the test: $> ./sim/tests/test.sh sim/tests/shodan.robot Change-Id: Ie10be9940f7c8f6498dae8faa800caa823bb7d3f
diff --git a/shodan_boot.robot b/shodan_boot.robot new file mode 100644 index 0000000..5d369d9 --- /dev/null +++ b/shodan_boot.robot
@@ -0,0 +1,42 @@ +*** Settings *** +Suite Setup Setup +Suite Teardown Teardown +Test Setup Reset Emulation +Test Teardown Test Teardown +Resource ${RENODEKEYWORDS} + +*** Variables *** +${LOG_TIMEOUT} 1 +${ROOTDIR} @${CURDIR}/../.. +${SCRIPT} sim/config/shodan_all.resc +${PROMPT} KATA> +${UART0} sysbus.uart0 +${UART1} sysbus.uart1 +${UART2} sysbus.uart2 +${UART3} sysbus.uart3 + +*** Keywords *** +Prepare Machine + Execute Command path set ${ROOTDIR} + Execute Script ${SCRIPT} + Execute Command cpu0 IsHalted false + Execute Command cpu1 IsHalted false + Set Default Uart Timeout 300 + + +*** Test Cases *** +Shodan Smoke Test + [Documentation] Test TockOS boot, seL4 boot and ML Execution + [Tags] ml tock seL4 uart + Prepare Machine + Create Log Tester ${LOG_TIMEOUT} + ${tockuart}= Create Terminal Tester ${UART0} + ${sel4uart}= Create Terminal Tester ${UART1} + Start Emulation + + Wait For Line On Uart OpenTitan initialisation complete. testerId=${tockuart} + Wait For Line On Uart Booting all finished, dropped to user space testerId=${sel4uart} + Wait For Prompt On Uart ${PROMPT} testerId=${sel4uart} + Write Line To Uart test_mlexecute testerId=${sel4uart} + Wait For Prompt On Uart ${PROMPT} testerId=${sel4uart} + Wait For LogEntry "main returned: ", 0
diff --git a/shodan_bootrom.robot b/shodan_bootrom.robot deleted file mode 100644 index c00b239..0000000 --- a/shodan_bootrom.robot +++ /dev/null
@@ -1,22 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Resource ${RENODEKEYWORDS} - -*** Test Cases *** -Should Boot from BootROM - Execute Command mach create - Execute Command machine LoadPlatformDescription @${PATH}/sim/config/shodan_secure.repl - Execute Command sysbus LoadELF @${PATH}/out/opentitan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf - Execute Command sysbus LoadELF @${PATH}/out/opentitan/build-bin/sw/device/examples/hello_world/hello_world_sim_verilator.elf - Execute Command sysbus.cpu_0 PC 0x8084 - - Create Terminal Tester sysbus.uart - - Start Emulation - - Wait For Line On Uart Hello World - -
diff --git a/shodan_plic_test.robot b/shodan_plic_test.robot deleted file mode 100644 index d3c503d..0000000 --- a/shodan_plic_test.robot +++ /dev/null
@@ -1,35 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Library DebugLibrary -Resource ${RENODEKEYWORDS} - -*** Variables *** -${BOOTROM_ELF} @${PATH}/out/shodan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf -${SHODAN_SECURE_REPL} @${PATH}/sim/config/shodan_secure.repl -${PLIC_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_plic_sanitytest_sim_verilator.elf -${UART} sysbus.uart - -*** Keywords *** -Create Machine - [Arguments] ${elf} - - Execute Command mach create - Execute Command machine LoadPlatformDescription @${SHODAN_SECURE_REPL} - Execute Command sysbus LoadELF @${BOOTROM_ELF} - Execute Command sysbus LoadELF @${elf} - Execute Command sysbus.cpu_0 PC 0x8084 - - -*** Test Cases *** - -PLIC Sanity Test - Create Machine ${PLIC_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1
diff --git a/shodan_rv_timer_test.robot b/shodan_rv_timer_test.robot deleted file mode 100644 index 9decc47..0000000 --- a/shodan_rv_timer_test.robot +++ /dev/null
@@ -1,35 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Library DebugLibrary -Resource ${RENODEKEYWORDS} - -*** Variables *** -${BOOTROM_ELF} @${PATH}/out/shodan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf -${SHODAN_SECURE_REPL} @${PATH}/sim/config/shodan_secure.repl -${RV_TIMER_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_rv_timer_sanitytest_sim_verilator.elf -${UART} sysbus.uart - -*** Keywords *** -Create Machine - [Arguments] ${elf} - - Execute Command mach create - Execute Command machine LoadPlatformDescription @${SHODAN_SECURE_REPL} - Execute Command sysbus LoadELF @${BOOTROM_ELF} - Execute Command sysbus LoadELF @${elf} - Execute Command sysbus.cpu_0 PC 0x8084 - - -*** Test Cases *** - -RV Timer Sanity Test - Create Machine ${RV_TIMER_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1
diff --git a/shodan_tock_test.robot b/shodan_tock_test.robot deleted file mode 100644 index 675cddf..0000000 --- a/shodan_tock_test.robot +++ /dev/null
@@ -1,35 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Library DebugLibrary -Resource ${RENODEKEYWORDS} - -*** Variables *** -${BOOTROM_ELF} @${PATH}/out/shodan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf -${SHODAN_SECURE_REPL} @${PATH}/sim/config/shodan_secure.repl -${TOCK_TEST} @${PATH}/out/tock/riscv32imc-unknown-none-elf/release/earlgrey-nexysvideo.elf -${UART} sysbus.uart - -*** Keywords *** -Create Machine - [Arguments] ${elf} - - Execute Command mach create - Execute Command machine LoadPlatformDescription @${SHODAN_SECURE_REPL} - Execute Command sysbus LoadELF @${BOOTROM_ELF} - Execute Command sysbus LoadELF @${elf} - Execute Command sysbus.cpu_0 PC 0x8084 - - -*** Test Cases *** - -Tock Test - Create Machine ${TOCK_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart OpenTitan initialisation complete timeout=1
diff --git a/shodan_uart_test.robot b/shodan_uart_test.robot deleted file mode 100644 index 3efed05..0000000 --- a/shodan_uart_test.robot +++ /dev/null
@@ -1,50 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Library DebugLibrary -Resource ${RENODEKEYWORDS} - -*** Variables *** -${BOOTROM_ELF} @${PATH}/out/shodan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf -${SHODAN_SECURE_REPL} @${PATH}/sim/config/shodan_secure.repl -${UART_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_uart_sanitytest_sim_verilator.elf -${UART_TX_RX_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/uart_tx_rx_test_sim_verilator.elf -${UART} sysbus.uart - -*** Keywords *** -Create Machine - [Arguments] ${elf} - - Execute Command mach create - Execute Command machine LoadPlatformDescription @${SHODAN_SECURE_REPL} - Execute Command sysbus LoadELF @${BOOTROM_ELF} - Execute Command sysbus LoadELF @${elf} - Execute Command sysbus.cpu_0 PC 0x8084 - - -*** Test Cases *** - -UART Sanity Test - Create Machine ${UART_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1 - - -UART TX RX Test - Create Machine ${UART_TX_RX_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart UART TX RX test timeout=1 - Wait For Line On Uart Initializing the UART timeout=1 - Wait For Line on Uart Initializing the PLIC timeout=1 - Wait For Line on Uart Executing the test. timeout=1
diff --git a/shodan_unit_tests.robot b/shodan_unit_tests.robot deleted file mode 100644 index 8084408..0000000 --- a/shodan_unit_tests.robot +++ /dev/null
@@ -1,80 +0,0 @@ - -*** Settings *** -Suite Setup Setup -Suite Teardown Teardown -Test Setup Reset Emulation -Library DebugLibrary -Resource ${RENODEKEYWORDS} - -*** Variables *** -${BOOTROM_ELF} @${PATH}/out/shodan/build-bin/sw/device/boot_rom/boot_rom_sim_verilator.elf -${SHODAN_SECURE_REPL} @${PATH}/sim/config/shodan_secure.repl -${UART_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_uart_sanitytest_sim_verilator.elf -${UART_TX_RX_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/uart_tx_rx_test_sim_verilator.elf -${PLIC_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_plic_sanitytest_sim_verilator.elf -${RV_TIMER_SANITY_TEST} @${PATH}/out/shodan/build-out/sw_shodan/device/tests/dif_rv_timer_sanitytest_sim_verilator.elf -${TOCK_TEST} @${PATH}/out/tock/riscv32imc-unknown-none-elf/release/earlgrey-nexysvideo.elf -${UART} sysbus.uart - -*** Keywords *** -Create Machine - [Arguments] ${elf} - - Execute Command mach create - Execute Command machine LoadPlatformDescription @${SHODAN_SECURE_REPL} - Execute Command sysbus LoadELF @${BOOTROM_ELF} - Execute Command sysbus LoadELF @${elf} - Execute Command sysbus.cpu_0 PC 0x8084 - - -*** Test Cases *** - -UART Sanity Test - Create Machine ${UART_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1 - - -UART TX RX Test - Create Machine ${UART_TX_RX_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart UART TX RX test timeout=1 - Wait For Line On Uart Initializing the UART timeout=1 - Wait For Line on Uart Initializing the PLIC timeout=1 - Wait For Line on Uart Executing the test. timeout=1 - -PLIC Sanity Test - Create Machine ${PLIC_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1 - -RV Timer Sanity Test - Create Machine ${RV_TIMER_SANITY_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart PASS! timeout=1 - -Tock Test - Create Machine ${TOCK_TEST} - - Create Terminal Tester ${UART} - - Start Emulation - Wait For Line On Uart Boot ROM initialisation has completed, jump into flash! timeout=1 - Wait For Line On Uart OpenTitan initialisation complete timeout=1
diff --git a/test.sh b/test.sh index a34cf30..74ec160 100755 --- a/test.sh +++ b/test.sh
@@ -1,20 +1,31 @@ #!/bin/bash -set -e -set -u -ROOT_PATH="${ROOTDIR}/sim/renode" -TESTS_FILE="$ROOT_PATH/tests/tests.yaml" -TESTS_RESULTS="$OUT/host/renode/tests" - -. "${ROOT_PATH}/tools/common.sh" - -set +e -STTY_CONFIG=`stty -g 2>/dev/null` -$PYTHON_RUNNER -u "`get_path "$ROOT_PATH/tests/run_tests.py"`" --exclude "skip_${DETECTED_OS}" --properties-file "`get_path "$ROOT_PATH/output/properties.csproj"`" -r "`get_path "$TESTS_RESULTS"`" -t "`get_path "$TESTS_FILE"`" "$@" --variable PATH:${ROOTDIR} -RESULT_CODE=$? -set -e -if [ -n "${STTY_CONFIG:-}" ] -then - stty "$STTY_CONFIG" +if [[ -z "${ROOTDIR}" ]]; then + echo "Source build/setup.sh first" + exit 1 fi -exit $RESULT_CODE + +set -u # Treat unset params as errors. + +RENODE_SRC_DIR="${ROOTDIR}/sim/renode" +RENODE_DIR="${OUT}/host/renode" +TESTS_FILE="${RENODE_SRC_DIR}/tests/tests.yaml" +TESTS_RESULTS="${OUT}/renode_test_results" + +. "${RENODE_SRC_DIR}/tools/common.sh" + +STTY_CONFIG=`stty -g 2>/dev/null` +${PYTHON_RUNNER} -u "$(get_path "${RENODE_SRC_DIR}/tests/run_tests.py")" \ + --exclude "skip_${DETECTED_OS}" \ + --properties-file "$(get_path "${RENODE_SRC_DIR}/output/properties.csproj")" \ + -r "$(get_path "${TESTS_RESULTS}")" \ + -t "$(get_path "${TESTS_FILE}")" "$@" \ + --variable PATH:"${ROOTDIR}" \ + --robot-framework-remote-server-full-directory "${RENODE_DIR}" \ + --show-log + +RESULT_CODE=$? +if [[ -n "${STTY_CONFIG:-}" ]]; then + stty "${STTY_CONFIG}" +fi +exit ${RESULT_CODE}