Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:21

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSTestFrameworkImpl
0007  *
0008  * @brief This source file contains the implementation of
0009  *   rtems_test_begin() and rtems_test_end().
0010  */
0011 
0012 /*
0013  * Copyright (C) 2014, 2018 embedded brains GmbH & Co. KG
0014  *
0015  * Copyright (c) 2017 Chris Johns <chrisj@rtems.org>. All rights reserved.
0016  *
0017  * Redistribution and use in source and binary forms, with or without
0018  * modification, are permitted provided that the following conditions
0019  * are met:
0020  * 1. Redistributions of source code must retain the above copyright
0021  *    notice, this list of conditions and the following disclaimer.
0022  * 2. Redistributions in binary form must reproduce the above copyright
0023  *    notice, this list of conditions and the following disclaimer in the
0024  *    documentation and/or other materials provided with the distribution.
0025  *
0026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0027  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0029  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0030  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0031  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0032  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0033  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0034  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0036  * POSSIBILITY OF SUCH DAMAGE.
0037  */
0038 
0039 #ifdef HAVE_CONFIG_H
0040 #include "config.h"
0041 #endif
0042 
0043 #include <rtems/test-info.h>
0044 #include <rtems/test-printer.h>
0045 #include <rtems/version.h>
0046 
0047 static const char* const test_state_strings[] =
0048 {
0049   "EXPECTED_PASS",
0050   "EXPECTED_FAIL",
0051   "USER_INPUT",
0052   "INDETERMINATE",
0053   "BENCHMARK"
0054 };
0055 
0056 int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state)
0057 {
0058   return rtems_printf(
0059     &rtems_test_printer,
0060     "\n\n*** BEGIN OF TEST %s ***\n"
0061     "*** TEST VERSION: %s\n"
0062     "*** TEST STATE: %s\n"
0063     "*** TEST BUILD:"
0064 #if RTEMS_DEBUG
0065     " RTEMS_DEBUG"
0066 #endif
0067 #if RTEMS_MULTIPROCESSING
0068     " RTEMS_MULTIPROCESSING"
0069 #endif
0070 #if RTEMS_NETWORKING
0071     " RTEMS_NETWORKING"
0072 #endif
0073 #if RTEMS_PARAVIRT
0074     " RTEMS_PARAVIRT"
0075 #endif
0076 #if RTEMS_POSIX_API
0077     " RTEMS_POSIX_API"
0078 #endif
0079 #if RTEMS_PROFILING
0080     " RTEMS_PROFILING"
0081 #endif
0082 #if RTEMS_SMP
0083     " RTEMS_SMP"
0084 #endif
0085     "\n"
0086     "*** TEST TOOLS: " __VERSION__ "\n",
0087     name,
0088     rtems_version(),
0089     test_state_strings[state]
0090   );
0091 }
0092 
0093 int rtems_test_end(const char* name)
0094 {
0095   return rtems_printf(
0096     &rtems_test_printer,
0097     "\n*** END OF TEST %s ***\n\n", name
0098   );
0099 }