Changes in uspace/lib/pcut/src/main.c [9eb1ff5:9b20126] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/main.c
r9eb1ff5 r9b20126 90 90 * @param last Pointer to first item after this suite is stored here. 91 91 * @param prog_path Path to the current binary (used in forked mode). 92 * @return Error code. 93 */ 94 static int run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) { 92 */ 93 static void run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) { 95 94 int is_first_test = 1; 96 95 int total_count = 0; 97 int ret_code = PCUT_OUTCOME_PASS;98 int ret_code_tmp;99 96 100 97 pcut_item_t *it = pcut_get_real_next(suite); … … 117 114 118 115 if (pcut_run_mode == PCUT_RUN_MODE_FORKING) { 119 ret_code_tmp = pcut_run_test_forking(prog_path, it); 120 } else { 121 ret_code_tmp = pcut_run_test_single(it); 122 } 123 124 /* 125 * Override final return code in case of failure. 126 * 127 * In this case we suppress any special error codes as 128 * to the outside, there was a failure. 129 */ 130 if (ret_code_tmp != PCUT_OUTCOME_PASS) { 131 ret_code = PCUT_OUTCOME_FAIL; 132 } 133 116 pcut_run_test_forking(prog_path, it); 117 } else { 118 pcut_run_test_single(it); 119 } 134 120 total_count++; 135 121 } … … 144 130 *last = it; 145 131 } 146 147 return ret_code;148 132 } 149 133 … … 197 181 int run_only_test = -1; 198 182 199 int rc, rc_tmp;200 201 183 if (main_extras == NULL) { 202 184 main_extras = empty_main_extra; … … 221 203 if (pcut_str_equals(argv[i], "-l")) { 222 204 pcut_print_tests(items); 223 return PCUT_OUTCOME_PASS;205 return 0; 224 206 } 225 207 if (pcut_str_equals(argv[i], "-x")) { … … 247 229 if ((run_only_suite >= 0) && (run_only_test >= 0)) { 248 230 printf("Specify either -s or -t!\n"); 249 return PCUT_OUTCOME_BAD_INVOCATION;231 return 1; 250 232 } 251 233 … … 254 236 if (suite == NULL) { 255 237 printf("Suite not found, aborting!\n"); 256 return PCUT_OUTCOME_BAD_INVOCATION;238 return 2; 257 239 } 258 240 if (suite->kind != PCUT_KIND_TESTSUITE) { 259 241 printf("Invalid suite id!\n"); 260 return PCUT_OUTCOME_BAD_INVOCATION;242 return 3; 261 243 } 262 244 263 245 run_suite(suite, NULL, argv[0]); 264 return PCUT_OUTCOME_PASS;246 return 0; 265 247 } 266 248 267 249 if (run_only_test > 0) { 250 int rc; 268 251 pcut_item_t *test = pcut_find_by_id(items, run_only_test); 269 252 if (test == NULL) { 270 253 printf("Test not found, aborting!\n"); 271 return PCUT_OUTCOME_BAD_INVOCATION;254 return 2; 272 255 } 273 256 if (test->kind != PCUT_KIND_TEST) { 274 257 printf("Invalid test id!\n"); 275 return PCUT_OUTCOME_BAD_INVOCATION;258 return 3; 276 259 } 277 260 … … 287 270 /* Otherwise, run the whole thing. */ 288 271 pcut_report_init(items); 289 290 rc = PCUT_OUTCOME_PASS;291 272 292 273 it = items; … … 294 275 if (it->kind == PCUT_KIND_TESTSUITE) { 295 276 pcut_item_t *tmp; 296 rc_tmp = run_suite(it, &tmp, argv[0]); 297 if (rc_tmp != PCUT_OUTCOME_PASS) { 298 rc = rc_tmp; 299 } 277 run_suite(it, &tmp, argv[0]); 300 278 it = tmp; 301 279 } else { … … 306 284 pcut_report_done(); 307 285 308 return rc;309 } 286 return 0; 287 }
Note:
See TracChangeset
for help on using the changeset viewer.