@@ -16,6 +16,27 @@ TT_Z_P_ROOT=$(realpath $(dirname $(realpath $0))/../..)
1616# Prefer Zephyr base from environment, otherwise use the one in this repo
1717ZEPHYR_BASE=${ZEPHYR_BASE:- $(realpath $TT_Z_P_ROOT / ../ zephyr)}
1818
19+ run_twister_test () {
20+ # Set tag and outdir suffix args and remove from argument list
21+ local tag=$1
22+ local outdir_suffix=$2
23+ shift 2
24+
25+ # Common Twister execution
26+ $ZEPHYR_BASE /scripts/twister -i -p $SMC_BOARD \
27+ --tag " $tag " -T " $TT_Z_P_ROOT /app" \
28+ --west-flash=" --force,--allow-major-downgrades" \
29+ --west-runner tt_flash \
30+ --device-testing -c \
31+ --device-flash-timeout 240 \
32+ --device-serial-pty " $TT_Z_P_ROOT /scripts/smc_console.py -d $CONSOLE_DEV -p" \
33+ --failure-script " $TT_Z_P_ROOT /scripts/smc_test_recovery.py --asic-id $ASIC_ID " \
34+ --flash-before \
35+ --outdir " $ZEPHYR_BASE /twister-$outdir_suffix " \
36+ --extra-args=SB_CONFIG_BOOT_SIGNATURE_KEY_FILE=\" $KEYFILE \" \
37+ " $@ "
38+ }
39+
1940function print_help {
2041 echo -n " Usage: $0 [-p <pcie_index>] [-t test_set] [-k <keyfile>] "
2142 echo " <board_name> -- [additional twister args]"
@@ -55,7 +76,7 @@ export CONSOLE_DEV
5576export BOARD
5677
5778if [ -z " $TEST_SET " ]; then
58- TEST_SET=" :e2e-flash"
79+ TEST_SET=" :e2e-flash:recovery-flash "
5980fi
6081
6182if [ -z " $KEYFILE " ]; then
@@ -83,18 +104,8 @@ make -C $TT_Z_P_ROOT/scripts/tooling -j$(nproc)
83104
84105if [[ " $TEST_SET " == * " e2e-flash" * ]]; then
85106 # Run a full flash test, using tt-flash as the runner
86- $ZEPHYR_BASE /scripts/twister -i -p $SMC_BOARD \
87- --tag e2e-flash -T $TT_Z_P_ROOT /app \
88- --west-flash=" --force,--allow-major-downgrades" \
89- --west-runner tt_flash \
90- --device-testing -c \
91- --device-flash-timeout 240 \
92- --device-serial-pty " $TT_Z_P_ROOT /scripts/smc_console.py -d $CONSOLE_DEV -p" \
93- --failure-script " $TT_Z_P_ROOT /scripts/smc_test_recovery.py --asic-id $ASIC_ID " \
94- --flash-before \
95- --outdir $ZEPHYR_BASE /twister-e2e-flash \
96- --extra-args=SB_CONFIG_BOOT_SIGNATURE_KEY_FILE=\" $KEYFILE \" \
97- $@
107+ run_twister_test " e2e-flash" " e2e-flash" " $@ "
108+
98109 # Restore a stable DMFW, since the copy flashed by BL2 tests will
99110 # leave the DMC flash in a different state than other tests expect
100111 # We erase the DMC flash first to ensure no old image fragments remain
@@ -105,3 +116,8 @@ if [[ "$TEST_SET" == *"e2e-flash"* ]]; then
105116 west flash -d $ZEPHYR_BASE /build-dmc --domain dmc
106117 rm -rf $ZEPHYR_BASE /build-dmc
107118fi
119+
120+ if [[ " $TEST_SET " == * " recovery-flash" * ]]; then
121+ # Run a recovery flash test
122+ run_twister_test " recovery" " recovery-flash" " $@ "
123+ fi
0 commit comments