[PATCH] tests: Use <tmacros.h> in all tests

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Nov 6 06:59:09 UTC 2017


Update #3170.
Update #3199.
---
 testsuites/libtests/complex/Makefile.am |  2 ++
 testsuites/libtests/complex/init.c      | 15 ++++++---------
 testsuites/libtests/math/Makefile.am    |  2 ++
 testsuites/libtests/math/init.c         | 15 ++++-----------
 testsuites/libtests/mathf/Makefile.am   |  2 ++
 testsuites/libtests/mathf/init.c        | 15 ++++++---------
 testsuites/libtests/mathl/Makefile.am   |  2 ++
 testsuites/libtests/mathl/init.c        |  6 ++++--
 testsuites/samples/capture/Makefile.am  |  1 +
 testsuites/samples/capture/init.c       | 14 ++++----------
 testsuites/samples/hello/Makefile.am    |  1 +
 testsuites/samples/hello/init.c         | 20 ++++++--------------
 testsuites/samples/loopback/Makefile.am |  1 +
 testsuites/samples/loopback/init.c      | 33 +++------------------------------
 testsuites/samples/paranoia/Makefile.am |  2 ++
 testsuites/samples/paranoia/init.c      |  8 ++++----
 testsuites/samples/pppd/init.c          |  5 +++--
 testsuites/smptests/smp05/init.c        |  4 ++--
 testsuites/smptests/smp07/init.c        |  4 ++--
 19 files changed, 57 insertions(+), 95 deletions(-)

diff --git a/testsuites/libtests/complex/Makefile.am b/testsuites/libtests/complex/Makefile.am
index 7861d4a437..a992d68079 100644
--- a/testsuites/libtests/complex/Makefile.am
+++ b/testsuites/libtests/complex/Makefile.am
@@ -12,6 +12,8 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
 if HAS_COMPLEX
 complex_LDADD = -lm
 
diff --git a/testsuites/libtests/complex/init.c b/testsuites/libtests/complex/init.c
index 58e2549bf2..185b38f8f3 100644
--- a/testsuites/libtests/complex/init.c
+++ b/testsuites/libtests/complex/init.c
@@ -22,13 +22,6 @@
 #include "config.h"
 #endif
 
-#if __rtems__
-#include <bsp.h> /* for device driver prototypes */
-#include <rtems/test.h>
-
-const char rtems_test_name[] = "COMPLEX";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -37,6 +30,10 @@ extern void docomplexf(void);
 extern void docomplexl(void);
 
 #if __rtems__
+#include <tmacros.h>
+
+const char rtems_test_name[] = "COMPLEX";
+
 /* NOTICE: the clock driver is explicitly disabled */
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
@@ -60,14 +57,14 @@ int main( void )
 {
 #if __rtems__
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
 #endif
 
   docomplex();
   docomplexf();
   docomplexl();
 #if __rtems__
-  rtems_test_end();
+  TEST_END();
 #endif
   exit( 0 );
 }
diff --git a/testsuites/libtests/math/Makefile.am b/testsuites/libtests/math/Makefile.am
index 835bd931a5..ec5c327d24 100644
--- a/testsuites/libtests/math/Makefile.am
+++ b/testsuites/libtests/math/Makefile.am
@@ -7,6 +7,8 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
 math_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/math
 math_LDADD = -lm
 
diff --git a/testsuites/libtests/math/init.c b/testsuites/libtests/math/init.c
index f8c9649e8e..824644f03d 100644
--- a/testsuites/libtests/math/init.c
+++ b/testsuites/libtests/math/init.c
@@ -22,23 +22,16 @@
 #include "config.h"
 #endif
 
-/*
- * @fixme This test should use the test macros but the include paths are
- *        are wrong in the build system.
- */
-#if __rtems__
-#include <bsp.h> /* for device driver prototypes */
-#include <rtems/test.h>
-
-const char rtems_test_name[] = "MATH";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
 extern void domath(void);
 
 #if __rtems__
+#include <tmacros.h>
+
+const char rtems_test_name[] = "MATH";
+
 /* NOTICE: the clock driver is explicitly disabled */
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
diff --git a/testsuites/libtests/mathf/Makefile.am b/testsuites/libtests/mathf/Makefile.am
index e4bd7ba10c..f17f17c450 100644
--- a/testsuites/libtests/mathf/Makefile.am
+++ b/testsuites/libtests/mathf/Makefile.am
@@ -7,6 +7,8 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
 mathf_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/math
 mathf_LDADD = -lm
 
diff --git a/testsuites/libtests/mathf/init.c b/testsuites/libtests/mathf/init.c
index 333c038221..143ac63f1a 100644
--- a/testsuites/libtests/mathf/init.c
+++ b/testsuites/libtests/mathf/init.c
@@ -22,19 +22,16 @@
 #include "config.h"
 #endif
 
-#if __rtems__
-#include <bsp.h> /* for device driver prototypes */
-#include <rtems/test.h>
-
-const char rtems_test_name[] = "MATHF";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
 extern void domathf(void);
 
 #if __rtems__
+#include <tmacros.h>
+
+const char rtems_test_name[] = "MATHF";
+
 /* NOTICE: the clock driver is explicitly disabled */
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
@@ -60,13 +57,13 @@ int main( void )
 {
 #if __rtems__
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
 #endif
 
   domathf();
 
 #if __rtems__
-  rtems_test_end();
+  TEST_END();
 #endif
   exit( 0 );
 }
diff --git a/testsuites/libtests/mathl/Makefile.am b/testsuites/libtests/mathl/Makefile.am
index b7a823460c..9dba9a115d 100644
--- a/testsuites/libtests/mathl/Makefile.am
+++ b/testsuites/libtests/mathl/Makefile.am
@@ -12,6 +12,8 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
 mathl_LDADD = -lm
 
 LINK_OBJS = $(mathl_OBJECTS) $(mathl_LDADD)
diff --git a/testsuites/libtests/mathl/init.c b/testsuites/libtests/mathl/init.c
index 4bb3b08c7f..af5eb9b4a5 100644
--- a/testsuites/libtests/mathl/init.c
+++ b/testsuites/libtests/mathl/init.c
@@ -35,6 +35,8 @@ const char rtems_test_name[] = "MATHL";
 extern void domathl(void);
 
 #if __rtems__
+#include <tmacros.h>
+
 /* NOTICE: the clock driver is explicitly disabled */
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
@@ -60,13 +62,13 @@ int main( void )
 {
 #if __rtems__
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
 #endif
 
   domathl();
 
 #if __rtems__
-  rtems_test_end();
+  TEST_END();
 #endif
   exit( 0 );
 }
diff --git a/testsuites/samples/capture/Makefile.am b/testsuites/samples/capture/Makefile.am
index 17a1e68cf8..097873bd81 100644
--- a/testsuites/samples/capture/Makefile.am
+++ b/testsuites/samples/capture/Makefile.am
@@ -9,6 +9,7 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
 LINK_OBJS = $(capture_OBJECTS)
 LINK_LIBS = $(capture_LDLIBS)
diff --git a/testsuites/samples/capture/init.c b/testsuites/samples/capture/init.c
index 3f2bc848b1..e87a7beae6 100644
--- a/testsuites/samples/capture/init.c
+++ b/testsuites/samples/capture/init.c
@@ -14,17 +14,12 @@
 #endif
 
 #include "system.h"
-#include <stdio.h>
-#include <stdlib.h>
 
 #include <rtems.h>
 #include <rtems/capture-cli.h>
 #include <rtems/monitor.h>
 #include <rtems/shell.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-static void notification(int fd, int seconds_remaining, void *arg);
+#include <tmacros.h>
 
 const char rtems_test_name[] = "CAPTURE ENGINE";
 
@@ -47,7 +42,7 @@ rtems_task Init(
   rtems_mode          old_mode;
 
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
 
   status = rtems_shell_wait_for_input(
     STDIN_FILENO,
@@ -74,8 +69,7 @@ rtems_task Init(
 
     rtems_task_delete (RTEMS_SELF);
   } else {
-    rtems_test_end();
-
-    exit( 0 );
+    TEST_END();
+    rtems_test_exit( 0 );
   }
 }
diff --git a/testsuites/samples/hello/Makefile.am b/testsuites/samples/hello/Makefile.am
index 234a27e3ba..a3e571b488 100644
--- a/testsuites/samples/hello/Makefile.am
+++ b/testsuites/samples/hello/Makefile.am
@@ -9,6 +9,7 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
 LINK_OBJS = $(hello_OBJECTS)
 LINK_LIBS = $(hello_LDLIBS)
diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
index 3f3dcd8d58..34ded37c55 100644
--- a/testsuites/samples/hello/init.c
+++ b/testsuites/samples/hello/init.c
@@ -11,28 +11,20 @@
 #include "config.h"
 #endif
 
-#include <rtems/printer.h>
-#include <rtems/test.h>
-
-#include <bsp.h> /* for device driver prototypes */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
+#include <rtems.h>
+#include <tmacros.h>
 
 const char rtems_test_name[] = "HELLO WORLD";
 
-rtems_task Init(
+static rtems_task Init(
   rtems_task_argument ignored
 )
 {
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
   printf( "Hello World\n" );
-  rtems_test_end();
-  exit( 0 );
+  TEST_END();
+  rtems_test_exit( 0 );
 }
 
 
diff --git a/testsuites/samples/loopback/Makefile.am b/testsuites/samples/loopback/Makefile.am
index f104c0f491..d0cebb989f 100644
--- a/testsuites/samples/loopback/Makefile.am
+++ b/testsuites/samples/loopback/Makefile.am
@@ -8,6 +8,7 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
 LINK_OBJS = $(loopback_OBJECTS)
 LINK_LIBS = $(loopback_LDLIBS)
diff --git a/testsuites/samples/loopback/init.c b/testsuites/samples/loopback/init.c
index 0ba3e65a39..d537731bba 100644
--- a/testsuites/samples/loopback/init.c
+++ b/testsuites/samples/loopback/init.c
@@ -8,9 +8,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/test.h>
-
-#include <bsp.h>
+#include <tmacros.h>
 
 const char rtems_test_name[] = "LOOPBACK";
 
@@ -75,21 +73,6 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
 };
 
 /*
- * Thread-safe output routines
- */
-static rtems_id printMutex;
-static void printSafe(const char *fmt, ...)
-{
-    va_list args;
-    va_start(args, fmt);
-    rtems_semaphore_obtain(printMutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-    vprintf(fmt, args);
-    rtems_semaphore_release(printMutex);
-    va_end(args);
-}
-#define printf printSafe
-
-/*
  * Spawn a task
  */
 static void spawnTask(rtems_task_entry entryPoint, rtems_task_priority priority, rtems_task_argument arg)
@@ -246,20 +229,10 @@ static rtems_task clientTask(rtems_task_argument arg)
 rtems_task
 Init (rtems_task_argument ignored)
 {
-    rtems_status_code sc;
-
     rtems_print_printer_fprintf_putc(&rtems_test_printer);
 
-    rtems_test_begin();
+    TEST_BEGIN();
 
-    sc = rtems_semaphore_create(rtems_build_name('P','m','t','x'),
-                1,
-                RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|
-                                    RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL,
-                0,
-                &printMutex);
-    if (sc != RTEMS_SUCCESSFUL)
-        rtems_panic("Can't create printf mutex:", rtems_status_text(sc));
     printf("\"Network\" initializing!\n");
     rtems_bsdnet_initialize_network();
     printf("\"Network\" initialized!\n");
@@ -286,6 +259,6 @@ Init (rtems_task_argument ignored)
     spawnTask(clientTask, 120, 6);
 
     rtems_task_wake_after(500);
-    rtems_test_end();
+    TEST_END();
     exit( 0 );
 }
diff --git a/testsuites/samples/paranoia/Makefile.am b/testsuites/samples/paranoia/Makefile.am
index 36e6bbb9d9..40c216ae3a 100644
--- a/testsuites/samples/paranoia/Makefile.am
+++ b/testsuites/samples/paranoia/Makefile.am
@@ -9,6 +9,8 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
 
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
 #  -DCYGNUS   turns on more verbose msgs
 AM_CPPFLAGS += -DNOSIGNAL -DCYGNUS -DNOMAIN
 
diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c
index c5110e2722..f2420baaf6 100644
--- a/testsuites/samples/paranoia/init.c
+++ b/testsuites/samples/paranoia/init.c
@@ -14,7 +14,7 @@
 #define CONFIGURE_INIT
 #include "system.h"
 #include <stdio.h>
-#include <stdlib.h> /* exit */
+#include <tmacros.h>
 
 extern int paranoia(int, char **);
 
@@ -36,8 +36,8 @@ rtems_task Init(
 #endif
 
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
-  rtems_test_begin();
+  TEST_BEGIN();
   paranoia(1, args);
-  rtems_test_end();
-  exit( 0 );
+  TEST_END();
+  rtems_test_exit( 0 );
 }
diff --git a/testsuites/samples/pppd/init.c b/testsuites/samples/pppd/init.c
index 1661e558ba..6e04c344de 100644
--- a/testsuites/samples/pppd/init.c
+++ b/testsuites/samples/pppd/init.c
@@ -22,6 +22,7 @@
 #include <rtems/rtemspppd.h>
 #include <rtems/shell.h>
 #include "netconfig.h"
+#include <tmacros.h>
 
 const char rtems_test_name[] = "PPPD";
 
@@ -39,7 +40,7 @@ rtems_task Init(rtems_task_argument argument)
 
   rtems_print_printer_fprintf_putc(&rtems_test_printer);
 
-  rtems_test_begin();
+  TEST_BEGIN();
 
   status = rtems_shell_wait_for_input(
     STDIN_FILENO,
@@ -48,7 +49,7 @@ rtems_task Init(rtems_task_argument argument)
     NULL
   );
   if (status != RTEMS_SUCCESSFUL) {
-    rtems_test_end();
+    TEST_END();
     exit( 0 );
   }
 
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index 6da5232780..7988861983 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -27,7 +27,7 @@ rtems_task Test_task(
 
 static void success(void)
 {
-  rtems_test_end();
+  TEST_END();
   rtems_test_exit( 0 );
 }
 
@@ -50,7 +50,7 @@ rtems_task Init(
   rtems_status_code  status;
 
   locked_print_initialize();
-  rtems_test_begin();
+  TEST_BEGIN();
 
   if ( rtems_get_processor_count() == 1 ) {
     success();
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index fe856c9d41..1e356edc93 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -30,7 +30,7 @@ rtems_task Test_task(
 
 static void success(void)
 {
-  rtems_test_end( );
+  TEST_END( );
   rtems_test_exit( 0 );
 }
 
@@ -98,7 +98,7 @@ rtems_task Init(
   rtems_id           Timer;
 
   locked_print_initialize();
-  rtems_test_begin();
+  TEST_BEGIN();
 
   if ( rtems_get_processor_count() == 1 ) {
     success();
-- 
2.12.3



More information about the devel mailing list