Changeset 851f33a in mainline
- Timestamp:
- 2010-06-24T09:07:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ccb426c
- Parents:
- 9539be6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r9539be6 r851f33a 108 108 109 109 #ifdef CONFIG_TEST 110 static int cmd_tests(cmd_arg_t *argv);111 static cmd_info_t tests_info = {112 .name = "tests",113 .description = "Print available kernel tests.",114 .func = cmd_tests,115 .argc = 0116 };117 118 110 static char test_buf[MAX_CMDLINE + 1]; 119 111 static int cmd_test(cmd_arg_t *argv); 120 112 static cmd_arg_t test_argv[] = { 121 113 { 122 .type = ARG_TYPE_STRING ,114 .type = ARG_TYPE_STRING_OPTIONAL, 123 115 .buffer = test_buf, 124 116 .len = sizeof(test_buf) … … 127 119 static cmd_info_t test_info = { 128 120 .name = "test", 129 .description = " Run kerneltest.",121 .description = "Print list of kernel tests or run a test.", 130 122 .func = cmd_test, 131 123 .argc = 1, … … 509 501 &zone_info, 510 502 #ifdef CONFIG_TEST 511 &tests_info,512 503 &test_info, 513 504 &bench_info, … … 1066 1057 1067 1058 #ifdef CONFIG_TEST 1068 /** Command for printing kernel tests list.1069 *1070 * @param argv Ignored.1071 *1072 * return Always 1.1073 */1074 int cmd_tests(cmd_arg_t *argv)1075 {1076 size_t len = 0;1077 test_t *test;1078 for (test = tests; test->name != NULL; test++) {1079 if (str_length(test->name) > len)1080 len = str_length(test->name);1081 }1082 1083 for (test = tests; test->name != NULL; test++)1084 printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));1085 1086 printf("%-*s Run all safe tests\n", len, "*");1087 return 1;1088 }1089 1090 1059 static bool run_test(const test_t *test) 1091 1060 { … … 1193 1162 } 1194 1163 1195 /** Command for returning kernel tests 1164 static void list_tests(void) 1165 { 1166 size_t len = 0; 1167 test_t *test; 1168 1169 for (test = tests; test->name != NULL; test++) { 1170 if (str_length(test->name) > len) 1171 len = str_length(test->name); 1172 } 1173 1174 for (test = tests; test->name != NULL; test++) 1175 printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)")); 1176 1177 printf("%-*s Run all safe tests\n", len, "*"); 1178 } 1179 1180 /** Command for listing and running kernel tests 1196 1181 * 1197 1182 * @param argv Argument vector. 1198 1183 * 1199 1184 * return Always 1. 1185 * 1200 1186 */ 1201 1187 int cmd_test(cmd_arg_t *argv) … … 1211 1197 } 1212 1198 } 1213 } else {1199 } else if (str_cmp((char *) argv->buffer, "") != 0) { 1214 1200 bool fnd = false; 1215 1201 … … 1224 1210 if (!fnd) 1225 1211 printf("Unknown test\n"); 1226 } 1212 } else 1213 list_tests(); 1227 1214 1228 1215 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.