sim:tests: add shodan_stress robot script Script to stress Cantrip and in particular the MemoryManager. To start we sequentially run randomly selected applications. Note this is mostly useful with a release build where there is limited memory and the MemoryManager needs to constantly recycle resources. Bug: 274954207 Change-Id: I06223856e0e652ce86416b70a9d1466a822bb9e1
diff --git a/shodan_stress.robot b/shodan_stress.robot new file mode 100644 index 0000000..5778ab3 --- /dev/null +++ b/shodan_stress.robot
@@ -0,0 +1,102 @@ +*** Comments *** +Stress test for shodan system. + +*** Variables *** +${MAX_ITER} 100 + +${LOG_TIMEOUT} 2 +${ROOTDIR} ${CURDIR}/../.. +${SCRIPT} sim/config/shodan.resc +${PROMPT} CANTRIP> +${UART5} sysbus.uart5 + +${MATCHA_BUNDLE_RELEASE} ${ROOTDIR}/out/matcha-bundle-release.elf +${CANTRIP_KERNEL_RELEASE} ${ROOTDIR}/out/cantrip/riscv32-unknown-elf/release/kernel/kernel.elf +${CANTRIP_ROOTSERVER_RELEASE} ${ROOTDIR}/out/cantrip/riscv32-unknown-elf/release/capdl-loader + +${OUT_TMP} ${ROOTDIR}/out/tmp + +${FLASH_RELEASE_TAR} out/ext_flash_release.tar +${CPIO_RELEASE} out/cantrip/riscv32-unknown-elf/release/ext_builtins.cpio + +*** Keywords *** +Prepare Machine + Execute Command path set @${ROOTDIR} + Execute Command $tar=@${FLASH_RELEASE_TAR} + Execute Command $cpio=@${CPIO_RELEASE} + Execute Command $kernel=@${CANTRIP_KERNEL_RELEASE} + Set Default Uart Timeout 10 + Create Log Tester ${LOG_TIMEOUT} + Execute Script ${SCRIPT} + # Add UART5 virtual time so we can check the machine execution time + Execute Command uart5-analyzer TimestampFormat Virtual + Execute Command cpu0 IsHalted false + +Stop App + [Arguments] ${app} + Write Line To Uart stop ${app} + Wait For Line On Uart Bundle "${app}" stopped + +*** Test Cases *** +Prepare Flash Tarball + Run Process mkdir -p ${ROOTDIR}/out/tmp + Run Process cp -f ${MATCHA_BUNDLE_RELEASE} ${OUT_TMP}/matcha-tock-bundle-release + Run Process riscv32-unknown-elf-strip ${OUT_TMP}/matcha-tock-bundle-release + Run Process riscv32-unknown-elf-objcopy -O binary -g ${OUT_TMP}/matcha-tock-bundle-release ${OUT_TMP}/matcha-tock-bundle.bin + Run Process ln -sfr ${CANTRIP_KERNEL_RELEASE} ${OUT_TMP}/kernel + Run Process ln -sfr ${CANTRIP_ROOTSERVER_RELEASE} ${OUT_TMP}/capdl-loader + Run Process tar -C ${OUT_TMP} -cvhf ${ROOTDIR}/${FLASH_RELEASE_TAR} matcha-tock-bundle.bin kernel capdl-loader + Provides flash-tarball + +Test Shodan Boot + Requires flash-tarball + Prepare Machine + Start Emulation + Create Terminal Tester ${UART5} + Wait For Prompt On Uart ${PROMPT} + + FOR ${iter} IN RANGE ${MAX_ITER} + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start hello + Wait For Line On Uart Done, sleeping in WFI loop + Stop App hello + END + + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start fibonacci + Wait For Line On Uart [10] + Stop App fibonacci + END + + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start keyval + Wait For Line On Uart delete ok (for missing key) + Stop App keyval + END + + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start logtest + Wait For Line On Uart DONE + Stop App logtest + END + + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start panic + Wait For Line On Uart Goodbye, cruel world + Stop App panic + END + + IF ${{random.randint(0, 2)}} == 0 + Write Line to Uart start timer + Wait For Line On Uart DONE! + Stop App timer + END + + IF ${{random.randint(0, 4)}} == 0 + Write Line to Uart start mltest + Wait For Line On Uart DONE! + Stop App mltest + END + + Write Line to Uart mdebug + END