Ignore:
Timestamp:
Nov 7, 2017, 9:25:36 PM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
5, master
Children:
e6df806
Parents:
a6bf052
git-author:
Chris Johns <chrisj@…> (11/07/17 21:25:36)
git-committer:
Chris Johns <chrisj@…> (11/11/17 05:14:59)
Message:

tests: Use rtems_test_begin and rtems_test_end.

Add a tests enum and move all test banner test to the library in libmisc.

Update #3199.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/testsupport/testbeginend.c

    ra6bf052 rbcd0c06c  
    77 *  Germany
    88 *  <rtems@embedded-brains.de>
     9 *
     10 * Copyright (c) 2017 Chris Johns <chrisj@rtems.org>. All rights reserved.
    911 *
    1012 * The license and distribution terms for this file may be
     
    1921#include <rtems/test.h>
    2022#include <rtems/bspIo.h>
     23#include <rtems/version.h>
     24
     25#define TEST_BUILD_DEFAULT "default"
     26#if RTEMS_POSIX
     27  #define TEST_BUILD_DEFAULT ""
     28  #define TEST_BUILD_POSIX   "posix "
     29#else
     30  #define TEST_BUILD_POSIX
     31#endif
     32#if RTEMS_SMP
     33  #define TEST_BUILD_DEFAULT ""
     34  #define TEST_BUILD_SMP     "smp "
     35#else
     36  #define TEST_BUILD_SMP
     37#endif
     38#if RTEMS_MULTIPROCESSING
     39  #define TEST_BUILD_DEFAULT ""
     40  #define TEST_BUILD_MP      "mp "
     41#else
     42  #define TEST_BUILD_MP
     43#endif
     44#if RTEMS_PARAVIRT
     45  #define TEST_BUILD_DEFAULT  ""
     46  #define TEST_BUILD_PARAVIRT "paravirt "
     47#else
     48  #define TEST_BUILD_PARAVIRT
     49#endif
     50#if RTEMS_NETWORKING
     51  #define TEST_BUILD_DEFAULT    ""
     52  #define TEST_BUILD_NETWORKING "legacy-net "
     53#else
     54  #define TEST_BUILD_NETWORKING
     55#endif
     56#if RTEMS_DEBUG
     57  #define TEST_BUILD_DEFAULT ""
     58  #define TEST_BUILD_DEBUG   "debug "
     59#else
     60  #define TEST_BUILD_DEBUG
     61#endif
     62#if RTEMS_PROFILING
     63  #define TEST_BUILD_DEFAULT   ""
     64  #define TEST_BUILD_PROFILING "profiling "
     65#else
     66  #define TEST_BUILD_PROFILING
     67#endif
     68
     69#define TEST_BUILD_STRING \
     70         TEST_BUILD_DEFAULT \
     71         TEST_BUILD_POSIX \
     72         TEST_BUILD_SMP \
     73         TEST_BUILD_MP \
     74         TEST_BUILD_PARAVIRT \
     75         TEST_BUILD_NETWORKING \
     76         TEST_BUILD_DEBUG \
     77         TEST_BUILD_PROFILING
    2178
    2279rtems_printer rtems_test_printer = {
     
    2481};
    2582
    26 int rtems_test_begin(void)
     83static const char* const test_state_strings[] =
     84{
     85  "EXPECTED-PASS",
     86  "EXPECTED-FAIL",
     87  "USER_INPUT",
     88  "INDETERMINATE",
     89  "BENCHMARK"
     90};
     91
     92int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state)
     93{
     94  int l;
     95  l = rtems_printf(
     96    &rtems_test_printer,
     97    "\n\n*** BEGIN OF TEST %s ***\n", name
     98  );
     99  l += rtems_printf(
     100    &rtems_test_printer,
     101    "*** TEST VERSION: %s\n", rtems_version()
     102  );
     103  l += rtems_printf(
     104    &rtems_test_printer,
     105    "*** TEST STATE: %s\n", test_state_strings[state]
     106  );
     107  l += rtems_printf(
     108    &rtems_test_printer,
     109    "*** TEST BUILD: %s\n", TEST_BUILD_STRING
     110  );
     111  l += rtems_printf(
     112    &rtems_test_printer,
     113    "*** TEST TOOLS: " __VERSION__ "\n"
     114  );
     115  return l;
     116}
     117
     118int rtems_test_end(const char* name)
    27119{
    28120  return rtems_printf(
    29121    &rtems_test_printer,
    30     TEST_BEGIN_STRING
    31   );
    32 }
    33 
    34 int rtems_test_end(void)
    35 {
    36   return rtems_printf(
    37     &rtems_test_printer,
    38     TEST_END_STRING
     122    "\n*** END OF TEST %s ***\n\n", name
    39123  );
    40124}
Note: See TracChangeset for help on using the changeset viewer.