diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 5cd050e..46e946f 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -11,12 +11,12 @@ fi # ==== 2. Valid Modes and Defaults ==== valid_test_tags=("core" "tilt" "listener" "all" "relay_chn" "nvs" "run_limit" "batch") +valid_test_profiles=("run_limit" "tilt" "nvs" "nvs_custom" "multi" "full_single" "full_multi") arg_tag="all" # Default to 'all' if no tag specified +arg_profile="full_multi" # Default to 'full_multi' if no profile specified arg_clean=false arg_log=false arg_dry_run=false -arg_sdkconfig_file="" -flag_file=false print_help() { echo "Usage: $0 -t [OPTIONS]" @@ -28,6 +28,10 @@ print_help() { echo "" echo " If no tag is specified, it defaults to 'all'." echo "" + echo " -p, --profile [run_limit|tilt|nvs|nvs_custom|multi|full_single|full_multi] Specify which test tag to run." + echo "" + echo " If no profile is specified, it defaults to 'full_multi'." + echo "" echo "Options:" echo " -f, --file Specify a custom sdkconfig file to use for the build." echo " Defaults to 'sdkconfig.defaults' if not provided." @@ -54,9 +58,8 @@ while [[ $# -gt 0 ]]; do arg_tag="$2" shift 2 ;; - --file|-f) - arg_sdkconfig_file="$2" - flag_file=true + --profile|-p) + arg_profile="$2" shift 2 ;; --clean|-c) @@ -86,6 +89,11 @@ if [[ ! " ${valid_test_tags[*]} " =~ " $arg_tag " ]]; then usage fi +if [[ ! " ${valid_test_profiles[*]} " =~ " $arg_profile " ]]; then + echo "❌ Invalid profile: '$arg_profile'" + usage +fi + # ==== 5. Resolve Paths and Switch to Working Directory ==== script_dir=$(dirname "$(readlink -f "$0")") project_root=$(dirname "$script_dir") @@ -98,21 +106,9 @@ if [[ -z "$test_apps_dir" || ! -d "$test_apps_dir" ]]; then echo " Please ensure the script is in a 'scripts' directory and 'test_apps' is a sibling." exit 1 fi + echo "✅ Found 'test_apps' at: $test_apps_dir" - -if $flag_file; then - if [[ -z "$arg_sdkconfig_file" || ! -f "$arg_sdkconfig_file" ]]; then - echo "❌ Invalid or missing file: '$arg_sdkconfig_file'" - usage - fi - # Resolve to an absolute path to work correctly after changing directory - arg_sdkconfig_file=$(readlink -f "$arg_sdkconfig_file") -else - echo "⚠️ No SDK configuration file provided. Using default sdkconfig." - arg_sdkconfig_file="$test_apps_dir/sdkconfig.defaults" -fi - -echo "🧪 Test mode: $arg_tag" +echo "🧪 Test mode: $arg_tag | Profile: $arg_profile" echo "🧹 Clean: $arg_clean | 📄 Log: $arg_log" echo "📂 Changing to working directory: $test_apps_dir" @@ -129,15 +125,14 @@ fi # In some locales, we can get errors like: "Error: unknown opcode or format name 'wsr.IBREAKA1'" # The 'LC_ALL=C' env variable is set to ensure consistent locale settings. LC_ALL=C \ -SDKCONFIG_DEFAULTS="$arg_sdkconfig_file" \ RELAY_CHN_UNITY_TEST_GROUP_TAG="$arg_tag" \ -idf.py reconfigure build +idf.py @profiles/"${arg_profile}" reconfigure build echo "🚀 Running test with QEMU..." if $arg_log; then TIMESTAMP=$(date +"%Y%m%d_%H%M%S") - LOGFILE="test_log_${arg_tag}_$TIMESTAMP.txt" + LOGFILE="test_log_${arg_profile}_${arg_tag}_$TIMESTAMP.txt" if $arg_dry_run; then echo "🔍 Dry run mode: Logging to $LOGFILE but not executing." | tee "$LOGFILE" echo "Command: idf.py qemu" | tee "$LOGFILE" diff --git a/scripts/run_tests_all_cfgs.sh b/scripts/run_tests_all_profiles.sh similarity index 56% rename from scripts/run_tests_all_cfgs.sh rename to scripts/run_tests_all_profiles.sh index 7703627..4a04ab4 100755 --- a/scripts/run_tests_all_cfgs.sh +++ b/scripts/run_tests_all_profiles.sh @@ -18,13 +18,16 @@ 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*") +# Execute tests for all profiles +mapfile -t profiles < <(find "${test_apps_dir}/profiles" -maxdepth 1 -type f) -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" +for profile in "${profiles[@]}"; do + # Get only the name of the profile file + profile=$(basename "${profile}") + + echo "🔧 Running tests with profile: $profile" + "${script_dir}"/run_tests.sh -c -p "$profile" -t "$arg_tag" || { + echo "❌ Tests failed with profile: $profile" exit 1 } done diff --git a/test_apps/profiles/full_multi b/test_apps/profiles/full_multi new file mode 100644 index 0000000..809d252 --- /dev/null +++ b/test_apps/profiles/full_multi @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.multi;sdkconfig.defaults.run_limit;sdkconfig.defaults.tilt;sdkconfig.defaults.nvs;sdkconfig.defaults.nvs_custom" \ No newline at end of file diff --git a/test_apps/profiles/full_single b/test_apps/profiles/full_single new file mode 100644 index 0000000..2404204 --- /dev/null +++ b/test_apps/profiles/full_single @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.run_limit;sdkconfig.defaults.tilt;sdkconfig.defaults.nvs;sdkconfig.defaults.nvs_custom" \ No newline at end of file diff --git a/test_apps/profiles/multi b/test_apps/profiles/multi new file mode 100644 index 0000000..4f755f0 --- /dev/null +++ b/test_apps/profiles/multi @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.multi" \ No newline at end of file diff --git a/test_apps/profiles/nvs b/test_apps/profiles/nvs new file mode 100644 index 0000000..d20a2aa --- /dev/null +++ b/test_apps/profiles/nvs @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.nvs" \ No newline at end of file diff --git a/test_apps/profiles/nvs_custom b/test_apps/profiles/nvs_custom new file mode 100644 index 0000000..871184c --- /dev/null +++ b/test_apps/profiles/nvs_custom @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.nvs;sdkconfig.defaults.nvs_custom" \ No newline at end of file diff --git a/test_apps/profiles/run_limit b/test_apps/profiles/run_limit new file mode 100644 index 0000000..46146f0 --- /dev/null +++ b/test_apps/profiles/run_limit @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.run_limit" \ No newline at end of file diff --git a/test_apps/profiles/tilt b/test_apps/profiles/tilt new file mode 100644 index 0000000..8028041 --- /dev/null +++ b/test_apps/profiles/tilt @@ -0,0 +1 @@ +-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.tilt" \ No newline at end of file diff --git a/test_apps/sdkconfig b/test_apps/sdkconfig index bc3790f..cdb482e 100644 --- a/test_apps/sdkconfig +++ b/test_apps/sdkconfig @@ -395,13 +395,13 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # # Partition Table # -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP=y # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set # CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions/part_nvs.csv" +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table @@ -1261,26 +1261,10 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y -CONFIG_RELAY_CHN_ENABLE_TILTING=y -CONFIG_RELAY_CHN_ENABLE_NVS=y +# CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT is not set +# CONFIG_RELAY_CHN_ENABLE_TILTING is not set +# CONFIG_RELAY_CHN_ENABLE_NVS is not set # end of Relay Channel Driver Configuration - -# -# Relay Channel NVS Storage Configuration -# -CONFIG_RELAY_CHN_NVS_NAMESPACE="relay_chn" -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION_NAME="app_data" -# end of Relay Channel NVS Storage Configuration - -# -# Relay Channel Run Limit Configuration -# -CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 -CONFIG_RELAY_CHN_RUN_LIMIT_MAX_SEC=600 -CONFIG_RELAY_CHN_RUN_LIMIT_DEFAULT_SEC=60 -# end of Relay Channel Run Limit Configuration # end of Component config # CONFIG_IDF_EXPERIMENTAL_FEATURES is not set diff --git a/test_apps/sdkconfig.defaults.single b/test_apps/sdkconfig.defaults similarity index 100% rename from test_apps/sdkconfig.defaults.single rename to test_apps/sdkconfig.defaults diff --git a/test_apps/sdkconfig.defaults.multi b/test_apps/sdkconfig.defaults.multi index 6262a4c..cf7f135 100644 --- a/test_apps/sdkconfig.defaults.multi +++ b/test_apps/sdkconfig.defaults.multi @@ -1,7 +1 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 CONFIG_RELAY_CHN_COUNT=8 \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.multi.custom_nvs b/test_apps/sdkconfig.defaults.multi.custom_nvs deleted file mode 100644 index 040c093..0000000 --- a/test_apps/sdkconfig.defaults.multi.custom_nvs +++ /dev/null @@ -1,14 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Partition configuration -CONFIG_PARTITION_TABLE_SINGLE_APP=y -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_NVS=y -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.multi.full b/test_apps/sdkconfig.defaults.multi.full deleted file mode 100644 index 0388bf1..0000000 --- a/test_apps/sdkconfig.defaults.multi.full +++ /dev/null @@ -1,17 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Partition configuration -CONFIG_PARTITION_TABLE_SINGLE_APP=y -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y -CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 -CONFIG_RELAY_CHN_ENABLE_TILTING=y -CONFIG_RELAY_CHN_ENABLE_NVS=y -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.multi.nvs b/test_apps/sdkconfig.defaults.multi.nvs deleted file mode 100644 index 5e3bbdd..0000000 --- a/test_apps/sdkconfig.defaults.multi.nvs +++ /dev/null @@ -1,8 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_NVS=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.multi.run_limit b/test_apps/sdkconfig.defaults.multi.run_limit deleted file mode 100644 index b5d1df4..0000000 --- a/test_apps/sdkconfig.defaults.multi.run_limit +++ /dev/null @@ -1,9 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y -CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.multi.tilt b/test_apps/sdkconfig.defaults.multi.tilt deleted file mode 100644 index e3c4d79..0000000 --- a/test_apps/sdkconfig.defaults.multi.tilt +++ /dev/null @@ -1,8 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_COUNT=8 -CONFIG_RELAY_CHN_ENABLE_TILTING=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.nvs b/test_apps/sdkconfig.defaults.nvs new file mode 100644 index 0000000..d31f8b9 --- /dev/null +++ b/test_apps/sdkconfig.defaults.nvs @@ -0,0 +1 @@ +CONFIG_RELAY_CHN_ENABLE_NVS=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.nvs_custom b/test_apps/sdkconfig.defaults.nvs_custom new file mode 100644 index 0000000..43d7bc4 --- /dev/null +++ b/test_apps/sdkconfig.defaults.nvs_custom @@ -0,0 +1,6 @@ +# Partition configuration +CONFIG_PARTITION_TABLE_SINGLE_APP=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" + +CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.run_limit b/test_apps/sdkconfig.defaults.run_limit new file mode 100644 index 0000000..78d933b --- /dev/null +++ b/test_apps/sdkconfig.defaults.run_limit @@ -0,0 +1,3 @@ +CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y +# Keep this as short as possible for tests +CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.single.custom_nvs b/test_apps/sdkconfig.defaults.single.custom_nvs deleted file mode 100644 index 46f1e8e..0000000 --- a/test_apps/sdkconfig.defaults.single.custom_nvs +++ /dev/null @@ -1,13 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Partition configuration -CONFIG_PARTITION_TABLE_SINGLE_APP=y -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_ENABLE_NVS=y -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.single.full b/test_apps/sdkconfig.defaults.single.full deleted file mode 100644 index 79085de..0000000 --- a/test_apps/sdkconfig.defaults.single.full +++ /dev/null @@ -1,16 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Partition configuration -CONFIG_PARTITION_TABLE_SINGLE_APP=y -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/part_nvs.csv" - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y -CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 -CONFIG_RELAY_CHN_ENABLE_TILTING=y -CONFIG_RELAY_CHN_ENABLE_NVS=y -CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.single.nvs b/test_apps/sdkconfig.defaults.single.nvs deleted file mode 100644 index d8a62fd..0000000 --- a/test_apps/sdkconfig.defaults.single.nvs +++ /dev/null @@ -1,7 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_ENABLE_NVS=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.single.run_limit b/test_apps/sdkconfig.defaults.single.run_limit deleted file mode 100644 index 71c2df9..0000000 --- a/test_apps/sdkconfig.defaults.single.run_limit +++ /dev/null @@ -1,8 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT=y -CONFIG_RELAY_CHN_RUN_LIMIT_MIN_SEC=1 \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.single.tilt b/test_apps/sdkconfig.defaults.single.tilt deleted file mode 100644 index e111deb..0000000 --- a/test_apps/sdkconfig.defaults.single.tilt +++ /dev/null @@ -1,7 +0,0 @@ -# Disable task WDT for tests -CONFIG_ESP_TASK_WDT_INIT=n - -# Relay Channel Driver Default Configuration for Testing -# Keep this as short as possible for tests -CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS=200 -CONFIG_RELAY_CHN_ENABLE_TILTING=y \ No newline at end of file diff --git a/test_apps/sdkconfig.defaults.tilt b/test_apps/sdkconfig.defaults.tilt new file mode 100644 index 0000000..7ececcd --- /dev/null +++ b/test_apps/sdkconfig.defaults.tilt @@ -0,0 +1 @@ +CONFIG_RELAY_CHN_ENABLE_TILTING=y \ No newline at end of file