Changeset 1433ecda in mainline for uspace/lib/pcut/src


Ignore:
Timestamp:
2018-04-04T15:42:37Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2c4e1cc
Parents:
47b2d7e3
Message:

Fix cstyle: make ccheck-fix and commit only files where all the changes are good.

Location:
uspace/lib/pcut/src
Files:
13 edited

Legend:

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

    r47b2d7e3 r1433ecda  
    5959static int message_buffer_index = 0;
    6060
    61 void pcut_failed_assertion_fmt(const char *filename, int line, const char *fmt, ...) {
     61void pcut_failed_assertion_fmt(const char *filename, int line, const char *fmt, ...)
     62{
    6263        va_list args;
    6364        char *current_buffer = message_buffer[message_buffer_index];
  • uspace/lib/pcut/src/list.c

    r47b2d7e3 r1433ecda  
    4343 * @return First item with actual content or NULL on end of list.
    4444 */
    45 pcut_item_t *pcut_get_real_next(pcut_item_t *item) {
     45pcut_item_t *pcut_get_real_next(pcut_item_t *item)
     46{
    4647        if (item == NULL) {
    4748                return NULL;
     
    6465 * @return First item with actual content or NULL on end of list.
    6566 */
    66 pcut_item_t *pcut_get_real(pcut_item_t *item) {
     67pcut_item_t *pcut_get_real(pcut_item_t *item)
     68{
    6769        if (item == NULL) {
    6870                return NULL;
     
    8183 * @param nested Head of the nested list.
    8284 */
    83 static void inline_nested_lists(pcut_item_t *nested) {
     85static void inline_nested_lists(pcut_item_t *nested)
     86{
    8487        pcut_item_t *first;
    8588
     
    108111 * @param first List head.
    109112 */
    110 static void set_ids(pcut_item_t *first) {
     113static void set_ids(pcut_item_t *first)
     114{
    111115        int id = 1;
    112116        pcut_item_t *it;
     
    131135 * @param first Head of the list.
    132136 */
    133 static void detect_skipped_tests(pcut_item_t *first) {
     137static void detect_skipped_tests(pcut_item_t *first)
     138{
    134139        pcut_item_t *it;
    135140
     
    167172 * @return Head of the fixed list.
    168173 */
    169 pcut_item_t *pcut_fix_list_get_real_head(pcut_item_t *last) {
     174pcut_item_t *pcut_fix_list_get_real_head(pcut_item_t *last)
     175{
    170176        pcut_item_t *next, *it;
    171177
     
    195201 * @return Number of tests.
    196202 */
    197 int pcut_count_tests(pcut_item_t *it) {
     203int pcut_count_tests(pcut_item_t *it)
     204{
    198205        int count = 0;
    199206        while (it != NULL) {
  • uspace/lib/pcut/src/main.c

    r47b2d7e3 r1433ecda  
    5757 * @return Whether @p arg is @p opt followed by a number.
    5858 */
    59 int pcut_is_arg_with_number(const char *arg, const char *opt, int *value) {
     59int pcut_is_arg_with_number(const char *arg, const char *opt, int *value)
     60{
    6061        int opt_len = pcut_str_size(opt);
    61         if (! pcut_str_start_equals(arg, opt, opt_len)) {
     62        if (!pcut_str_start_equals(arg, opt, opt_len)) {
    6263                return 0;
    6364        }
     
    7475 * @retval NULL No item with such id exists in the list.
    7576 */
    76 static pcut_item_t *pcut_find_by_id(pcut_item_t *first, int id) {
     77static pcut_item_t *pcut_find_by_id(pcut_item_t *first, int id)
     78{
    7779        pcut_item_t *it = pcut_get_real(first);
    7880        while (it != NULL) {
     
    9294 * @return Error code.
    9395 */
    94 static int run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) {
     96static int run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path)
     97{
    9598        int is_first_test = 1;
    9699        int total_count = 0;
     
    156159 * @param first First item of the list.
    157160 */
    158 static void set_setup_teardown_callbacks(pcut_item_t *first) {
     161static void set_setup_teardown_callbacks(pcut_item_t *first)
     162{
    159163        pcut_item_t *active_suite = NULL;
    160164        pcut_item_t *it;
     
    188192 * @return Program exit code.
    189193 */
    190 int pcut_main(pcut_item_t *last, int argc, char *argv[]) {
     194int pcut_main(pcut_item_t *last, int argc, char *argv[])
     195{
    191196        pcut_item_t *items = pcut_fix_list_get_real_head(last);
    192197        pcut_item_t *it;
  • uspace/lib/pcut/src/os/generic.c

    r47b2d7e3 r1433ecda  
    8181 * @param test Test that is about to start.
    8282 */
    83 static void before_test_start(pcut_item_t *test) {
     83static void before_test_start(pcut_item_t *test)
     84{
    8485        pcut_report_test_start(test);
    8586
     
    9394 * @return Test outcome code.
    9495 */
    95 static int convert_wait_status_to_outcome(int status) {
     96static int convert_wait_status_to_outcome(int status)
     97{
    9698        if (status < 0) {
    9799                return PCUT_OUTCOME_INTERNAL_ERROR;
     
    108110 * @param test Test to be run.
    109111 */
    110 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
     112int pcut_run_test_forking(const char *self_path, pcut_item_t *test)
     113{
    111114        int rc, outcome;
    112115        FILE *tempfile;
     
    118121        FORMAT_TEMP_FILENAME(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1);
    119122        FORMAT_COMMAND(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1,
    120                 self_path, (test)->id, tempfile_name);
     123            self_path, (test)->id, tempfile_name);
    121124
    122125        PCUT_DEBUG("Will execute <%s> (temp file <%s>) with system().",
    123                 command, tempfile_name);
     126            command, tempfile_name);
    124127
    125128        rc = system(command);
     
    144147}
    145148
    146 void pcut_hook_before_test(pcut_item_t *test) {
     149void pcut_hook_before_test(pcut_item_t *test)
     150{
    147151        PCUT_UNUSED(test);
    148152
  • uspace/lib/pcut/src/os/stdc.c

    r47b2d7e3 r1433ecda  
    3535#include "../internal.h"
    3636
    37 int pcut_str_equals(const char *a, const char *b) {
     37int pcut_str_equals(const char *a, const char *b)
     38{
    3839        return strcmp(a, b) == 0;
    3940}
    4041
    41 int pcut_str_start_equals(const char *a, const char *b, int len) {
     42int pcut_str_start_equals(const char *a, const char *b, int len)
     43{
    4244        return strncmp(a, b, len) == 0;
    4345}
    4446
    45 int pcut_str_size(const char *s) {
     47int pcut_str_size(const char *s)
     48{
    4649        return strlen(s);
    4750}
    4851
    49 int pcut_str_to_int(const char *s) {
     52int pcut_str_to_int(const char *s)
     53{
    5054        return atoi(s);
    5155}
    5256
    53 char *pcut_str_find_char(const char *haystack, const char needle) {
     57char *pcut_str_find_char(const char *haystack, const char needle)
     58{
    5459        return strchr(haystack, needle);
    5560}
    5661
    57 void pcut_str_error(int error, char *buffer, int size) {
     62void pcut_str_error(int error, char *buffer, int size)
     63{
    5864        const char *str = strerror(error);
    5965        if (str == NULL) {
  • uspace/lib/pcut/src/os/unix.c

    r47b2d7e3 r1433ecda  
    6464 * @param test Test that is about to be run.
    6565 */
    66 static void before_test_start(pcut_item_t *test) {
     66static void before_test_start(pcut_item_t *test)
     67{
    6768        pcut_report_test_start(test);
    6869
     
    7879 * @param sig Signal number.
    7980 */
    80 static void kill_child_on_alarm(int sig) {
     81static void kill_child_on_alarm(int sig)
     82{
    8183        PCUT_UNUSED(sig);
    8284        kill(child_pid, SIGKILL);
     
    9496 * @return Number of actually read bytes.
    9597 */
    96 static size_t read_all(int fd, char *buffer, size_t buffer_size) {
     98static size_t read_all(int fd, char *buffer, size_t buffer_size)
     99{
    97100        ssize_t actually_read;
    98101        char *buffer_start = buffer;
     
    121124 * @return Test outcome code.
    122125 */
    123 static int convert_wait_status_to_outcome(int status) {
     126static int convert_wait_status_to_outcome(int status)
     127{
    124128        if (WIFEXITED(status)) {
    125129                if (WEXITSTATUS(status) != 0) {
     
    142146 * @param test Test to be run.
    143147 */
    144 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
     148int pcut_run_test_forking(const char *self_path, pcut_item_t *test)
     149{
    145150        int link_stdout[2], link_stderr[2];
    146151        int rc, status, outcome;
     
    155160        if (rc == -1) {
    156161                snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
    157                                 "pipe() failed: %s.", strerror(rc));
     162                    "pipe() failed: %s.", strerror(rc));
    158163                pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
    159164                return PCUT_OUTCOME_INTERNAL_ERROR;
     
    162167        if (rc == -1) {
    163168                snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
    164                                 "pipe() failed: %s.", strerror(rc));
     169                    "pipe() failed: %s.", strerror(rc));
    165170                pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
    166171                return PCUT_OUTCOME_INTERNAL_ERROR;
     
    170175        if (child_pid == (pid_t)-1) {
    171176                snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
    172                         "fork() failed: %s.", strerror(rc));
     177                    "fork() failed: %s.", strerror(rc));
    173178                outcome = PCUT_OUTCOME_INTERNAL_ERROR;
    174179                goto leave_close_pipes;
     
    215220}
    216221
    217 void pcut_hook_before_test(pcut_item_t *test) {
     222void pcut_hook_before_test(pcut_item_t *test)
     223{
    218224        PCUT_UNUSED(test);
    219225
  • uspace/lib/pcut/src/os/windows.c

    r47b2d7e3 r1433ecda  
    6161 * @param test Test that is about to be run.
    6262 */
    63 static void before_test_start(pcut_item_t *test) {
     63static void before_test_start(pcut_item_t *test)
     64{
    6465        pcut_report_test_start(test);
    6566
     
    7374 * @param failed_function_name Name of the failed function.
    7475 */
    75 static void report_func_fail(pcut_item_t *test, const char *failed_function_name) {
     76static void report_func_fail(pcut_item_t *test, const char *failed_function_name)
     77{
    7678        /* TODO: get error description. */
    7779        sprintf_s(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
    78                 "%s failed: %s.", failed_function_name, "unknown reason");
     80            "%s failed: %s.", failed_function_name, "unknown reason");
    7981        pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL);
    8082}
     
    9193 * @return Number of actually read bytes.
    9294 */
    93 static size_t read_all(HANDLE fd, char *buffer, size_t buffer_size) {
     95static size_t read_all(HANDLE fd, char *buffer, size_t buffer_size)
     96{
    9497        DWORD actually_read;
    9598        char *buffer_start = buffer;
     
    125128};
    126129
    127 static DWORD WINAPI read_test_output_on_background(LPVOID test_output_data_ptr) {
     130static DWORD WINAPI read_test_output_on_background(LPVOID test_output_data_ptr)
     131{
    128132        size_t stderr_size = 0;
    129133        struct test_output_data *test_output_data = (struct test_output_data *) test_output_data_ptr;
    130134
    131135        stderr_size = read_all(test_output_data->pipe_stderr,
    132                 test_output_data->output_buffer,
    133                 test_output_data->output_buffer_size - 1);
     136            test_output_data->output_buffer,
     137            test_output_data->output_buffer_size - 1);
    134138        read_all(test_output_data->pipe_stdout,
    135                 test_output_data->output_buffer,
    136                 test_output_data->output_buffer_size - 1 - stderr_size);
     139            test_output_data->output_buffer,
     140            test_output_data->output_buffer_size - 1 - stderr_size);
    137141
    138142        return 0;
     
    144148 * @param test Test to be run.
    145149 */
    146 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
     150int pcut_run_test_forking(const char *self_path, pcut_item_t *test)
     151{
    147152        /* TODO: clean-up if something goes wrong "in the middle" */
    148153        BOOL okay = FALSE;
     
    216221        /* Format the command line. */
    217222        sprintf_s(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1,
    218                 "\"%s\" -t%d", self_path, test->id);
     223            "\"%s\" -t%d", self_path, test->id);
    219224
    220225        /* Run the process. */
    221226        okay = CreateProcess(NULL, command, NULL, NULL, TRUE, 0, NULL, NULL,
    222                 &start_info, &process_info);
     227            &start_info, &process_info);
    223228
    224229        if (!okay) {
     
    262267
    263268        test_output_thread_reader = CreateThread(NULL, 0,
    264                 read_test_output_on_background, &test_output_data,
    265                 0, NULL);
     269            read_test_output_on_background, &test_output_data,
     270            0, NULL);
    266271
    267272        if (test_output_thread_reader == NULL) {
     
    317322}
    318323
    319 void pcut_hook_before_test(pcut_item_t *test) {
     324void pcut_hook_before_test(pcut_item_t *test)
     325{
    320326        PCUT_UNUSED(test);
    321327
  • uspace/lib/pcut/src/preproc.c

    r47b2d7e3 r1433ecda  
    3636static int counter = 0;
    3737
    38 static void print_numbered_identifier(int value, FILE *output) {
     38static void print_numbered_identifier(int value, FILE *output)
     39{
    3940        fprintf(output, "pcut_item_%d", value);
    4041}
    4142
    42 static void print_numbered_identifier2(int value, FILE *output) {
     43static void print_numbered_identifier2(int value, FILE *output)
     44{
    4345        fprintf(output, "pcut_item2_%d", value);
    4446}
    4547
    46 static void print_numbered_identifier3(int value, FILE *output) {
     48static void print_numbered_identifier3(int value, FILE *output)
     49{
    4750        fprintf(output, "pcut_item3_%d", value);
    4851}
     
    5356} identifier_t;
    5457
    55 static void identifier_init(identifier_t *identifier) {
     58static void identifier_init(identifier_t *identifier)
     59{
    5660        identifier->name[0] = 0;
    5761        identifier->length = 0;
    5862}
    5963
    60 static void identifier_add_char(identifier_t *identifier, char c) {
     64static void identifier_add_char(identifier_t *identifier, char c)
     65{
    6166        if (identifier->length + 1 >= MAX_IDENTIFIER_LENGTH) {
    6267                fprintf(stderr, "Identifier %s is too long, aborting!\n", identifier->name);
     
    6974}
    7075
    71 static void identifier_print_or_expand(identifier_t *identifier, FILE *output) {
     76static void identifier_print_or_expand(identifier_t *identifier, FILE *output)
     77{
    7278        const char *name = identifier->name;
    7379        if (strcmp(name, "PCUT_ITEM_NAME") == 0) {
     
    8692}
    8793
    88 static int is_identifier_char(int c, int inside_identifier) {
    89         return isalpha(c) || (c == '_')
    90                         || (inside_identifier && isdigit(c));
     94static int is_identifier_char(int c, int inside_identifier)
     95{
     96        return isalpha(c) || (c == '_') || (inside_identifier && isdigit(c));
    9197}
    9298
    93 int main(int argc, char *argv[]) {
     99int main(int argc, char *argv[])
     100{
    94101        FILE *input = stdin;
    95102        FILE *output = stdout;
  • uspace/lib/pcut/src/print.c

    r47b2d7e3 r1433ecda  
    4242 * @param first First item to be printed.
    4343 */
    44 void pcut_print_items(pcut_item_t *first) {
     44void pcut_print_items(pcut_item_t *first)
     45{
    4546        pcut_item_t *it = first;
    4647        printf("====>\n");
     
    7172 * @param first First item to be printed.
    7273 */
    73 void pcut_print_tests(pcut_item_t *first) {
     74void pcut_print_tests(pcut_item_t *first)
     75{
    7476        pcut_item_t *it;
    7577        for (it = pcut_get_real(first); it != NULL; it = pcut_get_real_next(it)) {
  • uspace/lib/pcut/src/report/report.c

    r47b2d7e3 r1433ecda  
    6767 * @param msg The message to be printed.
    6868 */
    69 void pcut_print_fail_message(const char *msg) {
     69void pcut_print_fail_message(const char *msg)
     70{
    7071        if (msg == NULL) {
    7172                return;
     
    9798 */
    9899static void parse_command_output(const char *full_output, size_t full_output_size,
    99                 char *stdio_buffer, size_t stdio_buffer_size,
    100                 char *error_buffer, size_t error_buffer_size) {
     100    char *stdio_buffer, size_t stdio_buffer_size,
     101    char *error_buffer, size_t error_buffer_size)
     102{
    101103        memset(stdio_buffer, 0, stdio_buffer_size);
    102104        memset(error_buffer, 0, error_buffer_size);
     
    154156 * @param ops Functions to use.
    155157 */
    156 void pcut_report_register_handler(pcut_report_ops_t *ops) {
     158void pcut_report_register_handler(pcut_report_ops_t *ops)
     159{
    157160        report_ops = ops;
    158161}
     
    162165 * @param all_items List of all tests that could be run.
    163166 */
    164 void pcut_report_init(pcut_item_t *all_items) {
     167void pcut_report_init(pcut_item_t *all_items)
     168{
    165169        REPORT_CALL(init, all_items);
    166170}
     
    170174 * @param suite Suite that was just started.
    171175 */
    172 void pcut_report_suite_start(pcut_item_t *suite) {
     176void pcut_report_suite_start(pcut_item_t *suite)
     177{
    173178        REPORT_CALL(suite_start, suite);
    174179}
     
    178183 * @param suite Suite that just completed.
    179184 */
    180 void pcut_report_suite_done(pcut_item_t *suite) {
     185void pcut_report_suite_done(pcut_item_t *suite)
     186{
    181187        REPORT_CALL(suite_done, suite);
    182188}
     
    186192 * @param test Test to be run just about now.
    187193 */
    188 void pcut_report_test_start(pcut_item_t *test) {
     194void pcut_report_test_start(pcut_item_t *test)
     195{
    189196        REPORT_CALL(test_start, test);
    190197}
     
    199206 */
    200207void pcut_report_test_done(pcut_item_t *test, int outcome,
    201                 const char *error_message, const char *teardown_error_message,
    202                 const char *extra_output) {
     208    const char *error_message, const char *teardown_error_message,
     209    const char *extra_output)
     210{
    203211        REPORT_CALL(test_done, test, outcome, error_message, teardown_error_message,
    204                         extra_output);
     212            extra_output);
    205213}
    206214
     
    213221 */
    214222void pcut_report_test_done_unparsed(pcut_item_t *test, int outcome,
    215                 const char *unparsed_output, size_t unparsed_output_size) {
     223    const char *unparsed_output, size_t unparsed_output_size)
     224{
    216225
    217226        parse_command_output(unparsed_output, unparsed_output_size,
    218                         buffer_for_extra_output, BUFFER_SIZE,
    219                         buffer_for_error_messages, BUFFER_SIZE);
     227            buffer_for_extra_output, BUFFER_SIZE,
     228            buffer_for_error_messages, BUFFER_SIZE);
    220229
    221230        pcut_report_test_done(test, outcome, buffer_for_error_messages, NULL, buffer_for_extra_output);
     
    225234 *
    226235 */
    227 void pcut_report_done(void) {
     236void pcut_report_done(void)
     237{
    228238        REPORT_CALL_NO_ARGS(done);
    229239}
  • uspace/lib/pcut/src/report/tap.c

    r47b2d7e3 r1433ecda  
    5555 * @param all_items Start of the list with all items.
    5656 */
    57 static void tap_init(pcut_item_t *all_items) {
     57static void tap_init(pcut_item_t *all_items)
     58{
    5859        int tests_total = pcut_count_tests(all_items);
    5960        test_counter = 0;
     
    6768 * @param suite Suite that just started.
    6869 */
    69 static void tap_suite_start(pcut_item_t *suite) {
     70static void tap_suite_start(pcut_item_t *suite)
     71{
    7072        tests_in_suite = 0;
    7173        failed_tests_in_suite = 0;
     
    7880 * @param suite Suite that just ended.
    7981 */
    80 static void tap_suite_done(pcut_item_t *suite) {
     82static void tap_suite_done(pcut_item_t *suite)
     83{
    8184        if (failed_tests_in_suite == 0) {
    8285                printf("#> Finished suite %s (passed).\n",
    83                                 suite->name);
     86                    suite->name);
    8487        } else {
    8588                printf("#> Finished suite %s (failed %d of %d).\n",
    86                                 suite->name, failed_tests_in_suite, tests_in_suite);
     89                    suite->name, failed_tests_in_suite, tests_in_suite);
    8790        }
    8891}
     
    9497 * @param test Test that is started.
    9598 */
    96 static void tap_test_start(pcut_item_t *test) {
     99static void tap_test_start(pcut_item_t *test)
     100{
    97101        PCUT_UNUSED(test);
    98102
     
    106110 * @param prefix Prefix for each new line, such as comment character.
    107111 */
    108 static void print_by_lines(const char *message, const char *prefix) {
     112static void print_by_lines(const char *message, const char *prefix)
     113{
    109114        char *next_line_start;
    110115        if ((message == NULL) || (message[0] == 0)) {
     
    132137 */
    133138static void tap_test_done(pcut_item_t *test, int outcome,
    134                 const char *error_message, const char *teardown_error_message,
    135                 const char *extra_output) {
     139    const char *error_message, const char *teardown_error_message,
     140    const char *extra_output)
     141{
    136142        const char *test_name = test->name;
    137143        const char *status_str = NULL;
     
    166172
    167173/** Report testing done. */
    168 static void tap_done(void) {
     174static void tap_done(void)
     175{
    169176        if (failed_test_counter == 0) {
    170177                printf("#> Done: all tests passed.\n");
  • uspace/lib/pcut/src/report/xml.c

    r47b2d7e3 r1433ecda  
    5252 * @param all_items Start of the list with all items.
    5353 */
    54 static void xml_init(pcut_item_t *all_items) {
     54static void xml_init(pcut_item_t *all_items)
     55{
    5556        int tests_total = pcut_count_tests(all_items);
    5657        test_counter = 0;
     
    6465 * @param suite Suite that just started.
    6566 */
    66 static void xml_suite_start(pcut_item_t *suite) {
     67static void xml_suite_start(pcut_item_t *suite)
     68{
    6769        tests_in_suite = 0;
    6870        failed_tests_in_suite = 0;
     
    7577 * @param suite Suite that just ended.
    7678 */
    77 static void xml_suite_done(pcut_item_t *suite) {
     79static void xml_suite_done(pcut_item_t *suite)
     80{
    7881        printf("\t</suite><!-- %s: %d / %d -->\n", suite->name,
    79                 failed_tests_in_suite, tests_in_suite);
     82            failed_tests_in_suite, tests_in_suite);
    8083}
    8184
     
    8689 * @param test Test that is started.
    8790 */
    88 static void xml_test_start(pcut_item_t *test) {
     91static void xml_test_start(pcut_item_t *test)
     92{
    8993        PCUT_UNUSED(test);
    9094
     
    98102 * @param element_name Wrapping XML element name.
    99103 */
    100 static void print_by_lines(const char *message, const char *element_name) {
     104static void print_by_lines(const char *message, const char *element_name)
     105{
    101106        char *next_line_start;
    102107
     
    130135 */
    131136static void xml_test_done(pcut_item_t *test, int outcome,
    132                 const char *error_message, const char *teardown_error_message,
    133                 const char *extra_output) {
     137    const char *error_message, const char *teardown_error_message,
     138    const char *extra_output)
     139{
    134140        const char *test_name = test->name;
    135141        const char *status_str = NULL;
     
    152158
    153159        printf("\t\t<testcase name=\"%s\" status=\"%s\">\n", test_name,
    154                 status_str);
     160            status_str);
    155161
    156162        print_by_lines(error_message, "error-message");
     
    163169
    164170/** Report testing done. */
    165 static void xml_done(void) {
     171static void xml_done(void)
     172{
    166173        printf("</report>\n");
    167174}
  • uspace/lib/pcut/src/run.c

    r47b2d7e3 r1433ecda  
    7373static int default_suite_initialized = 0;
    7474
    75 static void init_default_suite_when_needed() {
     75static void init_default_suite_when_needed()
     76{
    7677        if (default_suite_initialized) {
    7778                return;
     
    9192 * @return Always a valid test suite item.
    9293 */
    93 static pcut_item_t *pcut_find_parent_suite(pcut_item_t *it) {
     94static pcut_item_t *pcut_find_parent_suite(pcut_item_t *it)
     95{
    9496        while (it != NULL) {
    9597                if (it->kind == PCUT_KIND_TESTSUITE) {
     
    106108 * @param func Function to run (can be NULL).
    107109 */
    108 static void run_setup_teardown(pcut_setup_func_t func) {
     110static void run_setup_teardown(pcut_setup_func_t func)
     111{
    109112        if (func != NULL) {
    110113                func();
     
    119122 * @param outcome Outcome of the current test.
    120123 */
    121 static void leave_test(int outcome) {
     124static void leave_test(int outcome)
     125{
    122126        PCUT_DEBUG("leave_test(outcome=%d), will_exit=%s", outcome,
    123                 leave_means_exit ? "yes" : "no");
     127            leave_means_exit ? "yes" : "no");
    124128        if (leave_means_exit) {
    125129                exit(outcome);
     
    138142 * @param message Message describing the failure.
    139143 */
    140 void pcut_failed_assertion(const char *message) {
     144void pcut_failed_assertion(const char *message)
     145{
    141146        static const char *prev_message = NULL;
    142147        /*
     
    157162                if (report_test_result) {
    158163                        pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
    159                                 message, NULL, NULL);
     164                            message, NULL, NULL);
    160165                }
    161166        } else {
    162167                if (report_test_result) {
    163168                        pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
    164                                 prev_message, message, NULL);
     169                            prev_message, message, NULL);
    165170                }
    166171        }
     
    176181 * @return Error status (zero means success).
    177182 */
    178 static int run_test(pcut_item_t *test) {
     183static int run_test(pcut_item_t *test)
     184{
    179185        /*
    180186         * Set here as the returning point in case of test failure.
     
    228234        if (report_test_result) {
    229235                pcut_report_test_done(current_test, PCUT_OUTCOME_PASS,
    230                         NULL, NULL, NULL);
     236                    NULL, NULL, NULL);
    231237        }
    232238
     
    242248 * @return Error status (zero means success).
    243249 */
    244 int pcut_run_test_forked(pcut_item_t *test) {
     250int pcut_run_test_forked(pcut_item_t *test)
     251{
    245252        int rc;
    246253
     
    265272 * @return Error status (zero means success).
    266273 */
    267 int pcut_run_test_single(pcut_item_t *test) {
     274int pcut_run_test_single(pcut_item_t *test)
     275{
    268276        int rc;
    269277
     
    285293 * @return Timeout in seconds.
    286294 */
    287 int pcut_get_test_timeout(pcut_item_t *test) {
     295int pcut_get_test_timeout(pcut_item_t *test)
     296{
    288297        int timeout = PCUT_DEFAULT_TEST_TIMEOUT;
    289298        pcut_extra_t *extras = test->extras;
Note: See TracChangeset for help on using the changeset viewer.