Re: [rtems-net-legacy PATCH 2/2] testsuite: Add telenet02 test

2023-04-05 Thread Chris Johns
The commit missed the doco update. I will send a v2.

Chris

On 6/4/2023 3:08 pm, chr...@rtems.org wrote:
> From: Chris Johns 
> 
> ---
>  testsuites/telnetd02/init.c| 116 +
>  testsuites/telnetd02/telnetd02.doc |  11 +++
>  testsuites/telnetd02/telnetd02.scn |  11 +++
>  testsuites/telnetd02/wscript   |  50 +
>  testsuites/wscript |   2 +-
>  5 files changed, 189 insertions(+), 1 deletion(-)
>  create mode 100644 testsuites/telnetd02/init.c
>  create mode 100644 testsuites/telnetd02/telnetd02.doc
>  create mode 100644 testsuites/telnetd02/telnetd02.scn
>  create mode 100644 testsuites/telnetd02/wscript
> 
> diff --git a/testsuites/telnetd02/init.c b/testsuites/telnetd02/init.c
> new file mode 100644
> index 000..6f762db
> --- /dev/null
> +++ b/testsuites/telnetd02/init.c
> @@ -0,0 +1,116 @@
> +/*
> + * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +const char rtems_test_name[] = "TELNETD 2";
> +
> +struct rtems_bsdnet_config rtems_bsdnet_config;
> +
> +rtems_shell_env_t env;
> +
> +static void telnet_shell( char *name, void *arg )
> +{
> +  rtems_shell_dup_current_env( &env );
> +
> +  env.devname = name;
> +  env.taskname = "TLNT";
> +
> +  rtems_shell_main_loop( &env );
> +}
> +
> +rtems_telnetd_config_table rtems_telnetd_config = {
> +  .command = telnet_shell,
> +  .stack_size = 8 * RTEMS_MINIMUM_STACK_SIZE,
> +};
> +
> +static rtems_task Init(rtems_task_argument argument)
> +{
> +  rtems_status_code sc;
> +  int rv;
> +
> +  TEST_BEGIN();
> +
> +  rtems_test_assert(rtems_net_legacy_config(&rtems_bsdnet_config));
> +
> +  rv = rtems_bsdnet_initialize_network();
> +  rtems_test_assert(rv == 0);
> +
> +  sc = rtems_telnetd_start( &rtems_telnetd_config );
> +  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
> +
> +  sc = rtems_shell_init(
> +"SHLL",   /* task name */
> +RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */
> +1,/* task priority */
> +"/dev/console",   /* device name */
> +false,/* run forever */
> +true, /* wait for shell to terminate */
> +NULL  /* login check function,
> + use NULL to disable a login check */
> +  );
> +  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
> +
> +  TEST_END();
> +  rtems_test_exit(0);
> +}
> +
> +#define CONFIGURE_INIT
> +
> +#define CONFIGURE_MICROSECONDS_PER_TICK 1
> +
> +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
> +
> +#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32
> +
> +#define CONFIGURE_MAXIMUM_TASKS 12
> +
> +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
> +#define CONFIGURE_MAXIMUM_SEMAPHORES 20
> +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
> +
> +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
> +
> +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> +
> +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
> +
> +#define CONFIGURE_UNLIMITED_OBJECTS
> +#define CONFIGURE_UNIFIED_WORK_AREAS
> +
> +#define RTEMS_NETWORKING 1
> +#define CONFIGURE_SHELL_COMMANDS_INIT
> +#define CONFIGURE_SHELL_COMMANDS_ALL
> +#define CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING
> +
> +#include 
> +
> +#include 
> diff --git a/testsuites/telnetd02/telnetd02.doc 
> b/testsuites/telnetd02/telnetd02.doc
> new file mode 100644
> index 000..7931c3c
> --- /dev/null
> +++ b/testsuites/telnetd02/telnetd02.doc
> @@ -0,0 +1,11 @@
> +This file describes the directives and concepts tested by this test set.
> +
> +test set name: telnetd01
> +
> +directives:
> +
> +  - rtems_telnetd_start()
> +
> +concepts:
> +
> ++ Check if Telnet server works.
> diff --git a/testsuites/telnetd02/telnetd02.scn 
> b/testsuites/telnetd02/telnetd02.scn
> new file mode 100644
> index 000..3e9cc00
> --- /dev/null
> +++ b/testsuites/telnetd02/telnetd02.scn
> @@ -0,0 +1,11 @@
> +*** BEGIN OF TEST TELNETD 1 ***
> +*** TEST VERSION: 5.0.0.dc32b6aa0807fb70f9b26bc0bc6e164ddb49bd3a
> +*** TEST STATE: EXPECTED_PASS
> +*** TEST BUILD: RTEMS_NETWORKING
> +*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 
> 9670d7541e0621915e521fe76e7bb33de8cee661, Newlib 
> d13c84eb07e35984bf7a974cd786a6cdac29e6b9)
> +syslog: telnetd: configuration with invalid command
> +syslog: telnetd: cannot create session task
> +syslog: telnetd: started successfully on po

[rtems-net-legacy PATCH 2/2] testsuite: Add telenet02 test

2023-04-05 Thread chrisj
From: Chris Johns 

---
 testsuites/telnetd02/init.c| 116 +
 testsuites/telnetd02/telnetd02.doc |  11 +++
 testsuites/telnetd02/telnetd02.scn |  11 +++
 testsuites/telnetd02/wscript   |  50 +
 testsuites/wscript |   2 +-
 5 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/telnetd02/init.c
 create mode 100644 testsuites/telnetd02/telnetd02.doc
 create mode 100644 testsuites/telnetd02/telnetd02.scn
 create mode 100644 testsuites/telnetd02/wscript

diff --git a/testsuites/telnetd02/init.c b/testsuites/telnetd02/init.c
new file mode 100644
index 000..6f762db
--- /dev/null
+++ b/testsuites/telnetd02/init.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "TELNETD 2";
+
+struct rtems_bsdnet_config rtems_bsdnet_config;
+
+rtems_shell_env_t env;
+
+static void telnet_shell( char *name, void *arg )
+{
+  rtems_shell_dup_current_env( &env );
+
+  env.devname = name;
+  env.taskname = "TLNT";
+
+  rtems_shell_main_loop( &env );
+}
+
+rtems_telnetd_config_table rtems_telnetd_config = {
+  .command = telnet_shell,
+  .stack_size = 8 * RTEMS_MINIMUM_STACK_SIZE,
+};
+
+static rtems_task Init(rtems_task_argument argument)
+{
+  rtems_status_code sc;
+  int rv;
+
+  TEST_BEGIN();
+
+  rtems_test_assert(rtems_net_legacy_config(&rtems_bsdnet_config));
+
+  rv = rtems_bsdnet_initialize_network();
+  rtems_test_assert(rv == 0);
+
+  sc = rtems_telnetd_start( &rtems_telnetd_config );
+  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+  sc = rtems_shell_init(
+"SHLL",   /* task name */
+RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */
+1,/* task priority */
+"/dev/console",   /* device name */
+false,/* run forever */
+true, /* wait for shell to terminate */
+NULL  /* login check function,
+ use NULL to disable a login check */
+  );
+  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_INIT
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 1
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32
+
+#define CONFIGURE_MAXIMUM_TASKS 12
+
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+#define CONFIGURE_MAXIMUM_SEMAPHORES 20
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define CONFIGURE_UNLIMITED_OBJECTS
+#define CONFIGURE_UNIFIED_WORK_AREAS
+
+#define RTEMS_NETWORKING 1
+#define CONFIGURE_SHELL_COMMANDS_INIT
+#define CONFIGURE_SHELL_COMMANDS_ALL
+#define CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING
+
+#include 
+
+#include 
diff --git a/testsuites/telnetd02/telnetd02.doc 
b/testsuites/telnetd02/telnetd02.doc
new file mode 100644
index 000..7931c3c
--- /dev/null
+++ b/testsuites/telnetd02/telnetd02.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: telnetd01
+
+directives:
+
+  - rtems_telnetd_start()
+
+concepts:
+
++ Check if Telnet server works.
diff --git a/testsuites/telnetd02/telnetd02.scn 
b/testsuites/telnetd02/telnetd02.scn
new file mode 100644
index 000..3e9cc00
--- /dev/null
+++ b/testsuites/telnetd02/telnetd02.scn
@@ -0,0 +1,11 @@
+*** BEGIN OF TEST TELNETD 1 ***
+*** TEST VERSION: 5.0.0.dc32b6aa0807fb70f9b26bc0bc6e164ddb49bd3a
+*** TEST STATE: EXPECTED_PASS
+*** TEST BUILD: RTEMS_NETWORKING
+*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 
9670d7541e0621915e521fe76e7bb33de8cee661, Newlib 
d13c84eb07e35984bf7a974cd786a6cdac29e6b9)
+syslog: telnetd: configuration with invalid command
+syslog: telnetd: cannot create session task
+syslog: telnetd: started successfully on port 23
+syslog: telnetd: cannot bind server socket
+
+*** END OF TEST TELNETD 1 ***
diff --git a/testsuites/telnetd02/wscript b/testsuites/telnetd02/wscript
new file mode 100644
index 000..b59c040
--- /dev/null
+++ b/testsuites/telnetd02/wscript
@@ -0,0 +1,50 @@
+#
+# RTEMS Project (https://www.rtems.org/)
+#
+# Copyright (c) 2021 Regents of University of Colorado
+# Written by Vijay Kumar Banerjee .
+# All rights reserved.
+#
+#  Redistribu