Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion apps/examples/kernel_update_test/kernel_update_test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,16 @@ static int binary_update_run_tests(void)
return OK;
}

static void show_usage(void)
{
printf("Usage: kernel_update <test_type>\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
****************************************************************************/
Expand All @@ -628,5 +638,45 @@ 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;
}
printf("Same version test completed successfully\n");
return OK;
} 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;
}
printf("New version test completed successfully\n");
return OK;
} 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 binary test completed successfully\n");
return OK;
}
printf("Invalid test type: %s\n", argv[1]);
show_usage();
return ERROR;
}