1#!/usr/bin/env bash
2# Copyright 2023 Nordic Semiconductor
3# SPDX-License-Identifier: Apache-2.0
4
5source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh
6
7# Note:
8# Tests must be added in pairs and in sequence.
9# Tests with -flash_erase run with clear flash and start new procedure.
10# Tests with -flash_rm clean up stored settings after them
11# to run tests with -flash_erase correctly.
12# Test cases are designed to be run using single target.
13overlay=overlay_pst_conf
14RunTestFlash blob_recover_phase \
15   blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1
16
17overlay=overlay_pst_conf
18RunTestFlash blob_recover_phase \
19   blob_cli_stop blob_srv_stop -- -argstest expected-phase=2
20
21overlay=overlay_pst_conf
22RunTestFlash blob_recover_phase \
23   blob_cli_stop blob_srv_stop -- -argstest expected-phase=3
24
25overlay=overlay_pst_conf
26RunTestFlash blob_recover_phase \
27   blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
28
29# Test reaching suspended state and continuation after reboot on new procedure.
30overlay=overlay_pst_conf
31RunTestFlash blob_recover_phase \
32   blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5
33
34overlay=overlay_pst_conf
35RunTestFlash blob_recover_phase \
36   blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
37
38# The same test but with PSA crypto
39overlay="overlay_pst_conf_overlay_psa_conf"
40RunTestFlash blob_recover_phase_psa \
41   blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1
42
43overlay="overlay_pst_conf_overlay_psa_conf"
44RunTestFlash blob_recover_phase_psa \
45   blob_cli_stop blob_srv_stop -- -argstest expected-phase=2
46
47overlay="overlay_pst_conf_overlay_psa_conf"
48RunTestFlash blob_recover_phase_psa \
49   blob_cli_stop blob_srv_stop -- -argstest expected-phase=3
50
51overlay="overlay_pst_conf_overlay_psa_conf"
52RunTestFlash blob_recover_phase_psa \
53   blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
54
55# Test reaching suspended state and continuation after reboot on new procedure.
56overlay="overlay_pst_conf_overlay_psa_conf"
57RunTestFlash blob_recover_phase_psa \
58   blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5
59
60overlay="overlay_pst_conf_overlay_psa_conf"
61RunTestFlash blob_recover_phase_psa \
62   blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
63