| # Copyright 2022 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| *** Comments *** |
| Tests for shodan system from bootup to running apps. |
| |
| *** Settings *** |
| Resource resources/common.resource |
| Variables variables/common.py |
| Variables variables/${PLATFORM}_${BUILD_TYPE}.py |
| |
| *** Test Cases *** |
| Test Boot |
| Prepare Machine |
| Start Emulation |
| Create Terminal Tester ${SMC_UART} |
| Wait For Prompt On Uart EOF |
| # The following commented lines would cause the test failed to be saved. |
| Provides shodan-bootup |
| |
| Test C hello app (no SDK) |
| Requires shodan-bootup |
| Install App hello |
| Wait For Line On Uart I am a C app! |
| Wait For Line On Uart Done |
| Uninstall App hello |
| |
| # TODO(sleffler): This test failed with debug artifacts. |
| Test SDK keyval support (+SecurityCoordinator) |
| Requires shodan-bootup |
| Install App keyval |
| Wait For Line On Uart read(foo) failed as expected |
| Wait For Line On Uart write ok |
| Wait For Line On Uart read returned [49, 50, 51, 0 |
| Wait For Line On Uart delete ok |
| Wait For Line On Uart delete ok (for missing key) |
| Uninstall App keyval |
| |
| Test SDK log support |
| Requires shodan-bootup |
| Install App logtest |
| Wait For Line On Uart ping! |
| Wait For Line On Uart DONE |
| Uninstall App logtest |
| |
| Test panic app |
| Requires shodan-bootup |
| Install App panic |
| Wait For Line On Uart Goodbye, cruel world |
| Uninstall App panic |
| |
| # TODO b/329673199 test is flaky on nexus platform |
| Test SDK + TimerService (oneshot & periodic) |
| Skip if "${PLATFORM}" == "nexus" |
| Requires shodan-bootup |
| Install App timer |
| Wait For Line On Uart sdk_timer_cancel returned Err(SDKInvalidTimer) with nothing running |
| Wait For Line On Uart sdk_timer_poll returned Ok(0) with nothing running |
| Wait For Line On Uart sdk_timer_oneshot returned Err(SDKNoSuchTimer) with an invalid timer id |
| # oneshot |
| Wait For Line On Uart Timer 0 started |
| Wait For Line On Uart Timer 0 completed |
| # periodic |
| Wait For Line On Uart Timer 1 started |
| Wait For Line On Uart Timer completed: mask 0b0010 ms 75 |
| Wait For Line On Uart Timer completed: mask 0b0010 ms 150 |
| # NB: 10 timer events |
| # NB: intentionally match "cancel"; the code has a typo so prints "canceld" :) |
| Wait For Line On Uart Timer 1 cancel |
| # 2x periodic with 2:1 durations |
| Wait For Line On Uart Timer 1 started |
| Wait For Line On Uart Timer 2 started |
| Wait For Line On Uart Timer completed: mask 0b0010 1 \ 1 2 \ 0 |
| Wait For Line On Uart Timer completed: mask 0b0010 1 \ 2 2 \ 0 |
| # NB: lots of timer events (2 timers running) |
| Wait For Line On Uart Timer completed: mask 0b0100 1 14 2 \ 7 |
| Wait For Line On Uart Timer 2 cancel |
| Wait For Line On Uart Timer 1 cancel |
| Wait For Line On Uart DONE |
| Uninstall App timer |
| |
| Test SDK + MlCoordinator (oneshot & periodic) |
| Requires shodan-bootup |
| # UART analyzer is marked as transient so it needs to be set up at subtest. |
| Execute Command showAnalyzer "smc-uart-analyzer" ${SMC_UART} Antmicro.Renode.Analyzers.LoggingUartAnalyzer |
| # Add SMC_UART virtual time so we can check the machine execution time |
| Execute Command smc-uart-analyzer TimestampFormat Virtual |
| Write Line to Uart start mltest waitForEcho=${WAIT_ECHO} |
| Wait For Line On Uart sdk_model_oneshot(nonexistent) returned Err(SDKNoSuchModel) (as expected) |
| # start oneshot |
| Wait For Line On Uart ${MODEL_FILENAME} started |
| Wait For Line On Uart ${MODEL_FILENAME} completed |
| # start periodic |
| Wait For Line On Uart Model ${MODEL_FILENAME} started |
| # NB: 10 runs of the model |
| FOR ${i} IN RANGE 10 |
| Wait For Line On Uart Model completed: mask 0b0001 |
| END |
| Wait For Line On Uart DONE |
| Write Line To Uart stop mltest waitForEcho=${WAIT_ECHO} |
| Wait For Line On Uart Bundle "mltest" stopped |