summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2023-04-03 14:22:29 +1000
committerChris Johns <chrisj@rtems.org>2023-04-13 12:14:33 +1000
commit91019e7a6d900fe74ba74b0249b2354362ecf74e (patch)
tree9eb46cfc232ee89058c8be1a8ff61e17ed0fcaa7
parentwaf: Add test network configuration support (diff)
downloadrtems-net-legacy-91019e7a6d900fe74ba74b0249b2354362ecf74e.tar.bz2
testsuite: Add telenet02 test
-rw-r--r--testsuites/telnetd02/init.c116
-rw-r--r--testsuites/telnetd02/telnetd02.doc12
-rw-r--r--testsuites/telnetd02/telnetd02.scn9
-rw-r--r--testsuites/telnetd02/wscript50
-rw-r--r--testsuites/wscript2
5 files changed, 188 insertions, 1 deletions
diff --git a/testsuites/telnetd02/init.c b/testsuites/telnetd02/init.c
new file mode 100644
index 0000000..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
+ * <rtems@embedded-brains.de>
+ *
+ * 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 <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include <rtems.h>
+#include <rtems/dhcp.h>
+#include <rtems/rtems_bsdnet.h>
+#include <rtems/telnetd.h>
+
+#include <tmacros.h>
+#include <net-legacy-config.h>
+#include <network-config.h>
+
+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 10000
+
+#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 <rtems/shellconfig.h>
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/telnetd02/telnetd02.doc b/testsuites/telnetd02/telnetd02.doc
new file mode 100644
index 0000000..9d0a9da
--- /dev/null
+++ b/testsuites/telnetd02/telnetd02.doc
@@ -0,0 +1,12 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: telnetd02
+
+directives:
+
+ - rtems_telnetd_start()
+
+concepts:
+
++ Runs a telnet server with a suitable network configuration to
+ test the networking is running.
diff --git a/testsuites/telnetd02/telnetd02.scn b/testsuites/telnetd02/telnetd02.scn
new file mode 100644
index 0000000..1503dc5
--- /dev/null
+++ b/testsuites/telnetd02/telnetd02.scn
@@ -0,0 +1,9 @@
+*** BEGIN OF TEST TELNETD 2 ***
+*** TEST VERSION: 6.0.0.d15640249372de3106a66304569a44f6f32cca23
+*** TEST STATE: EXPECTED_PASS
+*** TEST BUILD: RTEMS_POSIX_API
+*** TEST TOOLS: 12.2.1 20230224 (RTEMS 6, RSB 77dc54ce841a04598c64073c217aa9e66df31d8f, Newlib 17ac400)
+syslog: telnetd: started successfully on port 23
+
+RTEMS Shell on /dev/console. Use 'help' to list commands.
+SHLL [/] #
diff --git a/testsuites/telnetd02/wscript b/testsuites/telnetd02/wscript
new file mode 100644
index 0000000..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 <vijay@rtems.org>.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from rtems_waf import rtems
+
+
+def init(ctx):
+ pass
+
+
+def configure(conf):
+ pass
+
+
+def build(bld):
+ legacy_config = bld.path.parent.find_node('support/net-legacy-config.c')
+ source = ['init.c', legacy_config]
+ bld.program(target='telnetd02.exe',
+ features='c cprogram',
+ cflags=bld.env.OPTIMIZATION + ['-g'],
+ includes=bld.env.IFLAGS,
+ lib=['telnetd', 'networking'],
+ libpath=['.'],
+ source=source,
+ install_path=False)
diff --git a/testsuites/wscript b/testsuites/wscript
index 040c5c6..3ce5153 100644
--- a/testsuites/wscript
+++ b/testsuites/wscript
@@ -29,7 +29,7 @@
from rtems_waf import rtems
subdirs = [
- 'ftp01', 'loopback', 'networking01', 'pppd', 'syscall01', 'telnetd01'
+ 'ftp01', 'loopback', 'networking01', 'pppd', 'syscall01', 'telnetd01', 'telnetd02'
]