[rtems commit] libtest: Fix test printer in rtems_test_run()

Sebastian Huber sebh at rtems.org
Thu Dec 14 10:04:27 UTC 2023


Module:    rtems
Branch:    master
Commit:    3fe4b72b067082f0f8a978ad66b45e23dff4fae6
Changeset: http://git.rtems.org/rtems/commit/?id=3fe4b72b067082f0f8a978ad66b45e23dff4fae6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 14 11:31:00 2023 +0100

libtest: Fix test printer in rtems_test_run()

Route the test output through T_vprintf() only while the test suite
runs.  Otherwise, the begin/end of test message may not show up.

---

 cpukit/libtest/testrun.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/cpukit/libtest/testrun.c b/cpukit/libtest/testrun.c
index 1fc8c82824..5b2eb61596 100644
--- a/cpukit/libtest/testrun.c
+++ b/cpukit/libtest/testrun.c
@@ -85,13 +85,22 @@ void rtems_test_run(
   const RTEMS_TEST_STATE state
 )
 {
+  rtems_print_printer previous_printer;
+  int exit_code;
+
   (void) arg;
 
-  rtems_test_printer.printer = printer;
   rtems_test_begin( rtems_test_name, state );
   T_register();
 
-  if ( T_main( &config ) == 0 ) {
+  previous_printer = rtems_test_printer.printer;
+  rtems_test_printer.printer = printer;
+
+  exit_code = T_main( &config );
+
+  rtems_test_printer.printer = previous_printer;
+
+  if ( exit_code == 0 ) {
     rtems_test_end( rtems_test_name );
   }
 



More information about the vc mailing list