Changeset 132ab5d1 in mainline for uspace/lib/pcut/src/report/tap.c


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/src/report/tap.c

    r8bfb163 r132ab5d1  
    4242static int test_counter;
    4343
     44/** Counter of all failures. */
     45static int failed_test_counter;
     46
    4447/** Counter for tests in a current suite. */
    4548static int tests_in_suite;
     
    5558        int tests_total = pcut_count_tests(all_items);
    5659        test_counter = 0;
     60        failed_test_counter = 0;
    5761
    5862        printf("1..%d\n", tests_total);
     
    7579 */
    7680static void tap_suite_done(pcut_item_t *suite) {
    77         printf("#> Finished suite %s (failed %d of %d).\n",
    78                         suite->name, failed_tests_in_suite, tests_in_suite);
     81        if (failed_tests_in_suite == 0) {
     82                printf("#> Finished suite %s (passed).\n",
     83                                suite->name);
     84        } else {
     85                printf("#> Finished suite %s (failed %d of %d).\n",
     86                                suite->name, failed_tests_in_suite, tests_in_suite);
     87        }
    7988}
    8089
     
    129138        const char *fail_error_str = NULL;
    130139
    131         if (outcome != TEST_OUTCOME_PASS) {
     140        if (outcome != PCUT_OUTCOME_PASS) {
    132141                failed_tests_in_suite++;
     142                failed_test_counter++;
    133143        }
    134144
    135145        switch (outcome) {
    136         case TEST_OUTCOME_PASS:
     146        case PCUT_OUTCOME_PASS:
    137147                status_str = "ok";
    138148                fail_error_str = "";
    139149                break;
    140         case TEST_OUTCOME_FAIL:
     150        case PCUT_OUTCOME_FAIL:
    141151                status_str = "not ok";
    142152                fail_error_str = " failed";
    143153                break;
    144         case TEST_OUTCOME_ERROR:
     154        default:
    145155                status_str = "not ok";
    146156                fail_error_str = " aborted";
    147                 break;
    148         default:
    149                 /* Shall not get here. */
    150157                break;
    151158        }
     
    160167/** Report testing done. */
    161168static void tap_done(void) {
     169        if (failed_test_counter == 0) {
     170                printf("#> Done: all tests passed.\n");
     171        } else {
     172                printf("#> Done: %d of %d tests failed.\n", failed_test_counter, test_counter);
     173        }
    162174}
    163175
Note: See TracChangeset for help on using the changeset viewer.