summaryrefslogtreecommitdiffstats
path: root/testsuites/telnetd01/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/telnetd01/init.c')
-rw-r--r--testsuites/telnetd01/init.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/testsuites/telnetd01/init.c b/testsuites/telnetd01/init.c
index 9bb013a..9d78fd1 100644
--- a/testsuites/telnetd01/init.c
+++ b/testsuites/telnetd01/init.c
@@ -27,16 +27,18 @@
*/
#include <rtems/telnetd.h>
+
+#if RTEMS_NET_LWIP
#include <lwip/dhcp.h>
#include <arch/sys_arch.h>
+#include <netstart.h>
+#endif
#include <tmacros.h>
-#include <netstart.h>
-
const char rtems_test_name[] = "TELNETD 1";
-struct netif net_interface;
+static int net_start(void);
rtems_shell_env_t env;
@@ -55,6 +57,9 @@ rtems_telnetd_config_table rtems_telnetd_config = {
.stack_size = 8 * RTEMS_MINIMUM_STACK_SIZE,
};
+#if RTEMS_NET_LWIP
+struct netif net_interface;
+
#define print_ip( tag, ip ) \
printf( \
"%s: %" PRId32 ".%" PRId32 ".%" PRId32 ".%" PRId32 "\n", \
@@ -85,13 +90,7 @@ rtems_shell_cmd_t shell_NETINFO_Command = {
NULL /* next */
};
-static rtems_task Init( rtems_task_argument argument )
-{
- rtems_status_code sc;
- int ret;
-
- TEST_BEGIN();
-
+static int net_start(void) {
ip_addr_t ipaddr, netmask, gw;
IP_ADDR4( &ipaddr, 10, 0, 2, 14 );
@@ -99,6 +98,8 @@ static rtems_task Init( rtems_task_argument argument )
IP_ADDR4( &gw, 10, 0, 2, 3 );
unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x22, 0x01 };
+ rtems_shell_init_environment();
+
ret = start_networking(
&net_interface,
&ipaddr,
@@ -108,13 +109,24 @@ static rtems_task Init( rtems_task_argument argument )
);
if ( ret != 0 ) {
- return;
+ return 1;
}
- rtems_shell_init_environment();
-
dhcp_start( &net_interface );
+ return 0;
+}
+#endif
+
+static rtems_task Init( rtems_task_argument argument )
+{
+ rtems_status_code sc;
+ int ret;
+
+ TEST_BEGIN();
+
+ rtems_test_assert( net_start() == 0 );
+
sc = rtems_telnetd_start( &rtems_telnetd_config );
rtems_test_assert( sc == RTEMS_SUCCESSFUL );