[rtems commit] libtests/top: End test after some time if no input

Sebastian Huber sebh at rtems.org
Thu Nov 20 13:53:25 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 20 08:52:50 2014 +0100

libtests/top: End test after some time if no input

---

 testsuites/libtests/top/init.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/testsuites/libtests/top/init.c b/testsuites/libtests/top/init.c
index c0e980b..8a824ae 100644
--- a/testsuites/libtests/top/init.c
+++ b/testsuites/libtests/top/init.c
@@ -24,6 +24,8 @@
 #define CONFIGURE_INIT
 #include "system.h"
 
+#include <rtems/shell.h>
+
 const char rtems_test_name[] = "TOP";
 
 /*
@@ -46,6 +48,14 @@ void add_some(
   }
 }
 
+static void notification(int fd, int seconds_remaining, void *arg)
+{
+  printf(
+    "Press any key to enter top test (%is remaining)\n",
+    seconds_remaining
+  );
+}
+
 rtems_task Init(
   rtems_task_argument argument
 )
@@ -54,6 +64,19 @@ rtems_task Init(
   rtems_time_of_day time;
 
   TEST_BEGIN();
+
+  status = rtems_shell_wait_for_input(
+    STDIN_FILENO,
+    20,
+    notification,
+    NULL
+  );
+  if ( status != RTEMS_SUCCESSFUL ) {
+    TEST_END();
+
+    rtems_test_exit( 0 );
+  }
+
   build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
 
   status = rtems_clock_set( &time );



More information about the vc mailing list