[PATCH 1/3] testsuite: Using RTEMS tester functions at beginning and at the end of tests

Moyano, Gabriel gabriel.moyano at dlr.de
Tue Mar 31 08:57:54 UTC 2020


puts() was replaced with rtems_test_begin() and rtems_test_end()
---
 testsuite/evdev01/init.c                                | 5 ++++-
 testsuite/include/rtems/bsd/test/default-init.h         | 5 +++--
 testsuite/include/rtems/bsd/test/default-network-init.h | 5 +++--
 testsuite/include/rtems/bsd/test/default-termios-init.h | 5 +++--
 testsuite/swi01/init.c                                  | 7 +++++--
 testsuite/termios/test_main.c                           | 2 --
 testsuite/timeout01/init.c                              | 7 +++++--
 testsuite/usb01/init.c                                  | 5 ++++-
 testsuite/usbkbd01/init.c                               | 5 ++++-
 testsuite/usbmouse01/init.c                             | 5 ++++-
 testsuite/usbserial01/init.c                            | 5 ++++-
 waf_libbsd.py                                           | 2 +-
 12 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/testsuite/evdev01/init.c b/testsuite/evdev01/init.c
index 935596aa..7e55d727 100644
--- a/testsuite/evdev01/init.c
+++ b/testsuite/evdev01/init.c
@@ -39,6 +39,7 @@
 #include <rtems/console.h>
 #include <rtems/shell.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #define TEST_NAME "LIBBSD EVDEV"
 
@@ -563,7 +564,7 @@ Init(rtems_task_argument arg)
 	struct evdev_test_message msg;
 
 	(void) arg;
-	puts("*** " TEST_NAME " TEST ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_semaphore_create(
 		rtems_build_name('E', 'V', 'D', 'S'),
@@ -696,6 +697,8 @@ Init(rtems_task_argument arg)
 	sc = rtems_semaphore_delete(psema);
 	assert(sc == RTEMS_SUCCESSFUL);
 
+	rtems_test_end(TEST_NAME);
+
 	exit(0);
 }
 
diff --git a/testsuite/include/rtems/bsd/test/default-init.h b/testsuite/include/rtems/bsd/test/default-init.h
index 62e32fef..cff70cda 100644
--- a/testsuite/include/rtems/bsd/test/default-init.h
+++ b/testsuite/include/rtems/bsd/test/default-init.h
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <rtems/printer.h>
+#include <rtems/test.h>
 #include <rtems/stackchk.h>
 #include <rtems/bsd/bsd.h>
 
@@ -29,7 +30,7 @@ static void default_on_exit( int exit_code, void *arg )
   rtems_stack_checker_report_usage_with_plugin(&printer);
 
   if ( exit_code == 0 ) {
-    puts( "*** END OF TEST " TEST_NAME " ***" );
+    rtems_test_end(TEST_NAME);
   }
 }
 
@@ -44,7 +45,7 @@ rtems_task Init(
    */
   rtems_bsd_setlogpriority("debug");
 
-  puts( "*** " TEST_NAME " TEST ***" );
+  rtems_test_begin(TEST_NAME, TEST_STATE);
 
   /*
    *  BSD must support the new "shared IRQ PIC implementation" at this point.
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h b/testsuite/include/rtems/bsd/test/default-network-init.h
index 27a5fa72..4f573fe5 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -45,6 +45,7 @@
 
 #include <rtems.h>
 #include <rtems/printer.h>
+#include <rtems/test.h>
 #include <rtems/stackchk.h>
 #include <rtems/bsd/bsd.h>
 #include <rtems/bsd/modules.h>
@@ -170,7 +171,7 @@ default_network_on_exit(int exit_code, void *arg)
 	rtems_stack_checker_report_usage_with_plugin(&printer);
 
 	if (exit_code == 0) {
-		puts("*** END OF TEST " TEST_NAME " ***");
+		rtems_test_end(TEST_NAME);
 	}
 }
 
@@ -191,7 +192,7 @@ Init(rtems_task_argument arg)
 	rtems_bsd_setlogpriority("debug");
 
 	(void)arg;
-	puts("*** " TEST_NAME " TEST ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	on_exit(default_network_on_exit, NULL);
 
diff --git a/testsuite/include/rtems/bsd/test/default-termios-init.h b/testsuite/include/rtems/bsd/test/default-termios-init.h
index 16c7ad74..e60eb9c0 100644
--- a/testsuite/include/rtems/bsd/test/default-termios-init.h
+++ b/testsuite/include/rtems/bsd/test/default-termios-init.h
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <rtems/printer.h>
+#include <rtems/test.h>
 #include <rtems/stackchk.h>
 #include <rtems/bsd/bsd.h>
 
@@ -29,7 +30,7 @@ static void default_on_exit( int exit_code, void *arg )
   rtems_stack_checker_report_usage_with_plugin(&printer);
 
   if ( exit_code == 0 ) {
-    puts( "*** END OF TEST " TEST_NAME " ***" );
+    rtems_test_end(TEST_NAME);
   }
 }
 
@@ -44,7 +45,7 @@ rtems_task Init(
    */
   rtems_bsd_setlogpriority("debug");
 
-  puts( "*** " TEST_NAME " TEST ***" );
+  rtems_test_begin(TEST_NAME, TEST_STATE);
 
   /*
    *  BSD must support the new "shared IRQ PIC implementation" at this point.
diff --git a/testsuite/swi01/init.c b/testsuite/swi01/init.c
index 60e306a0..da5e4446 100644
--- a/testsuite/swi01/init.c
+++ b/testsuite/swi01/init.c
@@ -36,9 +36,12 @@
 #include <rtems.h>
 
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #include "swi_test.h"
 
+#define TEST_NAME "LIBBSD SOFTWARE INTERRUPT 1"
+
 uintptr_t rtems_bsd_allocator_domain_page_mbuf_size =
     RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE_MBUF_DEFAULT;
 
@@ -46,14 +49,14 @@ static void Init(rtems_task_argument arg)
 {
 	rtems_status_code sc;
 
-	puts("\n\n*** TEST SOFTWARE INTERRUPT 1 ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_bsd_initialize();
 	assert(sc == RTEMS_SUCCESSFUL);
 
 	swi_test();
 
-	puts("*** END OF TEST SOFTWARE INTERRUPT 1 ***");
+	rtems_test_end(TEST_NAME);
 
 	exit(0);
 }
diff --git a/testsuite/termios/test_main.c b/testsuite/termios/test_main.c
index 6a4431b9..e188ca45 100644
--- a/testsuite/termios/test_main.c
+++ b/testsuite/termios/test_main.c
@@ -700,8 +700,6 @@ test_main(void)
   char c;
   struct termios orig_termios, test_termios;
 
-  puts( "*** " TEST_NAME " TEST ***" );
-
   test_termios_make_dev();
 
   status = rtems_shell_wait_for_input(
diff --git a/testsuite/timeout01/init.c b/testsuite/timeout01/init.c
index 77a5a72f..e2a24a82 100644
--- a/testsuite/timeout01/init.c
+++ b/testsuite/timeout01/init.c
@@ -36,9 +36,12 @@
 #include <rtems.h>
 
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #include "timeout_test.h"
 
+#define TEST_NAME "LIBBSD TIMEOUT 1"
+
 uintptr_t rtems_bsd_allocator_domain_page_mbuf_size =
     RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE_MBUF_DEFAULT;
 
@@ -46,14 +49,14 @@ static void Init(rtems_task_argument arg)
 {
 	rtems_status_code sc;
 
-	puts("\n\n*** TEST TIMOUT 1 ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_bsd_initialize();
 	assert(sc == RTEMS_SUCCESSFUL);
 
 	timeout_test();
 
-	puts("*** END OF TEST TIMOUT 1 ***");
+	rtems_test_end(TEST_NAME);
 
 	exit(0);
 }
diff --git a/testsuite/usb01/init.c b/testsuite/usb01/init.c
index 974125ab..438a0541 100644
--- a/testsuite/usb01/init.c
+++ b/testsuite/usb01/init.c
@@ -38,6 +38,7 @@
 #include <rtems/media.h>
 #include <rtems/shell.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #define TEST_NAME "LIBBSD USB 1"
 
@@ -88,7 +89,7 @@ Init(rtems_task_argument arg)
 	rtems_status_code sc;
 
 	(void) arg;
-	puts( "*** " TEST_NAME " TEST ***" );
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_bdbuf_init();
 	assert(sc == RTEMS_SUCCESSFUL);
@@ -114,6 +115,8 @@ Init(rtems_task_argument arg)
 	    false, true, NULL);
 	assert(sc == RTEMS_SUCCESSFUL);
 
+	rtems_test_end(TEST_NAME);
+
 	exit(0);
 }
 
diff --git a/testsuite/usbkbd01/init.c b/testsuite/usbkbd01/init.c
index 2322a49c..d7927a6e 100644
--- a/testsuite/usbkbd01/init.c
+++ b/testsuite/usbkbd01/init.c
@@ -34,6 +34,7 @@
 #include <rtems/console.h>
 #include <rtems/shell.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #define TEST_NAME "LIBBSD USB KEYBOARD"
 
@@ -141,7 +142,7 @@ Init(rtems_task_argument arg)
 	struct usb_test_message msg;
 
 	(void) arg;
-	puts("*** " TEST_NAME " TEST ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_message_queue_create(
 		rtems_build_name ('M', 'U', 'O', 'P'),
@@ -209,6 +210,8 @@ Init(rtems_task_argument arg)
 	sc = rtems_message_queue_delete(omid);
 	assert(sc == RTEMS_SUCCESSFUL);
 
+	rtems_test_end(TEST_NAME);
+
 	exit(0);
 }
 
diff --git a/testsuite/usbmouse01/init.c b/testsuite/usbmouse01/init.c
index 78edf66a..39432dd8 100644
--- a/testsuite/usbmouse01/init.c
+++ b/testsuite/usbmouse01/init.c
@@ -39,6 +39,7 @@
 #include <rtems/console.h>
 #include <rtems/shell.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #define TEST_NAME "LIBBSD USB MOUSE"
 
@@ -146,7 +147,7 @@ Init(rtems_task_argument arg)
 	struct usb_test_message msg;
 
 	(void) arg;
-	puts("*** " TEST_NAME " TEST ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_message_queue_create(
 		rtems_build_name ('M', 'U', 'O', 'P'),
@@ -214,6 +215,8 @@ Init(rtems_task_argument arg)
 	sc = rtems_message_queue_delete(omid);
 	assert(sc == RTEMS_SUCCESSFUL);
 
+	rtems_test_end(TEST_NAME);
+
 	exit(0);
 }
 
diff --git a/testsuite/usbserial01/init.c b/testsuite/usbserial01/init.c
index 4e2209fa..6afef59f 100644
--- a/testsuite/usbserial01/init.c
+++ b/testsuite/usbserial01/init.c
@@ -35,6 +35,7 @@
 #include <rtems/console.h>
 #include <rtems/shell.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/test.h>
 
 #define TEST_NAME "LIBBSD USB SERIAL"
 
@@ -177,7 +178,7 @@ Init(rtems_task_argument arg)
 	struct usb_test_message msg;
 
 	(void) arg;
-	puts("*** " TEST_NAME " TEST ***");
+	rtems_test_begin(TEST_NAME, TEST_STATE);
 
 	sc = rtems_message_queue_create(
 		rtems_build_name ('M', 'U', 'O', 'P'),
@@ -271,6 +272,8 @@ Init(rtems_task_argument arg)
 	sc = rtems_message_queue_delete(omid);
 	assert(sc == RTEMS_SUCCESSFUL);
 
+	rtems_test_end(TEST_NAME);
+
 	exit(0);
 }
 
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 3a14541a..02816bb7 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -520,7 +520,7 @@ class Builder(builder.ModuleManager):
         for testName in sorted(tests):
             test = self.data['tests'][testName]['all']
             test_source = []
-            libs = ['bsd', 'm', 'z']
+            libs = ['bsd', 'm', 'z', 'rtemstest']
             for cfg in test:
                 build_test = True
                 if cfg != 'default':
-- 
2.12.3



More information about the devel mailing list