<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style></head>
<body>
<body><p dir="ltr">Why is this in sapi and not in test support?</p><div class="quote">On Mar 10, 2014 10:35 AM, Sebastian Huber <sebastian.huber@embedded-brains.de> wrote:<br type="attribution"></div></body>
<font size="2"><div class="PlainText">Provide support functions to print the begin/end of test message.<br>
Provide a test fatal extension to print out profiling reports in the<br>
future.<br>
---<br>
 cpukit/sapi/Makefile.am                     |    3 +<br>
 cpukit/sapi/include/rtems/test.h            |  125 +++++++++++++++++++++++++++<br>
 cpukit/sapi/preinstall.am                   |    4 +<br>
 cpukit/sapi/src/testbeginend.c              |   43 +++++++++<br>
 cpukit/sapi/src/testextension.c             |   30 +++++++<br>
 testsuites/support/include/buffer_test_io.h |   16 ++++<br>
 6 files changed, 221 insertions(+), 0 deletions(-)<br>
 create mode 100644 cpukit/sapi/include/rtems/test.h<br>
 create mode 100644 cpukit/sapi/src/testbeginend.c<br>
 create mode 100644 cpukit/sapi/src/testextension.c<br>
<br>
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am<br>
index 19f7d87..37a2fa4 100644<br>
--- a/cpukit/sapi/Makefile.am<br>
+++ b/cpukit/sapi/Makefile.am<br>
@@ -18,6 +18,7 @@ include_rtems_HEADERS += include/rtems/profiling.h<br>
 include_rtems_HEADERS += include/rtems/rbheap.h<br>
 include_rtems_HEADERS += include/rtems/rbtree.h<br>
 include_rtems_HEADERS += include/rtems/sptables.h<br>
+include_rtems_HEADERS += include/rtems/test.h<br>
 include_rtems_HEADERS += include/rtems/timespec.h<br>
 <br>
 EXTRA_DIST = include/rtems/README<br>
@@ -39,6 +40,8 @@ libsapi_a_SOURCES += src/delayticks.c<br>
 libsapi_a_SOURCES += src/delaynano.c<br>
 libsapi_a_SOURCES += src/profilingiterate.c<br>
 libsapi_a_SOURCES += src/profilingreportxml.c<br>
+libsapi_a_SOURCES += src/testbeginend.c<br>
+libsapi_a_SOURCES += src/testextension.c<br>
 libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)<br>
 <br>
 include $(srcdir)/preinstall.am<br>
diff --git a/cpukit/sapi/include/rtems/test.h b/cpukit/sapi/include/rtems/test.h<br>
new file mode 100644<br>
index 0000000..91a5a22<br>
--- /dev/null<br>
+++ b/cpukit/sapi/include/rtems/test.h<br>
@@ -0,0 +1,125 @@<br>
+/*<br>
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.<br>
+ *<br>
+ *  embedded brains GmbH<br>
+ *  Dornierstr. 4<br>
+ *  82178 Puchheim<br>
+ *  Germany<br>
+ *  <rtems@embedded-brains.de><br>
+ *<br>
+ * The license and distribution terms for this file may be<br>
+ * found in the file LICENSE in this distribution or at<br>
+ * <a href="http://www.rtems.com/license/LICENSE">http://www.rtems.com/license/LICENSE</a>.<br>
+ */<br>
+<br>
+#ifndef _RTEMS_TEST_H<br>
+#define _RTEMS_TEST_H<br>
+<br>
+#include <rtems.h><br>
+#include <rtems/bspIo.h><br>
+<br>
+#ifdef __cplusplus<br>
+extern "C" {<br>
+#endif /* __cplusplus */<br>
+<br>
+/**<br>
+ * @defgroup RTEMSTest Test Support<br>
+ *<br>
+ * @brief Test support functions.<br>
+ *<br>
+ * @{<br>
+ */<br>
+<br>
+/**<br>
+ * @brief Each test must define a test name string.<br>
+ */<br>
+extern const char rtems_test_name[];<br>
+<br>
+/**<br>
+ * @brief Fatal extension for tests.<br>
+ */<br>
+void rtems_test_fatal_extension(<br>
+  rtems_fatal_source source,<br>
+  bool is_internal,<br>
+  rtems_fatal_code code<br>
+);<br>
+<br>
+/**<br>
+ * @brief Initial extension for tests.<br>
+ */<br>
+#define RTEMS_TEST_INITIAL_EXTENSION \<br>
+  { NULL, NULL, NULL, NULL, NULL, NULL, NULL, rtems_test_fatal_extension }<br>
+<br>
+/**<br>
+ * @brief Prints a begin of test message.<br>
+ *<br>
+ * @param[in] printf_func The formatted output function.<br>
+ * @param[in, out] printf_arg The formatted output function argument.<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+int rtems_test_begin_with_plugin(<br>
+  rtems_printk_plugin_t printf_func,<br>
+  void *printf_arg<br>
+);<br>
+<br>
+/**<br>
+ * @brief Prints a begin of test message using printf().<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+static inline int rtems_test_begin(void)<br>
+{<br>
+  return rtems_test_begin_with_plugin(rtems_printf_plugin, NULL);<br>
+}<br>
+<br>
+/**<br>
+ * @brief Prints a begin of test message using printk().<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+static inline int rtems_test_begink(void)<br>
+{<br>
+  return rtems_test_begin_with_plugin(printk_plugin, NULL);<br>
+}<br>
+<br>
+/**<br>
+ * @brief Prints an end of test message.<br>
+ *<br>
+ * @param[in] printf_func The formatted output function.<br>
+ * @param[in, out] printf_arg The formatted output function argument.<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+int rtems_test_end_with_plugin(<br>
+  rtems_printk_plugin_t printf_func,<br>
+  void *printf_arg<br>
+);<br>
+<br>
+/**<br>
+ * @brief Prints an end of test message using printf().<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+static inline int rtems_test_end(void)<br>
+{<br>
+  return rtems_test_end_with_plugin(rtems_printf_plugin, NULL);<br>
+}<br>
+<br>
+/**<br>
+ * @brief Prints an end of test message using printk().<br>
+ *<br>
+ * @returns As specified by printf().<br>
+ */<br>
+static inline int rtems_test_endk(void)<br>
+{<br>
+  return rtems_test_end_with_plugin(printk_plugin, NULL);<br>
+}<br>
+<br>
+/** @} */<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif /* __cplusplus */<br>
+<br>
+#endif /* _RTEMS_TEST_H */<br>
diff --git a/cpukit/sapi/preinstall.am b/cpukit/sapi/preinstall.am<br>
index d05ab25..7e18d3a 100644<br>
--- a/cpukit/sapi/preinstall.am<br>
+++ b/cpukit/sapi/preinstall.am<br>
@@ -88,6 +88,10 @@ $(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)<br>
         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h<br>
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sptables.h<br>
 <br>
+$(PROJECT_INCLUDE)/rtems/test.h: include/rtems/test.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)<br>
+       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/test.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/test.h<br>
+<br>
 $(PROJECT_INCLUDE)/rtems/timespec.h: include/rtems/timespec.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)<br>
         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/timespec.h<br>
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timespec.h<br>
diff --git a/cpukit/sapi/src/testbeginend.c b/cpukit/sapi/src/testbeginend.c<br>
new file mode 100644<br>
index 0000000..dac0763<br>
--- /dev/null<br>
+++ b/cpukit/sapi/src/testbeginend.c<br>
@@ -0,0 +1,43 @@<br>
+/*<br>
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.<br>
+ *<br>
+ *  embedded brains GmbH<br>
+ *  Dornierstr. 4<br>
+ *  82178 Puchheim<br>
+ *  Germany<br>
+ *  <rtems@embedded-brains.de><br>
+ *<br>
+ * The license and distribution terms for this file may be<br>
+ * found in the file LICENSE in this distribution or at<br>
+ * <a href="http://www.rtems.com/license/LICENSE">http://www.rtems.com/license/LICENSE</a>.<br>
+ */<br>
+<br>
+#ifdef HAVE_CONFIG_H<br>
+  #include "config.h"<br>
+#endif<br>
+<br>
+#include <rtems/test.h><br>
+<br>
+int rtems_test_begin_with_plugin(<br>
+  rtems_printk_plugin_t printf_func,<br>
+  void *printf_arg<br>
+)<br>
+{<br>
+  return (*printf_func)(<br>
+    printf_arg,<br>
+    "\n\n*** BEGIN OF TEST %s ***\n",<br>
+    rtems_test_name<br>
+  );<br>
+}<br>
+<br>
+int rtems_test_end_with_plugin(<br>
+  rtems_printk_plugin_t printf_func,<br>
+  void *printf_arg<br>
+)<br>
+{<br>
+  return (*printf_func)(<br>
+    printf_arg,<br>
+    "*** END OF TEST %s ***\n",<br>
+    rtems_test_name<br>
+  );<br>
+}<br>
diff --git a/cpukit/sapi/src/testextension.c b/cpukit/sapi/src/testextension.c<br>
new file mode 100644<br>
index 0000000..a896c78<br>
--- /dev/null<br>
+++ b/cpukit/sapi/src/testextension.c<br>
@@ -0,0 +1,30 @@<br>
+/*<br>
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.<br>
+ *<br>
+ *  embedded brains GmbH<br>
+ *  Dornierstr. 4<br>
+ *  82178 Puchheim<br>
+ *  Germany<br>
+ *  <rtems@embedded-brains.de><br>
+ *<br>
+ * The license and distribution terms for this file may be<br>
+ * found in the file LICENSE in this distribution or at<br>
+ * <a href="http://www.rtems.com/license/LICENSE">http://www.rtems.com/license/LICENSE</a>.<br>
+ */<br>
+<br>
+#ifdef HAVE_CONFIG_H<br>
+  #include "config.h"<br>
+#endif<br>
+<br>
+#include <rtems/test.h><br>
+<br>
+void rtems_test_fatal_extension(<br>
+  rtems_fatal_source source,<br>
+  bool is_internal,<br>
+  rtems_fatal_code code<br>
+)<br>
+{<br>
+  (void) source;<br>
+  (void) is_internal;<br>
+  (void) code;<br>
+}<br>
diff --git a/testsuites/support/include/buffer_test_io.h b/testsuites/support/include/buffer_test_io.h<br>
index 03d5419..3cadc48 100644<br>
--- a/testsuites/support/include/buffer_test_io.h<br>
+++ b/testsuites/support/include/buffer_test_io.h<br>
@@ -5,6 +5,8 @@<br>
 #ifndef __BUFFER_TEST_IO_h<br>
 #define __BUFFER_TEST_IO_h<br>
 <br>
+#include <rtems/test.h><br>
+<br>
 #ifdef __cplusplus<br>
 extern "C" {<br>
 #endif<br>
@@ -54,6 +56,10 @@ extern "C" {<br>
     do { \<br>
     } while (0)<br>
 <br>
+  #define TEST_BEGIN() rtems_test_begink()<br>
+<br>
+  #define TEST_END() rtems_test_endk()<br>
+<br>
 /*<br>
  *  BUFFER TEST OUTPUT<br>
  */<br>
@@ -152,6 +158,10 @@ extern "C" {<br>
       fflush(stdout); \<br>
     } while (0)<br>
 <br>
+  #define TEST_BEGIN() rtems_test_begin()<br>
+<br>
+  #define TEST_END() rtems_test_end()<br>
+<br>
 /*<br>
  *  USE IPRINT<br>
  */<br>
@@ -197,6 +207,12 @@ extern "C" {<br>
       fflush(stdout); \<br>
     } while (0)<br>
 <br>
+  #define TEST_BEGIN() \<br>
+    rtems_test_begin_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)<br>
+<br>
+  #define TEST_END() \<br>
+    rtems_test_end_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)<br>
+<br>
 #endif<br>
 <br>
 #ifdef __cplusplus<br>
-- <br>
1.7.7<br>
<br>
_______________________________________________<br>
rtems-devel mailing list<br>
rtems-devel@rtems.org<br>
<a href="http://www.rtems.org/mailman/listinfo/rtems-devel">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
</div></font>
</body>
</html>