From 96bb139751d6ccb0be43c1fc9943eb23ea0f8301 Mon Sep 17 00:00:00 2001 From: ismail Date: Tue, 19 Aug 2025 17:40:26 +0300 Subject: [PATCH] Add new utility script and update test tags - Added new utility script run_tests_all_cfgs.sh to run tests for all configurations and with test tag support. - Updated run_tests.sh to add the new test tag for NVS unit tests. --- scripts/run_tests.sh | 4 ++-- scripts/run_tests_all_cfgs.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 scripts/run_tests_all_cfgs.sh diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index cc39ffb..5c4d82e 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -10,7 +10,7 @@ if [[ -z "$IDF_PATH" ]]; then fi # ==== 2. Valid Modes and Defaults ==== -valid_test_tags=("core" "tilt" "listener" "all" "relay_chn") +valid_test_tags=("core" "tilt" "listener" "all" "relay_chn" "nvs") arg_tag="all" # Default to 'all' if no tag specified arg_clean=false arg_log=false @@ -24,7 +24,7 @@ print_help() { echo "This script builds and runs tests for the relay_chn component using QEMU." echo "" echo "Arguments:" - echo " -t, --tag [relay_chn|core|tilt|listener|all] Specify which test tag to run." + echo " -t, --tag [relay_chn|core|tilt|listener|nvs|all] Specify which test tag to run." echo "" echo " If no tag is specified, it defaults to 'all'." echo "" diff --git a/scripts/run_tests_all_cfgs.sh b/scripts/run_tests_all_cfgs.sh new file mode 100755 index 0000000..7703627 --- /dev/null +++ b/scripts/run_tests_all_cfgs.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -e + +# Check tag argument +arg_tag=$1 +if [[ -z "$arg_tag" ]]; then + arg_tag="all" +fi + +# Resolve Paths and Switch to Working Directory +script_dir=$(dirname "$(readlink -f "$0")") +project_root=$(dirname "$script_dir") + +echo "Script dir: ${script_dir}" +echo "Project root: ${project_root}" + +echo "🔍 Searching for 'test_apps' directory in '$project_root'..." +test_apps_dir=$(find "$project_root" -type d -name "test_apps" | head -n 1) +echo "test_apps dir: ${test_apps_dir}" + +# Execute tests for all configs +mapfile -t sdkcfg_files < <(find "$test_apps_dir" -maxdepth 1 -type f -name "sdkconfig.defaults*") + +for sdkcfg_file in "${sdkcfg_files[@]}"; do + echo "🔧 Running tests with config: $sdkcfg_file" + "${script_dir}"/run_tests.sh -c -f "$sdkcfg_file" -t "$arg_tag" || { + echo "❌ Tests failed with config: $sdkcfg_file" + exit 1 + } +done