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':