Changeset 24d0ee57 in rtems for testsuites/support


Ignore:
Timestamp:
May 20, 2016, 8:39:50 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
1503c1c3
Parents:
b1860df5
git-author:
Chris Johns <chrisj@…> (05/20/16 08:39:50)
git-committer:
Chris Johns <chrisj@…> (05/25/16 05:47:34)
Message:

cpukit, testsuite: Add rtems_printf and rtems_printer support.

This change adds rtems_printf and related functions and wraps the
RTEMS print plugin support into a user API. All references to the
plugin are removed and replaced with the rtems_printer interface.

Printk and related functions are made to return a valid number of
characters formatted and output.

The function attribute to check printf functions has been added
to rtems_printf and printk. No changes to remove warrnings are part
of this patch set.

The testsuite has been moved over to the rtems_printer. The testsuite
has a mix of rtems_printer access and direct print control via the
tmacros.h header file. The support for begink/endk has been removed
as it served no purpose and only confused the code base. The testsuite
has not been refactored to use rtems_printf. This is future work.

Location:
testsuites/support
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/support/include/buffer_test_io.h

    rb1860df5 r24d0ee57  
    2525#if defined(TESTS_USE_PRINTK)
    2626
    27 #include <rtems/bspIo.h>
     27#include <rtems/print.h>
    2828
    2929  #undef printf
     
    5555    } while (0)
    5656
    57   #define TEST_BEGIN() rtems_test_begink()
    58 
    59   #define TEST_END() rtems_test_endk()
     57  #define TEST_BEGIN() printk(TEST_BEGIN_STRING)
     58
     59  #define TEST_END() printk(TEST_END_STRING)
    6060
    6161/*
     
    157157    } while (0)
    158158
    159   #define TEST_BEGIN() rtems_test_begin()
    160 
    161   #define TEST_END() rtems_test_end()
     159  #define TEST_BEGIN() printf(TEST_BEGIN_STRING)
     160
     161  #define TEST_END() printf(TEST_END_STRING)
    162162
    163163/*
     
    206206    } while (0)
    207207
    208   #define TEST_BEGIN() \
    209     rtems_test_begin_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)
    210 
    211   #define TEST_END() \
    212     rtems_test_end_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)
     208  #define TEST_BEGIN() fiprintf( stderr, TEST_BEGIN_STRING)
     209
     210  #define TEST_END()  fiprintf( stderr, TEST_END_STRING)
    213211
    214212#endif
  • testsuites/support/include/test_support.h

    rb1860df5 r24d0ee57  
    7575int locked_vprintf(const char *fmt, va_list ap);
    7676
    77 int locked_printf_plugin(void *context, const char *fmt, ...);
    78 
    7977void locked_printk(const char *fmt, ...);
    8078
  • testsuites/support/src/locked_print.c

    rb1860df5 r24d0ee57  
    1 /* 
     1/*
    22 *  COPYRIGHT (c) 1989-2011.
    33 *  On-Line Applications Research Corporation (OAR).
     
    1515#include "tmacros.h"
    1616
    17 static rtems_id locked_print_semaphore;      /* synchronisation semaphore */
     17static rtems_id locked_print_semaphore;      /* synchronisation semaphore */
     18
     19rtems_printer rtems_test_printer;
     20
     21static int locked_printf_plugin(void *context, const char *fmt, ...)
     22{
     23  int rv;
     24  va_list ap;
     25
     26  (void) context;
     27
     28  va_start(ap, fmt);
     29  rv = locked_vprintf(fmt, ap);
     30  va_end(ap);
     31
     32  return rv;
     33}
    1834
    1935void locked_print_initialize(void)
     
    3046  sc = rtems_semaphore_create(
    3147    rtems_build_name ('S', 'E', 'M', '1'),
    32     1,                                             
     48    1,
    3349    RTEMS_LOCAL                   |
    3450    RTEMS_BINARY_SEMAPHORE |
     
    3955  );
    4056  directive_failed( sc, "rtems_semaphore_create" );
     57
     58  /*
     59   * Set up the printer to use the locked printf printer.
     60   */
     61  rtems_test_printer.context = NULL;
     62  rtems_test_printer.context = locked_printf_plugin;
    4163}
    4264
     
    5779  /* Release the semaphore  */
    5880  rtems_semaphore_release( locked_print_semaphore );
    59 
    60   return rv;
    61 }
    62 
    63 int locked_printf_plugin(void *context, const char *fmt, ...)
    64 {
    65   int rv;
    66   va_list ap;
    67 
    68   (void) context;
    69 
    70   va_start(ap, fmt);
    71   rv = locked_vprintf(fmt, ap);
    72   va_end(ap);
    7381
    7482  return rv;
Note: See TracChangeset for help on using the changeset viewer.