sencha robots: add testbench sanity check

Adds the cheriot-rtos test suite. This requires the artifacts generated by
"m cheriot-test" be present.

Bypass-Presubmit-Reason: no sencha CI tests

Change-Id: Iba28310b4625bbe31caabccc551465a18f33591e
diff --git a/resources/sencha.resource b/resources/sencha.resource
new file mode 100644
index 0000000..eb68338
--- /dev/null
+++ b/resources/sencha.resource
@@ -0,0 +1,11 @@
+*** Keywords ***
+Prepare SailMachine
+    Execute Command             path set @${ROOTDIR}
+    Execute Command             $repl_file=@sim/config/platforms/sail.repl
+    Execute Command             $cheriot_elf=@out/cheriot/test-suite/release/cheriot/cheriot/release/test-suite
+    Set Default Uart Timeout    20
+    Create Log Tester           ${LOG_TIMEOUT}
+    Execute Script              sim/config/cheriot.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
diff --git a/sencha_testbench.robot b/sencha_testbench.robot
new file mode 100644
index 0000000..6007ac6
--- /dev/null
+++ b/sencha_testbench.robot
@@ -0,0 +1,46 @@
+# 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 the cheriot-rtos test suite.
+
+*** Settings ***
+Resource  resources/sencha.resource
+Variables  variables/common.py
+Variables  variables/${PLATFORM}_${BUILD_TYPE}.py
+
+*** Test Cases ***
+Test CHERIoT-RTOS Test Suite
+    Prepare SailMachine
+    Start Emulation
+    Create Terminal Tester      ${SMC_UART}
+
+    # Check only that test cases finish
+    Wait For Line On Uart       Test runner: Checking that rel-ro caprelocs work
+    Wait For Line On Uart       Test runner: MMIO finished
+    Wait For Line On Uart       Test runner: Static sealing finished
+    Wait For Line On Uart       Test runner: Crash recovery finished
+    Wait For Line On Uart       Test runner: Compartment calls finished
+    Wait For Line On Uart       Test runner: check_pointer finished
+    Wait For Line On Uart       Test runner: Misc APIs finished
+    Wait For Line On Uart       Test runner: Stacks exhaustion in the switcher finished
+    Wait For Line On Uart       Test runner: Thread pool finished
+    Wait For Line On Uart       Test runner: Global Constructors finished
+    Wait For Line On Uart       Test runner: Queue finished
+    Wait For Line On Uart       Test runner: Futex finished
+    Wait For Line On Uart       Test runner: Locks finished
+    Wait For Line On Uart       Test runner: Event groups finished
+    Wait For Line On Uart       Test runner: Multiwaiter finished
+    Wait For Line on Uart       Test runner: Allocator finished
+    Wait For Line on Uart       Test runner: All tests finished
diff --git a/variables/common.py b/variables/common.py
index a9a1f72..9f470d5 100644
--- a/variables/common.py
+++ b/variables/common.py
@@ -13,9 +13,9 @@
 # it was passed, else any changes are only local to this file
 _BUILD_TYPE = BuiltIn().get_variable_value("${BUILD_TYPE}")
 if _BUILD_TYPE:
-  BUILD_TYPE = _BUILD_TYPE
+    BUILD_TYPE = _BUILD_TYPE
 else:
-  BUILD_TYPE = 'release'
+    BUILD_TYPE = 'release'
 
 # Whether or not to wait for echoed back characters and validate those characters.
 WAIT_ECHO = True
@@ -33,6 +33,7 @@
 PLATFORM = environ['PLATFORM']
 
 CANTRIP_OUTDIR = f'{ROOTDIR}/out/cantrip/{PLATFORM}/{BUILD_TYPE}'
+CHERIOT_OUTDIR = f'{ROOTDIR}/out/cheriot/{PLATFORM}/{BUILD_TYPE}/cheriot/cheriot/{BUILD_TYPE}'
 
 SCRIPT             = f'{ROOTDIR}/sim/config/{PLATFORM}.resc'
 MATCHA_BUNDLE_PATH = f'{ROOTDIR}/out/matcha-bundle-{BUILD_TYPE}.elf'
diff --git a/variables/sencha_release.py b/variables/sencha_release.py
new file mode 100644
index 0000000..666ae19
--- /dev/null
+++ b/variables/sencha_release.py
@@ -0,0 +1,3 @@
+from common import *
+
+LOG_TIMEOUT = 20