sencha robots: add soundstream sanity check

Checks the output of the soundstream dmeo. This assumes the demo is setup
to run one iteration of the input loop with a 2000 sample audio buffer.

Bypass-Presubmit-Reason: no CI tests (but soon)

Change-Id: If313611dd932c8beda8231feb4a7dd4a30c4dc35
diff --git a/resources/sencha.resource b/resources/sencha.resource
index eb68338..d5b8705 100644
--- a/resources/sencha.resource
+++ b/resources/sencha.resource
@@ -9,3 +9,18 @@
     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
+    Execute Command             sysbus.cpu1 IsHalted false
+
+Prepare SenchaMachine
+    Execute Command             path set @${ROOTDIR}
+    Execute Command             $repl_file=@sim/config/platforms/sencha.repl
+    Execute Command             $tar=@out/cheriot/sencha/release/ext_flash.tar
+    Execute Command             $cheriot_elf=@${CHERIOT_OUTDIR}/soundstream-firmware
+    Set Default Uart Timeout    20
+    Create Log Tester           ${LOG_TIMEOUT}
+    Execute Script              sim/config/sencha.resc
+    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
+    Execute Command             cpu0 IsHalted false
+
diff --git a/sencha_soundstream.robot b/sencha_soundstream.robot
new file mode 100644
index 0000000..fb39d24
--- /dev/null
+++ b/sencha_soundstream.robot
@@ -0,0 +1,42 @@
+# Copyright 2024 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 sencha system from bootup to running one iteration of the soundstream demo.
+
+*** Settings ***
+Resource  resources/sencha.resource
+Variables  variables/common.py
+Variables  variables/${PLATFORM}_${BUILD_TYPE}.py
+
+*** Test Cases ***
+Test Soundstream
+    Prepare SenchaMachine
+    Start Emulation
+    Create Terminal Tester      ${SMC_UART}
+
+    Wait For Line On Uart       SOUNDSTREAM: soundstream (Thread 0x1)
+    Wait For Line On Uart       SOUNDSTREAM: Setup complete
+    Wait For Line On Uart       SOUNDSTREAM: Start recording
+    Wait For Line On Uart       SOUNDSTREAM: Done recording
+    Wait For Line On Uart       SOUNDSTREAM: Processing recorded audio
+
+    # NB: one audio collection generates 6 ML ops
+    FOR    ${iter}    IN RANGE    5
+      Wait For Line On Uart     SOUNDSTREAM: Iteration ${iter}
+      Wait For Line On Uart     SOUNDSTREAM: [sound]::ENCODER:
+    END
+    Wait For Line On Uart       SOUNDSTREAM: [sound]::ENCODER: done
+
+    Wait For Line On Uart       SOUNDSTREAM: Done with processing