diff --git a/tests/bsim/bluetooth/mesh/CMakeLists.txt b/tests/bsim/bluetooth/mesh/CMakeLists.txt index 749e8d7acf43f4..b1be544ed86e5e 100644 --- a/tests/bsim/bluetooth/mesh/CMakeLists.txt +++ b/tests/bsim/bluetooth/mesh/CMakeLists.txt @@ -20,7 +20,6 @@ endif() if(CONFIG_SETTINGS) target_sources(app PRIVATE - src/settings_test_backend.c src/test_persistence.c src/test_replay_cache.c src/test_provision.c diff --git a/tests/bsim/bluetooth/mesh/_mesh_test.sh b/tests/bsim/bluetooth/mesh/_mesh_test.sh index 2b2d0b4c52d49d..fa999a5ace8b8d 100755 --- a/tests/bsim/bluetooth/mesh/_mesh_test.sh +++ b/tests/bsim/bluetooth/mesh/_mesh_test.sh @@ -26,20 +26,30 @@ function RunTest(){ s_id=$1 shift 1 - testids=() - for testid in $@ ; do - if [ "$testid" == "--" ]; then + declare -A testids + testid="" + testid_in_order=() + + for arg in $@ ; do + if [ "$arg" == "--" ]; then shift 1 break fi - testids+=( $testid ) + if [[ "$arg" == "-"* ]]; then + testids["${testid}"]+="$arg " + else + testid=$arg + testid_in_order+=($testid) + testids["${testid}"]="" + fi + shift 1 done test_options=$@ - for testid in ${testids[@]} ; do + for testid in ${testid_in_order[@]}; do if Skip $testid; then echo "Skipping $testid (device #$idx)" let idx=idx+1 @@ -58,7 +68,7 @@ function RunTest(){ Execute \ ${exe_name} \ -v=${verbosity_level} -s=$s_id -d=$idx -sync_preboot -RealEncryption=1 \ - -testid=$testid ${test_options} + -testid=$testid ${testids["${testid}"]} ${test_options} let idx=idx+1 done @@ -70,3 +80,28 @@ function RunTest(){ wait_for_background_jobs } + +function RunTestFlash(){ + s_id=$1 + ext_arg="${s_id} " + idx=0 + shift 1 + + for arg in $@ ; do + if [ "$arg" == "--" ]; then + ext_arg+=$@ + break + fi + + ext_arg+="$arg " + + if [[ "$arg" != "-"* ]]; then + ext_arg+="-flash=../results/${s_id}/${s_id}_${idx}.bin " + let idx=idx+1 + fi + + shift 1 + done + + RunTest ${ext_arg} +} diff --git a/tests/bsim/bluetooth/mesh/overlay_pst.conf b/tests/bsim/bluetooth/mesh/overlay_pst.conf index a79faccee23f03..0933bdf10207ec 100644 --- a/tests/bsim/bluetooth/mesh/overlay_pst.conf +++ b/tests/bsim/bluetooth/mesh/overlay_pst.conf @@ -1,11 +1,15 @@ CONFIG_SETTINGS=y -CONFIG_SETTINGS_CUSTOM=y CONFIG_BT_SETTINGS=y -CONFIG_BT_MESH_SETTINGS_LOG_LEVEL_DBG=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_NVS=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_MESH_GATT_PROXY=y CONFIG_BT_MESH_PB_GATT=y +# Disable GATT advertising to prevent interfering with the test scenarios. +CONFIG_BT_MESH_GATT_PROXY_ENABLED=n CONFIG_BT_MESH_MODEL_GROUP_COUNT=4 CONFIG_BT_MESH_CDB_NODE_COUNT=3 diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.c b/tests/bsim/bluetooth/mesh/src/mesh_test.c index f9c1e2e58d44b5..6a0d0b4af0ac07 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.c +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.c @@ -6,7 +6,6 @@ #include "mesh_test.h" #include "argparse.h" #include -#include "settings_test_backend.h" #include "mesh/crypto.h" #define LOG_MODULE_NAME mesh_test @@ -256,7 +255,10 @@ void bt_mesh_device_setup(const struct bt_mesh_prov *prov, const struct bt_mesh_ if (IS_ENABLED(CONFIG_BT_SETTINGS)) { LOG_INF("Loading stored settings"); - settings_load(); + if (IS_ENABLED(CONFIG_BT_MESH_USES_MBEDTLS_PSA)) { + settings_load_subtree("itsemul"); + } + settings_load_subtree("bt"); } LOG_INF("Mesh initialized"); @@ -550,12 +552,3 @@ void bt_mesh_test_sar_conf_set(struct bt_mesh_sar_tx *tx_set, struct bt_mesh_sar } } #endif /* defined(CONFIG_BT_MESH_SAR_CFG) */ - -void bt_mesh_test_host_files_remove(void) -{ -#if defined(CONFIG_SETTINGS) - /* crypto library initialization to be able to remove stored keys. */ - bt_mesh_crypto_init(); - settings_test_backend_clear(); -#endif -} diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.h b/tests/bsim/bluetooth/mesh/src/mesh_test.h index d36f5cddeaffc9..8e7f41cf978e99 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.h +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.h @@ -162,6 +162,4 @@ uint16_t bt_mesh_test_own_addr_get(uint16_t start_addr); void bt_mesh_test_sar_conf_set(struct bt_mesh_sar_tx *tx_set, struct bt_mesh_sar_rx *rx_set); #endif -void bt_mesh_test_host_files_remove(void); - #endif /* ZEPHYR_TESTS_BLUETOOTH_BSIM_BT_BSIM_TEST_MESH_MESH_TEST_H_ */ diff --git a/tests/bsim/bluetooth/mesh/src/psa_its_emul.c b/tests/bsim/bluetooth/mesh/src/psa_its_emul.c index 92af388ebd4a53..0598b40a3892c9 100644 --- a/tests/bsim/bluetooth/mesh/src/psa_its_emul.c +++ b/tests/bsim/bluetooth/mesh/src/psa_its_emul.c @@ -95,7 +95,7 @@ static int itsemul_set(const char *name, size_t len_rd, settings_read_cb read_cb return 0; } -BT_MESH_SETTINGS_DEFINE(psa_its_emu, "itsemul", itsemul_set); +SETTINGS_STATIC_HANDLER_DEFINE(psa_its_emu, "itsemul", NULL, itsemul_set, NULL, NULL); psa_status_t psa_its_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { @@ -164,7 +164,7 @@ psa_status_t psa_its_set(psa_storage_uid_t uid, uint32_t data_length, const void return PSA_ERROR_STORAGE_FAILURE; } - snprintk(path, sizeof(path), "bt/mesh/itsemul/%llu", uid); + snprintk(path, sizeof(path), "itsemul/%llu", uid); p_item->uid = uid; p_pst_item = &p_item->pst_item; @@ -196,7 +196,7 @@ psa_status_t psa_its_remove(psa_storage_uid_t uid) } memset(p_item, 0, sizeof(psa_its_item_t)); - snprintk(path, sizeof(path), "bt/mesh/itsemul/%llu", uid); + snprintk(path, sizeof(path), "itsemul/%llu", uid); if (settings_delete(path)) { LOG_ERR("Failed to remove its item: %s", path); diff --git a/tests/bsim/bluetooth/mesh/src/settings_test_backend.c b/tests/bsim/bluetooth/mesh/src/settings_test_backend.c deleted file mode 100644 index 1b1e77398768e0..00000000000000 --- a/tests/bsim/bluetooth/mesh/src/settings_test_backend.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2021 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "settings_test_backend.h" - -#include -#include - -#include -#include "zephyr/types.h" -#include "errno.h" - -#include -#include "argparse.h" - -#define LOG_MODULE_NAME settings_test_backend -#include -LOG_MODULE_REGISTER(LOG_MODULE_NAME); - -#define SETTINGS_FILE setting_file -#define SETTINGS_FILE_TMP setting_file_tmp - -#define ENTRY_LEN_SIZE (4) -#define ENTRY_NAME_MAX_LEN (SETTINGS_MAX_NAME_LEN + SETTINGS_EXTRA_LEN) -#define ENTRY_VAL_MAX_LEN (SETTINGS_MAX_VAL_LEN * 2) -#define READ_LEN_MAX (ENTRY_VAL_MAX_LEN + ENTRY_NAME_MAX_LEN + 2) - -struct line_read_ctx { - int len; - const uint8_t *val; -}; - -static char setting_file[50]; -static char setting_file_tmp[sizeof(setting_file) + 1]; - -static int entry_check_and_copy(FILE *fin, FILE *fout, const char *name) -{ - char line[READ_LEN_MAX + 1]; - char name_tmp[strlen(name) + 2]; - - snprintk(name_tmp, sizeof(name_tmp), "%s=", name); - - while (fgets(line, sizeof(line), fin) == line) { - if (strstr(line, name_tmp) != NULL) { - return 0; - } - - if (fputs(line, fout) < 0) { - return -1; - } - }; - - return 0; -} - -static ssize_t settings_line_read_cb(void *cb_arg, void *data, size_t len) -{ - struct line_read_ctx *valctx = (struct line_read_ctx *)cb_arg; - - if ((valctx->len / 2) > len) { - return -ENOBUFS; - } - - uint8_t *n = (uint8_t *) data; - len = valctx->len / 2; - - for (int i = 0; i < len; i++, n++) { - if (sscanf(&valctx->val[i * 2], "%2hhx", n) != 1) { - return 0; - }; - } - - return len; -} - -static int settings_custom_load(struct settings_store *cs, const struct settings_load_arg *arg) -{ - FILE *fp = fopen(SETTINGS_FILE, "r+"); - - if (fp == NULL) { - LOG_WRN("Settings file is missing"); - return -1; - } - - if (fseek(fp, 0, SEEK_SET) < 0) { - return -1; - } - - int vallen; - char line[READ_LEN_MAX + 1]; - - while (fgets(line, sizeof(line), fp) == line) { - /* check for matching subtree */ - if (arg->subtree != NULL && !strstr(line, arg->subtree)) { - continue; - } - - char *pos = strchr(line, '='); - - if (pos <= line) { - return -1; - } - - vallen = strlen(line) - (pos - line) - 2; - LOG_INF("loading entry: %s", line); - - struct line_read_ctx valctx; - - valctx.len = vallen; - valctx.val = pos + 1; - int err = settings_call_set_handler(line, vallen / 2, settings_line_read_cb, - &valctx, arg); - - if (err < 0) { - return err; - } - }; - - return fclose(fp); -} - -/* Entries are saved to optimize readability of the settings file for test development and - * debugging purposes. Format: - * =\n - */ -static int settings_custom_save(struct settings_store *cs, const char *name, - const char *value, size_t val_len) -{ - FILE *fcur = fopen(SETTINGS_FILE, "r+"); - FILE *fnew = NULL; - - if (fcur == NULL) { - fcur = fopen(SETTINGS_FILE, "w"); - } else { - fnew = fopen(SETTINGS_FILE_TMP, "w"); - if (fnew == NULL) { - LOG_ERR("Failed to create temporary file %s", SETTINGS_FILE_TMP); - return -1; - } - } - - if (fcur == NULL) { - LOG_ERR("Failed to create settings file: %s", SETTINGS_FILE); - return -1; - } - - if (strlen(name) > ENTRY_NAME_MAX_LEN || val_len > SETTINGS_MAX_VAL_LEN) { - return -1; - } - - if (fnew != NULL) { - if (entry_check_and_copy(fcur, fnew, name) < 0) { - return -1; - } - } - - if (val_len) { - char bufvname[ENTRY_NAME_MAX_LEN + ENTRY_LEN_SIZE + 3]; - - snprintk(bufvname, sizeof(bufvname), "%s=", name); - if (fputs(bufvname, fnew != NULL ? fnew : fcur) < 0) { - return -1; - } - - char bufval[ENTRY_VAL_MAX_LEN + 2] = {}; - size_t valcnt = 0; - - while (valcnt < (val_len * 2)) { - valcnt += snprintk(&bufval[valcnt], 3, "%02x", - (uint8_t)value[valcnt / 2]); - }; - - /* helps in making settings file readable */ - bufval[valcnt++] = '\n'; - bufval[valcnt] = 0; - - if (fputs(bufval, fnew != NULL ? fnew : fcur) < 0) { - return -1; - } - } - - if (fnew != NULL) { - entry_check_and_copy(fcur, fnew, name); - } - - fclose(fcur); - - if (fnew != NULL) { - fclose(fnew); - - remove(SETTINGS_FILE); - rename(SETTINGS_FILE_TMP, SETTINGS_FILE); - } - - return 0; -} - -/* custom backend interface */ -static struct settings_store_itf settings_custom_itf = { - .csi_load = settings_custom_load, - .csi_save = settings_custom_save, -}; - -/* custom backend node */ -static struct settings_store settings_custom_store = { - .cs_itf = &settings_custom_itf -}; - -int settings_backend_init(void) -{ - snprintf(setting_file, sizeof(setting_file), "%s_%d.log", get_simid(), get_device_nbr()); - snprintf(setting_file_tmp, sizeof(setting_file_tmp), "~%s", setting_file); - - LOG_INF("file path: %s", SETTINGS_FILE); - - /* register custom backend */ - settings_dst_register(&settings_custom_store); - settings_src_register(&settings_custom_store); - return 0; -} - -void settings_test_backend_clear(void) -{ - snprintf(setting_file, sizeof(setting_file), "%s_%d.log", get_simid(), get_device_nbr()); - - if (remove(setting_file)) { - LOG_INF("error deleting file: %s", setting_file); - } -} diff --git a/tests/bsim/bluetooth/mesh/src/settings_test_backend.h b/tests/bsim/bluetooth/mesh/src/settings_test_backend.h deleted file mode 100644 index 41537dbb91d1a1..00000000000000 --- a/tests/bsim/bluetooth/mesh/src/settings_test_backend.h +++ /dev/null @@ -1,17 +0,0 @@ -/** @file - * @brief Settings test backend headers - */ - -/* - * Copyright (c) 2021 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_TESTS_BLUETOOTH_BSIM_BT_BSIM_TEST_MESH_SETTINGS_TEST_BACKEND_H_ -#define ZEPHYR_TESTS_BLUETOOTH_BSIM_BT_BSIM_TEST_MESH_SETTINGS_TEST_BACKEND_H_ - -int settings_backend_init(void); - -void settings_test_backend_clear(void); - -#endif /* ZEPHYR_TESTS_BLUETOOTH_BSIM_BT_BSIM_TEST_MESH_SETTINGS_TEST_BACKEND_H_ */ diff --git a/tests/bsim/bluetooth/mesh/src/test_blob.c b/tests/bsim/bluetooth/mesh/src/test_blob.c index 851357298a4ba0..564fb6fe8d1147 100644 --- a/tests/bsim/bluetooth/mesh/src/test_blob.c +++ b/tests/bsim/bluetooth/mesh/src/test_blob.c @@ -27,7 +27,6 @@ static enum { BLOCK_GET_FAIL = 0, XFER_GET_FAIL = 1 } msg_fail_type; -static bool recover_settings; static enum bt_mesh_blob_xfer_phase expected_stop_phase; static void test_args_parse(int argc, char *argv[]) @@ -53,14 +52,7 @@ static void test_args_parse(int argc, char *argv[]) .name = "{inactive, start, wait-block, wait-chunk, complete, suspended}", .option = "expected-phase", .descript = "Expected DFU Server phase value restored from flash" - }, - { - .dest = &recover_settings, - .type = 'b', - .name = "{0, 1}", - .option = "recover", - .descript = "Recover settings from persistent storage" - }, + } }; bs_args_parse_all_cmd_line(argc, argv, args_struct); @@ -1452,10 +1444,6 @@ static void test_cli_stop(void) { int err; - if (!recover_settings) { - bt_mesh_test_host_files_remove(); - } - bt_mesh_test_cfg_set(NULL, 1000); k_sem_init(&blob_caps_sem, 0, 1); k_sem_init(&lost_target_sem, 0, 1); @@ -1551,10 +1539,6 @@ static void srv_check_reboot_and_continue(void) static void test_srv_stop(void) { - if (!recover_settings) { - bt_mesh_test_host_files_remove(); - } - bt_mesh_test_cfg_set(NULL, 1000); k_sem_init(&blob_srv_end_sem, 0, 1); k_sem_init(&first_block_wr_sem, 0, 1); diff --git a/tests/bsim/bluetooth/mesh/src/test_dfu.c b/tests/bsim/bluetooth/mesh/src/test_dfu.c index b2824f54b46d28..f7c4ca6f4f0bf4 100644 --- a/tests/bsim/bluetooth/mesh/src/test_dfu.c +++ b/tests/bsim/bluetooth/mesh/src/test_dfu.c @@ -416,7 +416,6 @@ static void dist_self_update_prov_and_conf(uint16_t addr) static void target_prov_and_conf(uint16_t addr, struct bind_params *params, size_t len) { - bt_mesh_test_host_files_remove(); provision(addr); common_configure(addr); @@ -518,7 +517,6 @@ static void test_dist_dfu(void) { enum bt_mesh_dfd_status status; - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &dist_comp); dist_prov_and_conf(DIST_ADDR); @@ -543,7 +541,6 @@ static void test_dist_dfu_self_update(void) ASSERT_TRUE(dfu_targets_cnt > 0); - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &dist_comp_self_update); dist_self_update_prov_and_conf(DIST_ADDR); @@ -583,13 +580,11 @@ static void test_dist_dfu_slot_create(void) ASSERT_TRUE(CONFIG_BT_MESH_DFU_SLOT_CNT >= 3, "CONFIG_BT_MESH_DFU_SLOT_CNT must be at least 3"); - bt_mesh_test_host_files_remove(); - bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &dist_comp); dist_prov_and_conf(DIST_ADDR); - for (i = 0; i < CONFIG_BT_MESH_DFU_SLOT_CNT; i++) { + for (i = CONFIG_BT_MESH_DFU_SLOT_CNT - 1; i >= 0; i--) { fwid[0] = i; metadata[0] = i; slot[i] = bt_mesh_dfu_slot_add(size, fwid, fwid_len, metadata, metadata_len, uri, @@ -751,7 +746,6 @@ static void target_test_effect(enum bt_mesh_dfu_effect effect) { dfu_target_effect = effect; - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &target_comp); target_prov_and_conf_default(); @@ -913,7 +907,6 @@ static void cli_common_fail_on_init(void) { const struct bt_mesh_dfu_slot *slot; - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, 300); bt_mesh_device_setup(&prov, &cli_comp); dist_prov_and_conf(DIST_ADDR); @@ -1406,7 +1399,6 @@ static void target_prov_and_conf_with_imposer(void) static void common_fail_on_target_init(const struct bt_mesh_comp *comp) { - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, 300); bt_mesh_device_setup(&prov, comp); @@ -1506,7 +1498,6 @@ static void test_target_dfu_stop(void) dfu_target_effect = BT_MESH_DFU_EFFECT_NONE; if (!recover) { - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); common_fail_on_target_init(expected_stop_phase == BT_MESH_DFU_PHASE_VERIFY_FAIL ? diff --git a/tests/bsim/bluetooth/mesh/src/test_persistence.c b/tests/bsim/bluetooth/mesh/src/test_persistence.c index e5391d1c770b09..6c51092233051f 100644 --- a/tests/bsim/bluetooth/mesh/src/test_persistence.c +++ b/tests/bsim/bluetooth/mesh/src/test_persistence.c @@ -224,8 +224,6 @@ static const struct stack_cfg { }; static const struct stack_cfg *current_stack_cfg; -static bool clear_settings; - static void test_args_parse(int argc, char *argv[]) { char *access_cfg_str = NULL; @@ -245,14 +243,7 @@ static void test_args_parse(int argc, char *argv[]) .name = "{0, 1}", .option = "stack-cfg", .descript = "" - }, - { - .dest = &clear_settings, - .type = 'b', - .name = "{0, 1}", - .option = "clear-settings", - .descript = "", - }, + } }; bs_args_parse_all_cmd_line(argc, argv, args_struct); @@ -445,7 +436,6 @@ static void provisioner_setup(void) static void test_provisioning_data_save(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); if (device_setup_and_self_provision()) { @@ -636,7 +626,6 @@ static void node_configure(void) static void test_access_data_save(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); if (device_setup_and_self_provision()) { @@ -876,7 +865,6 @@ static void test_cfg_save(void) ASSERT_TRUE(current_stack_cfg != NULL); - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); if (device_setup_and_self_provision()) { @@ -992,10 +980,6 @@ static int mesh_settings_load_cb(const char *key, size_t len, settings_read_cb r */ static void test_reprovisioning_device(void) { - if (clear_settings) { - bt_mesh_test_host_files_remove(); - } - bt_mesh_test_cfg_set(NULL, WAIT_TIME); device_setup(); @@ -1027,7 +1011,6 @@ static void test_reprovisioning_provisioner(void) int err; bool status; - bt_mesh_test_host_files_remove(); bt_mesh_test_cfg_set(NULL, WAIT_TIME); provisioner_setup(); diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index ad74082fc60f3c..dd78248dd05355 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -1182,8 +1182,6 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) */ static void test_device_pb_remote_server_unproved(void) { - bt_mesh_test_host_files_remove(); - device_pb_remote_server_setup_unproved(&rpr_srv_comp); PASS(); @@ -1195,7 +1193,6 @@ static void test_device_pb_remote_server_unproved(void) */ static void test_device_pb_remote_server_unproved_unresponsive(void) { - bt_mesh_test_host_files_remove(); device_pb_remote_server_setup_unproved(&rpr_srv_comp_unresponsive); k_sem_init(&pdu_send_sem, 0, 1); @@ -1306,7 +1303,6 @@ static void test_provisioner_pb_remote_client_ncrp_provision(void) uint16_t pb_remote_server_addr; uint8_t status; - bt_mesh_test_host_files_remove(); provisioner_pb_remote_client_setup(); /* Provision the 2nd device over PB-Adv. */ @@ -1433,7 +1429,6 @@ static void test_provisioner_pb_remote_client_ncrp_second_time(void) */ static void test_device_pb_remote_server_ncrp_prepare(void) { - bt_mesh_test_host_files_remove(); device_pb_remote_server_setup_unproved(&rpr_srv_comp); LOG_INF("Preparing for Composition Data change"); diff --git a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c index 6af09ee52a9a71..dbab05661cb87c 100644 --- a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c +++ b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c @@ -124,7 +124,6 @@ static void rx_sar_conf(void) static void test_tx_immediate_replay_attack(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_setup(); tx_sar_conf(); @@ -173,7 +172,6 @@ static void test_tx_immediate_replay_attack(void) static void test_rx_immediate_replay_attack(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_setup(); rx_sar_conf(); bt_mesh_test_ra_cb_setup(rx_ended); @@ -187,7 +185,6 @@ static void test_rx_immediate_replay_attack(void) static void test_tx_power_replay_attack(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_setup(); tx_sar_conf(); @@ -253,7 +250,7 @@ static void send_end_cb(int err, void *cb_data) static bool msg_send(uint16_t src, uint16_t dst) { - struct bt_mesh_send_cb cb = { + static struct bt_mesh_send_cb cb = { .end = send_end_cb, }; struct bt_mesh_msg_ctx ctx = { @@ -318,9 +315,11 @@ static bool ivi_update_toggle(void) return res; } +/* 1 second delays have been added to prevent interfering tail of + * the previous rx transaction with the beginning of the new tx transaction. + */ static void test_rx_rpl_frag(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_setup(); k_sleep(K_SECONDS(10)); @@ -330,6 +329,8 @@ static void test_rx_rpl_frag(void) ASSERT_TRUE(msg_recv(100 + i)); } + k_sleep(K_SECONDS(1)); + /* Ask tx node to proceed to next test step. */ ASSERT_TRUE(msg_send(rx_cfg.addr, tx_cfg.addr)); @@ -342,6 +343,8 @@ static void test_rx_rpl_frag(void) ASSERT_TRUE(msg_recv(100)); ASSERT_TRUE(msg_recv(102)); + k_sleep(K_SECONDS(1)); + /* Ask tx node to proceed to next test step. */ ASSERT_TRUE(msg_send(rx_cfg.addr, tx_cfg.addr)); @@ -352,6 +355,8 @@ static void test_rx_rpl_frag(void) ASSERT_TRUE(msg_recv(100)); ASSERT_TRUE(msg_recv(102)); + k_sleep(K_SECONDS(1)); + /* Start IVI Update again. */ /* RPL entry with odd address should be removed causing fragmentation in RPL. old_iv flag * for even entries will be set to 1. @@ -384,9 +389,11 @@ static void test_rx_rpl_frag(void) PASS(); } +/* 1 second delays have been added to prevent interfering tail of + * the previous rx transaction with the beginning of the new tx transaction. + */ static void test_tx_rpl_frag(void) { - bt_mesh_test_host_files_remove(); bt_mesh_test_setup(); k_sleep(K_SECONDS(10)); @@ -396,11 +403,11 @@ static void test_tx_rpl_frag(void) ASSERT_TRUE(msg_send(100 + i, rx_cfg.addr)); } - k_sleep(K_SECONDS(3)); - /* Wait for the rx node. */ ASSERT_TRUE(msg_recv(rx_cfg.addr)); + k_sleep(K_SECONDS(1)); + /* Start IVI Update. */ ASSERT_TRUE(ivi_update_toggle()); @@ -411,6 +418,8 @@ static void test_tx_rpl_frag(void) /* Wait for the rx node. */ ASSERT_TRUE(msg_recv(rx_cfg.addr)); + k_sleep(K_SECONDS(1)); + /* Complete IVI Update. */ ASSERT_FALSE(ivi_update_toggle()); diff --git a/tests/bsim/bluetooth/mesh/src/test_sar.c b/tests/bsim/bluetooth/mesh/src/test_sar.c index 5d23233efa2c69..a928d973a25339 100644 --- a/tests/bsim/bluetooth/mesh/src/test_sar.c +++ b/tests/bsim/bluetooth/mesh/src/test_sar.c @@ -258,8 +258,6 @@ static void test_srv_cfg_store(void) struct bt_mesh_sar_rx rx_cfg; struct bt_mesh_sar_tx tx_cfg; - bt_mesh_test_host_files_remove(); - bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &comp); prov_and_conf(SRV_ADDR, &test_sar_rx, &test_sar_tx); diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh index 241a6bd2d105c4..8c59c82da6feef 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh @@ -6,68 +6,69 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Note: # Tests must be added in pairs and in sequence. -# Tests with recover set to 0 clear previous settings and start new procedure. -# Tests with recover set to 1 load stored settings and continue procedure to next phase. +# Tests with -flash_erase run with clear flash and start new procedure. +# Tests with -flash_rm clean up stored settings after them +# to run tests with -flash_erase correctly. # Test cases are designed to be run using single target. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=0 expected-phase=1 +RunTestFlash blob_recover_phase \ + blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=2 +RunTestFlash blob_recover_phase \ + blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=3 +RunTestFlash blob_recover_phase \ + blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash blob_recover_phase \ + blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=0 expected-phase=5 +RunTestFlash blob_recover_phase \ + blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest blob_recover_phase blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash blob_recover_phase \ + blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # The same test but with PSA crypto conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=0 expected-phase=1 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=2 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=3 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=0 expected-phase=5 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest blob_recover_phase_psa blob_cli_stop blob_srv_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash blob_recover_phase_psa \ + blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh index 63beed915e6274..c187d8cfbffcf2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh @@ -13,20 +13,20 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # from storage. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_slot dfu_dist_dfu_slot_create +RunTestFlash dfu_slot dfu_dist_dfu_slot_create -flash_erase -RunTest dfu_slot dfu_dist_dfu_slot_create_recover +RunTestFlash dfu_slot dfu_dist_dfu_slot_create_recover -RunTest dfu_slot dfu_dist_dfu_slot_delete_all +RunTestFlash dfu_slot dfu_dist_dfu_slot_delete_all -RunTest dfu_slot dfu_dist_dfu_slot_check_delete_all +RunTestFlash dfu_slot dfu_dist_dfu_slot_check_delete_all -flash_rm conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_slot_psa dfu_dist_dfu_slot_create +RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_create -flash_erase -RunTest dfu_slot_psa dfu_dist_dfu_slot_create_recover +RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_create_recover -RunTest dfu_slot_psa dfu_dist_dfu_slot_delete_all +RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_delete_all -RunTest dfu_slot_psa dfu_dist_dfu_slot_check_delete_all +RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_check_delete_all -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh index 119261ce1c52b7..6ed7099c987048 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh @@ -15,77 +15,91 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # plays dummy role, and is there to keep order of settings files being loaded. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=0 expected-phase=2 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ + -- -argstest recover=0 expected-phase=2 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=3 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=3 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=4 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=6 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=8 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ + -- -argstest recover=1 expected-phase=8 # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=0 expected-phase=5 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ + -- -argstest recover=0 expected-phase=5 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest dfu_dist_recover_phase dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=6 +RunTestFlash dfu_dist_recover_phase \ + dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ + -- -argstest recover=1 expected-phase=6 # The same test but with PSA crypto conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=0 expected-phase=2 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ + -- -argstest recover=0 expected-phase=2 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=3 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=3 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=4 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=4 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=6 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop dfu_target_dfu_stop \ + -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=8 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ + -- -argstest recover=1 expected-phase=8 # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=0 expected-phase=5 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ + -- -argstest recover=0 expected-phase=5 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest dfu_dist_recover_phase_psa dfu_cli_stop dfu_target_dfu_stop -- -argstest \ - recover=1 expected-phase=6 +RunTestFlash dfu_dist_recover_phase_psa \ + dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ + -- -argstest recover=1 expected-phase=6 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh index 54c115c0673e9f..0392430adbae16 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh @@ -9,82 +9,82 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # First test: saves data; second test: verifies it. overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_data_save +RunTestFlash mesh_pst_access_data_check persistence_access_data_save -flash_erase overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_data_load --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check persistence_access_data_load \ + -- -argstest access-cfg=configured overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_sub_overwrite --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check persistence_access_sub_overwrite \ + -- -argstest access-cfg=configured overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_data_load --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check persistence_access_data_load \ + -- -argstest access-cfg=new-subs overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_data_remove --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check persistence_access_data_remove \ + -- -argstest access-cfg=new-subs overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check persistence_access_data_load --\ - -argstest access-cfg=not-configured +RunTestFlash mesh_pst_access_data_check persistence_access_data_load -flash_rm \ + -- -argstest access-cfg=not-configured conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_data_save +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_save -flash_erase conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_data_load --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ + -- -argstest access-cfg=configured conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_sub_overwrite --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_sub_overwrite \ + -- -argstest access-cfg=configured conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_data_load --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ + -- -argstest access-cfg=new-subs conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_data_remove --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_remove \ + -- -argstest access-cfg=new-subs conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_access_data_check_1d1 persistence_access_data_load --\ - -argstest access-cfg=not-configured +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load -flash_rm \ + -- -argstest access-cfg=not-configured conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_data_save +RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_save -flash_erase conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_data_load --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ + -- -argstest access-cfg=configured conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_sub_overwrite --\ - -argstest access-cfg=configured +RunTestFlash mesh_pst_access_data_check_psa persistence_access_sub_overwrite \ + -- -argstest access-cfg=configured conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_data_load --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ + -- -argstest access-cfg=new-subs conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_data_remove --\ - -argstest access-cfg=new-subs +RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_remove \ + -- -argstest access-cfg=new-subs conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_access_data_check_psa persistence_access_data_load --\ - -argstest access-cfg=not-configured +RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load -flash_rm \ + -- -argstest access-cfg=not-configured diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh index 4368700d5b9c8c..bb3074905a98f3 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh @@ -9,45 +9,57 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # First test: saves data; second test: verifies it. overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check persistence_cfg_save -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=0 overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check persistence_cfg_load -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=0 overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check persistence_cfg_save -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=1 overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check persistence_cfg_load -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=1 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check_1d1 persistence_cfg_save -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=0 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check_1d1 persistence_cfg_load -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=0 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check_1d1 persistence_cfg_save -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=1 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_cfg_check_1d1 persistence_cfg_load -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=1 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_cfg_check_psa persistence_cfg_save -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=0 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_cfg_check_psa persistence_cfg_load -- -argstest stack-cfg=0 +RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=0 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_cfg_check_psa persistence_cfg_save -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=1 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_cfg_check_psa persistence_cfg_load -- -argstest stack-cfg=1 +RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh index 277adff0b55ab1..f1e0591ef133e2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh @@ -10,24 +10,24 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # SKIP=(persistence_provisioning_data_save) overlay=overlay_pst_conf -RunTest mesh_pst_prov_data_check persistence_provisioning_data_save +RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_save -flash_erase # SKIP=(persistence_provisioning_data_load) overlay=overlay_pst_conf -RunTest mesh_pst_prov_data_check persistence_provisioning_data_load +RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_load -flash_rm conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_prov_data_check_1d1 persistence_provisioning_data_save +RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_save -flash_erase conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_pst_prov_data_check_1d1 persistence_provisioning_data_load +RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_load -flash_rm conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_prov_data_check_psa persistence_provisioning_data_save +RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_save -flash_erase conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_pst_prov_data_check_psa persistence_provisioning_data_load +RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_load -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh index 3ecf7e90fe5a2b..922b4c8a513830 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh @@ -11,29 +11,35 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Provision, configure and reset a device overlay=overlay_pst_conf RunTest mesh_pst_repr persistence_reprovisioning_device \ - persistence_reprovisioning_provisioner -- -argstest clear-settings=1 + -flash=../results/mesh_pst_repr/flash.bin -flash_erase \ + persistence_reprovisioning_provisioner # Repeat the test overlay=overlay_pst_conf RunTest mesh_pst_repr persistence_reprovisioning_device \ + -flash=../results/mesh_pst_repr/flash.bin -flash_rm \ persistence_reprovisioning_provisioner conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ - persistence_reprovisioning_provisioner -- -argstest clear-settings=1 + -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_erase \ + persistence_reprovisioning_provisioner conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ + -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_rm \ persistence_reprovisioning_provisioner conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ - persistence_reprovisioning_provisioner -- -argstest clear-settings=1 + -flash=../results/mesh_pst_repr_psa/flash.bin -flash_erase \ + persistence_reprovisioning_provisioner conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ + -flash=../results/mesh_pst_repr_psa/flash.bin -flash_rm \ persistence_reprovisioning_provisioner diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh index f8669cbc43c4b9..4329d25a823851 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh @@ -31,15 +31,15 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Step 1 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_prov_pst_pb_remote_ncrp \ - prov_provisioner_pb_remote_client_ncrp_provision \ - prov_device_pb_remote_server_unproved \ - prov_device_pb_remote_server_ncrp_prepare +RunTestFlash mesh_prov_pst_pb_remote_ncrp \ + prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ + prov_device_pb_remote_server_unproved -flash_erase \ + prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_prov_pst_pb_remote_ncrp \ +RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp \ prov_device_pb_remote_server_proved \ prov_device_pb_remote_server_ncrp @@ -47,24 +47,24 @@ RunTest mesh_prov_pst_pb_remote_ncrp \ # Step 3 conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_prov_pst_pb_remote_ncrp \ - prov_provisioner_pb_remote_client_ncrp_second_time \ - prov_device_pb_remote_server_proved \ - prov_device_pb_remote_server_ncrp_second_time +RunTestFlash mesh_prov_pst_pb_remote_ncrp \ + prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ + prov_device_pb_remote_server_proved -flash_rm \ + prov_device_pb_remote_server_ncrp_second_time -flash_rm # The same test but with PSA crypto # Step 1 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_prov_pst_pb_remote_ncrp_psa \ - prov_provisioner_pb_remote_client_ncrp_provision \ - prov_device_pb_remote_server_unproved \ - prov_device_pb_remote_server_ncrp_prepare +RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ + prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ + prov_device_pb_remote_server_unproved -flash_erase \ + prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_prov_pst_pb_remote_ncrp_psa \ +RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp \ prov_device_pb_remote_server_proved \ prov_device_pb_remote_server_ncrp @@ -72,7 +72,7 @@ RunTest mesh_prov_pst_pb_remote_ncrp_psa \ # Step 3 conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_prov_pst_pb_remote_ncrp_psa \ - prov_provisioner_pb_remote_client_ncrp_second_time \ - prov_device_pb_remote_server_proved \ - prov_device_pb_remote_server_ncrp_second_time +RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ + prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ + prov_device_pb_remote_server_proved -flash_rm \ + prov_device_pb_remote_server_ncrp_second_time -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh index 190e9e422b9c5c..50387776dfb3ba 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh @@ -6,34 +6,34 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_pst_conf RunTest mesh_replay_attack \ - rpc_tx_immediate_replay_attack \ - rpc_rx_immediate_replay_attack + rpc_tx_immediate_replay_attack \ + rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack/flash.bin -flash_erase overlay=overlay_pst_conf RunTest mesh_replay_attack \ - rpc_tx_power_replay_attack \ - rpc_rx_power_replay_attack + rpc_tx_power_replay_attack \ + rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack/flash.bin -flash_rm conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_replay_attack_1d1 \ - rpc_tx_immediate_replay_attack \ - rpc_rx_immediate_replay_attack + rpc_tx_immediate_replay_attack \ + rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_erase conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_replay_attack_1d1 \ - rpc_tx_power_replay_attack \ - rpc_rx_power_replay_attack + rpc_tx_power_replay_attack \ + rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_rm conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ - rpc_tx_immediate_replay_attack \ - rpc_rx_immediate_replay_attack + rpc_tx_immediate_replay_attack \ + rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_psa/flash.bin -flash_erase conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ - rpc_tx_power_replay_attack \ - rpc_rx_power_replay_attack + rpc_tx_power_replay_attack \ + rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack_psa/flash.bin -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh index 95731027607651..8c7a7866eb32e0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh @@ -12,24 +12,33 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. Complete IVI Update; # 5. Repeate steps 2 - 4 to remove RPL entry with odd address from RPL and cause fragmentation; overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation rpc_rx_rpl_frag rpc_tx_rpl_frag +RunTest mesh_replay_fragmentation \ + rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation/flash.bin -flash_erase \ + rpc_tx_rpl_frag # Simulate reboot and test that RPL entries are restored correctly after defragmentation overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation rpc_rx_reboot_after_defrag +RunTest mesh_replay_fragmentation \ + rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation/flash.bin -flash_rm conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation_1d1 rpc_rx_rpl_frag rpc_tx_rpl_frag +RunTest mesh_replay_fragmentation_1d1 \ + rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_erase \ + rpc_tx_rpl_frag conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation_1d1 rpc_rx_reboot_after_defrag +RunTest mesh_replay_fragmentation_1d1 \ + rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_rm conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_replay_fragmentation_psa rpc_rx_rpl_frag rpc_tx_rpl_frag +RunTest mesh_replay_fragmentation_psa \ + rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_erase \ + rpc_tx_rpl_frag conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest mesh_replay_fragmentation_psa rpc_rx_reboot_after_defrag +RunTest mesh_replay_fragmentation_psa \ + rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh index dbe8685d3707aa..dc27c4dcedafdb 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh @@ -10,10 +10,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Second test restores it from flash and checks if configuration persisted. conf=prj_mesh1d1_conf overlay=overlay_pst_conf -RunTest sar_persistence sar_srv_cfg_store -RunTest sar_persistence sar_srv_cfg_restore +RunTestFlash sar_persistence sar_srv_cfg_store -flash_erase +RunTestFlash sar_persistence sar_srv_cfg_restore -flash_rm conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" -RunTest sar_persistence_psa sar_srv_cfg_store -RunTest sar_persistence_psa sar_srv_cfg_restore +RunTestFlash sar_persistence_psa sar_srv_cfg_store -flash_erase +RunTestFlash sar_persistence_psa sar_srv_cfg_restore -flash_rm