Changeset 4b54bd9 in mainline for uspace/lib/pcut/src/report


Ignore:
Timestamp:
2018-09-12T13:23:03Z (7 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3da0ee4
Parents:
275530a4
Message:

Update PCUT to latest revision

Location:
uspace/lib/pcut/src/report
Files:
3 edited

Legend:

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

    r275530a4 r4b54bd9  
    3333
    3434#include "../internal.h"
     35
    3536#ifdef __helenos__
    36 #include <str.h>
     37#include <mem.h>
    3738#else
     39#pragma warning(push, 0)
    3840#include <string.h>
     41#pragma warning(pop)
    3942#endif
    40 #include <stdbool.h>
     43
     44#pragma warning(push, 0)
    4145#include <stdio.h>
     46#pragma warning(pop)
     47
    4248
    4349/** Currently used report ops. */
     
    6874 * @param msg The message to be printed.
    6975 */
    70 void pcut_print_fail_message(const char *msg)
    71 {
     76void pcut_print_fail_message(const char *msg) {
    7277        if (msg == NULL) {
    7378                return;
     
    99104 */
    100105static void parse_command_output(const char *full_output, size_t full_output_size,
    101     char *stdio_buffer, size_t stdio_buffer_size,
    102     char *error_buffer, size_t error_buffer_size)
    103 {
     106                char *stdio_buffer, size_t stdio_buffer_size,
     107                char *error_buffer, size_t error_buffer_size) {
    104108        memset(stdio_buffer, 0, stdio_buffer_size);
    105109        memset(error_buffer, 0, error_buffer_size);
     
    111115        }
    112116
    113         while (true) {
     117        while (1) {
    114118                size_t message_length;
    115119
     
    157161 * @param ops Functions to use.
    158162 */
    159 void pcut_report_register_handler(pcut_report_ops_t *ops)
    160 {
     163void pcut_report_register_handler(pcut_report_ops_t *ops) {
    161164        report_ops = ops;
    162165}
     
    166169 * @param all_items List of all tests that could be run.
    167170 */
    168 void pcut_report_init(pcut_item_t *all_items)
    169 {
     171void pcut_report_init(pcut_item_t *all_items) {
    170172        REPORT_CALL(init, all_items);
    171173}
     
    175177 * @param suite Suite that was just started.
    176178 */
    177 void pcut_report_suite_start(pcut_item_t *suite)
    178 {
     179void pcut_report_suite_start(pcut_item_t *suite) {
    179180        REPORT_CALL(suite_start, suite);
    180181}
     
    184185 * @param suite Suite that just completed.
    185186 */
    186 void pcut_report_suite_done(pcut_item_t *suite)
    187 {
     187void pcut_report_suite_done(pcut_item_t *suite) {
    188188        REPORT_CALL(suite_done, suite);
    189189}
     
    193193 * @param test Test to be run just about now.
    194194 */
    195 void pcut_report_test_start(pcut_item_t *test)
    196 {
     195void pcut_report_test_start(pcut_item_t *test) {
    197196        REPORT_CALL(test_start, test);
    198197}
     
    207206 */
    208207void pcut_report_test_done(pcut_item_t *test, int outcome,
    209     const char *error_message, const char *teardown_error_message,
    210     const char *extra_output)
    211 {
     208                const char *error_message, const char *teardown_error_message,
     209                const char *extra_output) {
    212210        REPORT_CALL(test_done, test, outcome, error_message, teardown_error_message,
    213             extra_output);
     211                        extra_output);
    214212}
    215213
     
    222220 */
    223221void pcut_report_test_done_unparsed(pcut_item_t *test, int outcome,
    224     const char *unparsed_output, size_t unparsed_output_size)
    225 {
     222                const char *unparsed_output, size_t unparsed_output_size) {
    226223
    227224        parse_command_output(unparsed_output, unparsed_output_size,
    228             buffer_for_extra_output, BUFFER_SIZE,
    229             buffer_for_error_messages, BUFFER_SIZE);
     225                        buffer_for_extra_output, BUFFER_SIZE,
     226                        buffer_for_error_messages, BUFFER_SIZE);
    230227
    231228        pcut_report_test_done(test, outcome, buffer_for_error_messages, NULL, buffer_for_extra_output);
     
    235232 *
    236233 */
    237 void pcut_report_done(void)
    238 {
     234void pcut_report_done(void) {
    239235        REPORT_CALL_NO_ARGS(done);
    240236}
  • uspace/lib/pcut/src/report/tap.c

    r275530a4 r4b54bd9  
    3434#include "../internal.h"
    3535#include "report.h"
     36
    3637#ifndef __helenos__
     38#pragma warning(push, 0)
    3739#include <string.h>
     40#pragma warning(pop)
    3841#endif
     42
     43#pragma warning(push, 0)
    3944#include <stdio.h>
     45#pragma warning(pop)
     46
    4047
    4148/** Counter of all run tests. */
     
    5562 * @param all_items Start of the list with all items.
    5663 */
    57 static void tap_init(pcut_item_t *all_items)
    58 {
     64static void tap_init(pcut_item_t *all_items) {
    5965        int tests_total = pcut_count_tests(all_items);
    6066        test_counter = 0;
     
    6874 * @param suite Suite that just started.
    6975 */
    70 static void tap_suite_start(pcut_item_t *suite)
    71 {
     76static void tap_suite_start(pcut_item_t *suite) {
    7277        tests_in_suite = 0;
    7378        failed_tests_in_suite = 0;
     
    8085 * @param suite Suite that just ended.
    8186 */
    82 static void tap_suite_done(pcut_item_t *suite)
    83 {
     87static void tap_suite_done(pcut_item_t *suite) {
    8488        if (failed_tests_in_suite == 0) {
    8589                printf("#> Finished suite %s (passed).\n",
    86                     suite->name);
     90                                suite->name);
    8791        } else {
    8892                printf("#> Finished suite %s (failed %d of %d).\n",
    89                     suite->name, failed_tests_in_suite, tests_in_suite);
     93                                suite->name, failed_tests_in_suite, tests_in_suite);
    9094        }
    9195}
     
    97101 * @param test Test that is started.
    98102 */
    99 static void tap_test_start(pcut_item_t *test)
    100 {
     103static void tap_test_start(pcut_item_t *test) {
    101104        PCUT_UNUSED(test);
    102105
     
    110113 * @param prefix Prefix for each new line, such as comment character.
    111114 */
    112 static void print_by_lines(const char *message, const char *prefix)
    113 {
     115static void print_by_lines(const char *message, const char *prefix) {
    114116        char *next_line_start;
    115117        if ((message == NULL) || (message[0] == 0)) {
     
    137139 */
    138140static void tap_test_done(pcut_item_t *test, int outcome,
    139     const char *error_message, const char *teardown_error_message,
    140     const char *extra_output)
    141 {
     141                const char *error_message, const char *teardown_error_message,
     142                const char *extra_output) {
    142143        const char *test_name = test->name;
    143144        const char *status_str = NULL;
     
    172173
    173174/** Report testing done. */
    174 static void tap_done(void)
    175 {
     175static void tap_done(void) {
    176176        if (failed_test_counter == 0) {
    177177                printf("#> Done: all tests passed.\n");
  • uspace/lib/pcut/src/report/xml.c

    r275530a4 r4b54bd9  
    3434#include "../internal.h"
    3535#include "report.h"
     36
    3637#ifndef __helenos__
     38#pragma warning(push, 0)
    3739#include <string.h>
     40#pragma warning(pop)
    3841#endif
     42
     43#pragma warning(push, 0)
    3944#include <stdio.h>
     45#pragma warning(pop)
     46
    4047
    4148/** Counter of all run tests. */
     
    5259 * @param all_items Start of the list with all items.
    5360 */
    54 static void xml_init(pcut_item_t *all_items)
    55 {
     61static void xml_init(pcut_item_t *all_items) {
    5662        int tests_total = pcut_count_tests(all_items);
    5763        test_counter = 0;
     
    6571 * @param suite Suite that just started.
    6672 */
    67 static void xml_suite_start(pcut_item_t *suite)
    68 {
     73static void xml_suite_start(pcut_item_t *suite) {
    6974        tests_in_suite = 0;
    7075        failed_tests_in_suite = 0;
     
    7782 * @param suite Suite that just ended.
    7883 */
    79 static void xml_suite_done(pcut_item_t *suite)
    80 {
     84static void xml_suite_done(pcut_item_t *suite) {
    8185        printf("\t</suite><!-- %s: %d / %d -->\n", suite->name,
    82             failed_tests_in_suite, tests_in_suite);
     86                failed_tests_in_suite, tests_in_suite);
    8387}
    8488
     
    8993 * @param test Test that is started.
    9094 */
    91 static void xml_test_start(pcut_item_t *test)
    92 {
     95static void xml_test_start(pcut_item_t *test) {
    9396        PCUT_UNUSED(test);
    9497
     
    102105 * @param element_name Wrapping XML element name.
    103106 */
    104 static void print_by_lines(const char *message, const char *element_name)
    105 {
     107static void print_by_lines(const char *message, const char *element_name) {
    106108        char *next_line_start;
    107109
     
    135137 */
    136138static void xml_test_done(pcut_item_t *test, int outcome,
    137     const char *error_message, const char *teardown_error_message,
    138     const char *extra_output)
    139 {
     139                const char *error_message, const char *teardown_error_message,
     140                const char *extra_output) {
    140141        const char *test_name = test->name;
    141142        const char *status_str = NULL;
     
    158159
    159160        printf("\t\t<testcase name=\"%s\" status=\"%s\">\n", test_name,
    160             status_str);
     161                status_str);
    161162
    162163        print_by_lines(error_message, "error-message");
     
    169170
    170171/** Report testing done. */
    171 static void xml_done(void)
    172 {
     172static void xml_done(void) {
    173173        printf("</report>\n");
    174174}
Note: See TracChangeset for help on using the changeset viewer.