sim:tests: add support for running sel4test or sel4test+wrapper

- parameterize shodan_sel4test.robot to use either sel4test or
  sel4test+wrapper build artifacts (default sel43est)
- add a --wrapper option to test.sh to enable sel4test+wrapper use

Note the default is sel4test because sel4test+wrapper is (temporarily)
broken.

Change-Id: I512ea1d7ef9f49aacd43e0b83c9937cbb3153876
diff --git a/shodan_sel4test.robot b/shodan_sel4test.robot
index 2bc8023..e65396e 100644
--- a/shodan_sel4test.robot
+++ b/shodan_sel4test.robot
@@ -10,6 +10,11 @@
 Resource                        ${RENODEKEYWORDS}
 
 *** Variables ***
+# Run sel4test+wrapper (sel4test + Rust syscall wrappers) instead of sel4test
+# This variable is 0 by default, use ./test.sh --wrapper to override
+${RUN_WRAPPER}                   0
+
+*** Variables ***
 ${LOG_TIMEOUT}                   2
 ${ROOTDIR}                       ${CURDIR}/../..
 ${SCRIPT}                        sim/config/shodan.resc
@@ -20,17 +25,25 @@
 ${UART5}                         sysbus.uart5
 
 ${MATCHA_BUNDLE_RELEASE}         ${ROOTDIR}/out/matcha-bundle-release.elf
-${SEL4TEST_KERNEL}               ${ROOTDIR}/out/sel4test-wrapper/riscv32-unknown-elf/debug/kernel/kernel.elf
-${SEL4TEST_ROOTSERVER}           ${ROOTDIR}/out/sel4test-wrapper/riscv32-unknown-elf/debug/apps/sel4test-driver/sel4test-driver
+${SEL4TEST_WRAPPER_KERNEL}       ${ROOTDIR}/out/sel4test-wrapper/riscv32-unknown-elf/debug/kernel/kernel.elf
+${SEL4TEST_WRAPPER_ROOTSERVER}   ${ROOTDIR}/out/sel4test-wrapper/riscv32-unknown-elf/debug/apps/sel4test-driver/sel4test-driver
+${SEL4TEST_KERNEL}               ${ROOTDIR}/out/sel4test/riscv32-unknown-elf/debug/kernel/kernel.elf
+${SEL4TEST_ROOTSERVER}           ${ROOTDIR}/out/sel4test/riscv32-unknown-elf/debug/apps/sel4test-driver/sel4test-driver
 ${OUT_TMP}                       ${ROOTDIR}/out/tmp
 
-${FLASH_TAR}                     out/sel4test-wrapper/riscv32-unknown-elf/debug/ext_flash.tar
+${FLASH_WRAPPER_TAR}             out/sel4test-wrapper/riscv32-unknown-elf/debug/ext_flash.tar
+${FLASH_TAR}                     out/sel4test/riscv32-unknown-elf/debug/ext_flash.tar
 
 *** Keywords ***
 Prepare Machine
     Execute Command             path set @${ROOTDIR}
-    Execute Command             $tar=@${FLASH_TAR}
-    Execute Command             $kernel=@${SEL4TEST_KERNEL}
+    IF      ${RUN_WRAPPER} == 1
+      Execute Command             $kernel=@${SEL4TEST_WRAPPER_KERNEL}
+      Execute Command             $tar=@${FLASH_WRAPPER_TAR}
+    ELSE
+      Execute Command             $kernel=@${SEL4TEST_KERNEL}
+      Execute Command             $tar=@${FLASH_TAR}
+    END
     Execute Command             $cpio=@/dev/null
     Execute Script              ${SCRIPT}
 # Add UART5 virtual time so we can check the machine execution time
@@ -45,9 +58,15 @@
     Run Process                 cp     -f  ${MATCHA_BUNDLE_RELEASE}       ${OUT_TMP}/matcha-tock-bundle
     Run Process                 riscv32-unknown-elf-strip  ${OUT_TMP}/matcha-tock-bundle
     Run Process                 riscv32-unknown-elf-objcopy  -O  binary  -g  ${OUT_TMP}/matcha-tock-bundle  ${OUT_TMP}/matcha-tock-bundle.bin
-    Run Process                 ln  -sfr  ${SEL4TEST_KERNEL}              ${OUT_TMP}/kernel
-    Run Process                 ln  -sfr  ${SEL4TEST_ROOTSERVER}          ${OUT_TMP}/capdl-loader
-    Run Process                 tar  -C  ${OUT_TMP}  -cvhf  ${ROOTDIR}/${FLASH_TAR}  matcha-tock-bundle.bin  kernel  capdl-loader
+    IF      ${RUN_WRAPPER} == 1
+      Run Process               ln  -sfr  ${SEL4TEST_WRAPPER_KERNEL}              ${OUT_TMP}/kernel
+      Run Process               ln  -sfr  ${SEL4TEST_WRAPPER_ROOTSERVER}          ${OUT_TMP}/capdl-loader
+      Run Process               tar  -C  ${OUT_TMP}  -cvhf  ${ROOTDIR}/${FLASH_WRAPPER_TAR}  matcha-tock-bundle.bin  kernel  capdl-loader
+    ELSE
+      Run Process               ln  -sfr  ${SEL4TEST_KERNEL}              ${OUT_TMP}/kernel
+      Run Process               ln  -sfr  ${SEL4TEST_ROOTSERVER}          ${OUT_TMP}/capdl-loader
+      Run Process               tar  -C  ${OUT_TMP}  -cvhf  ${ROOTDIR}/${FLASH_TAR}  matcha-tock-bundle.bin  kernel  capdl-loader
+    END
     Provides                    initialization
 
 Shodan seL4test with Rust syscall wrappers
diff --git a/test.sh b/test.sh
index 2ef1527..ce396ac 100755
--- a/test.sh
+++ b/test.sh
@@ -26,6 +26,14 @@
   )
 fi
 
+if [[ $1 == "--wrapper" ]]; then
+  echo "Running sel4test+wrapper artifacts"
+  shift
+  ARGS+=(
+    --variable "RUN_WRAPPER:1"
+  )
+fi
+
 ARGS+=(
     --exclude "skip_${DETECTED_OS}"
     -r "$(get_path "${TESTS_RESULTS}")"