summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-07-01 16:36:13 +1000
committerChris Johns <chrisj@rtems.org>2016-07-01 16:36:13 +1000
commit4dec4353853e271981395c6d0e916591a32062d3 (patch)
tree76cf7531fee7ad92b3ba456e0d79ae53e331ece0
parentAdd telnetd as service to rc.conf. (diff)
downloadrtems-libbsd-4dec4353853e271981395c6d0e916591a32062d3.tar.bz2
Add a wait for key press to test rccof02.
-rw-r--r--testsuite/rcconf02/test_main.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/testsuite/rcconf02/test_main.c b/testsuite/rcconf02/test_main.c
index 8695e562..735e5554 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);
}