[rtems commit] libtests/dl10: Enter shell on demand

Sebastian Huber sebh at rtems.org
Fri Jan 14 13:38:05 UTC 2022


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jan 14 07:59:34 2022 +0100

libtests/dl10: Enter shell on demand

Use rtems_shell_wait_for_input() similar to other potentially
interactive test programs.

---

 testsuites/libtests/dl10/init.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/testsuites/libtests/dl10/init.c b/testsuites/libtests/dl10/init.c
index b488a32..ac9d378 100644
--- a/testsuites/libtests/dl10/init.c
+++ b/testsuites/libtests/dl10/init.c
@@ -27,9 +27,6 @@
 
 const char rtems_test_name[] = "libdl (RTL) 10";
 
-/* forward declarations to avoid warnings */
-static rtems_task Init(rtems_task_argument argument);
-
 #include "dl10-tar.h"
 
 #define TARFILE_START dl10_tar
@@ -46,9 +43,18 @@ static int test(void)
   return 0;
 }
 
+static void notification(int fd, int seconds_remaining, void *arg)
+{
+  printf(
+    "Press any key to enter shell (%is remaining)\n",
+    seconds_remaining
+  );
+}
+
 static void Init(rtems_task_argument arg)
 {
   int e;
+  rtems_status_code sc;
 
   TEST_BEGIN();
 
@@ -76,13 +82,20 @@ static void Init(rtems_task_argument arg)
     exit (1);
   }
 
-  rtems_shell_init ("SHLL",
-                    RTEMS_MINIMUM_STACK_SIZE * 4,
-                    100,
-                    "/dev/foobar",
-                    false,
-                    true,
-                    NULL);
+
+  sc = rtems_shell_wait_for_input (STDIN_FILENO,
+                                   20,
+                                   notification,
+                                   NULL);
+  if (sc == RTEMS_SUCCESSFUL) {
+    rtems_shell_init ("SHLL",
+                      RTEMS_MINIMUM_STACK_SIZE * 4,
+                      100,
+                      "/dev/foobar",
+                      false,
+                      true,
+                      NULL);
+  }
 
   TEST_END();
 



More information about the vc mailing list