[rtems-libbsd commit] Add a wait for key press to test rccof02.

Chris Johns chrisj at rtems.org
Fri Jul 1 06:36:20 UTC 2016


Module:    rtems-libbsd
Branch:    master
Commit:    4dec4353853e271981395c6d0e916591a32062d3
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=4dec4353853e271981395c6d0e916591a32062d3

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Jul  1 16:36:13 2016 +1000

Add a wait for key press to test rccof02.

---

 testsuite/rcconf02/test_main.c | 43 +++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/testsuite/rcconf02/test_main.c b/testsuite/rcconf02/test_main.c
index 8695e56..735e555 100644
--- a/testsuite/rcconf02/test_main.c
+++ b/testsuite/rcconf02/test_main.c
@@ -148,20 +148,41 @@ test_rc_conf_script(void)
 }
 
 static void
-test_main(void)
+waiter(int fd, int secs, void *arg)
 {
-  test_rc_conf_script();
+  int*        toggle = (int*) arg;
+  const char* toggles = "|/-|\-";
+  printf("\b%c", toggles[*toggle]);
+  fflush(stdout);
+  ++(*toggle);
+  if (*toggle >= 6)
+    *toggle = 0;
+}
 
-  rtems_shell_init(
-    "SHLL",
-    32 * 1024,
-    1,
-    CONSOLE_DEVICE_NAME,
-    false,
-    true,
-    NULL
-    );
+static void
+shell(void)
+{
+  int               toggle = 1;
+  rtems_status_code sc;
+  printf("Press any key for the shell .... -");
+  fflush(stdout);
+  sc = rtems_shell_wait_for_input(STDIN_FILENO, 10, waiter, &toggle);
+  if (sc == RTEMS_SUCCESSFUL) {
+    rtems_shell_init("SHLL",
+                     32 * 1024,
+                     1,
+                     CONSOLE_DEVICE_NAME,
+                     false,
+                     true,
+                     NULL);
+  }
+}
 
+static void
+test_main(void)
+{
+  test_rc_conf_script();
+  shell();
   exit(0);
 }
 




More information about the vc mailing list