From 196bd4f031f193e5da89f1951bbf45d9493e8ec6 Mon Sep 17 00:00:00 2001 From: Jaeyong Lee Date: Thu, 18 Dec 2025 13:44:01 +0900 Subject: [PATCH 1/3] apps/examples/kernel_update_test: Support app2 binary Current test code considers about kernel/common/app1 partition, not about app2 partition. This commit has been modified to enable testing even when app2 partition present. Signed-off-by: Jaeyong Lee --- .../kernel_update_test_main.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/examples/kernel_update_test/kernel_update_test_main.c b/apps/examples/kernel_update_test/kernel_update_test_main.c index a97fa892e7..3e731fc13a 100644 --- a/apps/examples/kernel_update_test/kernel_update_test_main.c +++ b/apps/examples/kernel_update_test/kernel_update_test_main.c @@ -45,10 +45,22 @@ /* Kernel binary information for update test */ #define KERNEL "kernel" -/* Common/app1 binary names for testing */ -/* Kernel / Common / App1 binary must be set at once */ +/* Common/app1/app2 binary names for testing */ +/* Kernel / Common / App1 / App2 binary must be set at once */ #define COMMON "common" #define APP1 "app1" +#define APP2 "app2" + +#ifdef CONFIG_SUPPORT_COMMON_BINARY +char *bin_names[] = {KERNEL, COMMON, APP1}; +uint8_t bin_types[] = {BINARY_KERNEL, BINARY_COMMON, BINARY_USERAPP}; +#else +char *bin_names[] = {KERNEL, APP1, APP2}; +uint8_t bin_types[] = {BINARY_KERNEL, BINARY_USERAPP, BINARY_USERAPP}; +#endif + +int bin_count = sizeof(bin_names) / sizeof(bin_names[0]); + #define DOWNLOAD_VALID_BIN 0 #define DOWNLOAD_INVALID_BIN 1 @@ -410,9 +422,6 @@ static int binary_update_same_version_test(void) int ret; binary_update_info_t pre_bin_info[3]; binary_update_info_t cur_bin_info[3]; - char *bin_names[] = {KERNEL, COMMON, APP1}; - uint8_t bin_types[] = {BINARY_KERNEL, BINARY_COMMON, BINARY_USERAPP}; - int bin_count = sizeof(bin_names) / sizeof(bin_names[0]); int i; update_type_flag = 0; @@ -468,9 +477,6 @@ static int binary_update_new_version_test(void) int ret; binary_update_info_t pre_bin_info[3]; binary_update_info_t cur_bin_info[3]; - char *bin_names[] = {KERNEL, COMMON, APP1}; - uint8_t bin_types[] = {BINARY_KERNEL, BINARY_COMMON, BINARY_USERAPP}; - int bin_count = sizeof(bin_names) / sizeof(bin_names[0]); int i; update_type_flag = 0; @@ -530,9 +536,6 @@ static int binary_update_invalid_binary_test(void) int ret; binary_update_info_t pre_bin_info[3]; binary_update_info_t cur_bin_info[3]; - char *bin_names[] = {KERNEL, COMMON, APP1}; - uint8_t bin_types[] = {BINARY_KERNEL, BINARY_COMMON, BINARY_USERAPP}; - int bin_count = sizeof(bin_names) / sizeof(bin_names[0]); int i; update_type_flag = 0; From b0e2c5d4e1e28d842e460011797e57b9e5a370ed Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Thu, 18 Dec 2025 17:18:55 +0530 Subject: [PATCH 2/3] apps/examples/kernel_update_test/kernel_update_test_main.c: Modify kernel update test to accept command line arguments - Add support for running specific tests: same_version, new_version, invalid, all - Each test now runs independently with proper error handling - Update main function to parse argc/argv and call appropriate test functions --- .../kernel_update_test_main.c | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/apps/examples/kernel_update_test/kernel_update_test_main.c b/apps/examples/kernel_update_test/kernel_update_test_main.c index 3e731fc13a..e182b275fd 100644 --- a/apps/examples/kernel_update_test/kernel_update_test_main.c +++ b/apps/examples/kernel_update_test/kernel_update_test_main.c @@ -622,6 +622,16 @@ static int binary_update_run_tests(void) return OK; } +static void show_usage(void) +{ + printf("Usage: kernel_update \n"); + printf("Available test types:\n"); + printf(" all - Run all tests\n"); + printf(" same_version - Run same version test\n"); + printf(" new_version - Run new version test\n"); + printf(" invalid - Run invalid binary test\n"); +} + /**************************************************************************** * binary_update_aging_test ****************************************************************************/ @@ -631,5 +641,39 @@ int main(int argc, FAR char *argv[]) int kernel_update_main(int argc, char *argv[]) #endif { - binary_update_run_tests(); + if (argc == 2 && !strncmp(argv[1], "all", 4)) { + /* Run all tests */ + return binary_update_run_tests(); + + } else if (argc == 2 && !strncmp(argv[1], "same_version", 13)) { + /* Get info all test. */ + binary_update_getinfo_all(); + + int ret = binary_update_same_version_test(); + if (ret != OK) { + printf("Same version test failed\n"); + } + return ret; + } else if (argc == 2 && !strncmp(argv[1], "new_version", 12)) { + /* Get info all test. */ + binary_update_getinfo_all(); + + int ret = binary_update_new_version_test(); + if (ret != OK) { + printf("New version test failed\n"); + } + return ret; + } else if (argc == 2 && !strncmp(argv[1], "invalid", 8)) { + /* Get info all test. */ + binary_update_getinfo_all(); + + int ret = binary_update_invalid_binary_test(); + if (ret != OK) { + printf("Invalid binary test failed\n"); + } + return ret; + } + printf("Invalid test type: %s\n", argv[1]); + show_usage(); + return ERROR; } From a54fd0cf851b10f92870379c6c4cee12b234454b Mon Sep 17 00:00:00 2001 From: Naman Jain Date: Wed, 7 Jan 2026 10:33:39 +0000 Subject: [PATCH 3/3] loadable_apps/loadable_sample/wifiapp: Add support for running binary update tests separately This commit modifies the wifiapp to allow users to run individual binary update tests instead of only running all tests together --- .../loadable_sample/wifiapp/binary_update.c | 25 +++++++++++++++++++ .../loadable_sample/wifiapp/wifiapp.c | 19 ++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/loadable_apps/loadable_sample/wifiapp/binary_update.c b/loadable_apps/loadable_sample/wifiapp/binary_update.c index 948c169d43..2340a2d6f0 100644 --- a/loadable_apps/loadable_sample/wifiapp/binary_update.c +++ b/loadable_apps/loadable_sample/wifiapp/binary_update.c @@ -677,6 +677,31 @@ void binary_update_test(void) { binary_update_execute_ntimes(1); } + +/**************************************************************************** + * binary_update_test_with_type + ****************************************************************************/ +void binary_update_test_with_type(const char *test_type) +{ + if (test_type == NULL) { + /* Default: run all tests */ + binary_update_run_tests(); + return; + } + + if (strcmp(test_type, "same_version") == 0) { + binary_update_same_version_test(APP1_NAME); + } else if (strcmp(test_type, "new_version") == 0) { + binary_update_new_version_test(APP1_NAME); + } else if (strcmp(test_type, "invalid_binary") == 0) { + binary_update_invalid_binary_test(APP1_NAME); + } else if (strcmp(test_type, "all_tests") == 0) { + binary_update_run_tests(); + } else { + printf("Unknown test type: %s\n", test_type); + printf("Available test types: same_version, new_version, invalid_binary, all_tests\n"); + } +} #endif #ifdef CONFIG_EXAMPLES_UPDATE_AGING_TEST diff --git a/loadable_apps/loadable_sample/wifiapp/wifiapp.c b/loadable_apps/loadable_sample/wifiapp/wifiapp.c index 54544a9708..a044e431c6 100644 --- a/loadable_apps/loadable_sample/wifiapp/wifiapp.c +++ b/loadable_apps/loadable_sample/wifiapp/wifiapp.c @@ -42,7 +42,10 @@ static void display_test_scenario(void) printf("\t-Press R or r : Recovery Test\n"); #endif #ifdef CONFIG_EXAMPLES_BINARY_UPDATE_TEST - printf("\t-Press U or u : Binary Update Test\n"); + printf("\t-Press U or u : Binary Update Test (All Tests)\n"); + printf("\t-Press S or s : Same Version Test\n"); + printf("\t-Press N or n : New Version Test\n"); + printf("\t-Press I or i : Invalid Binary Test\n"); #endif printf("\t-Press X or x : Terminate Tests.\n"); } @@ -103,7 +106,19 @@ int wifiapp_main(int argc, char **argv) #ifdef CONFIG_EXAMPLES_BINARY_UPDATE_TEST case 'U': case 'u': - binary_update_test(); + binary_update_test_with_type("all_tests"); + break; + case 'S': + case 's': + binary_update_test_with_type("same_version"); + break; + case 'N': + case 'n': + binary_update_test_with_type("new_version"); + break; + case 'I': + case 'i': + binary_update_test_with_type("invalid_binary"); break; #endif case 'X':