source: rtems/testsuites/libtests/telnetd01/init.c @ 3cec2df

5
Last change on this file since 3cec2df was 3cec2df, checked in by Sebastian Huber <sebastian.huber@…>, on 12/17/19 at 08:17:43

config: CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS

Rename CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS into
CONFIGURE_MAXIMUM_FILE_DESCRIPTORS.

Update #3753.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <sys/stat.h>
20#include <fcntl.h>
21#include <string.h>
22
23#include <rtems.h>
24#include <rtems/rtems_bsdnet.h>
25#include <rtems/telnetd.h>
26
27#include <tmacros.h>
28
29const char rtems_test_name[] = "TELNETD 1";
30
31struct rtems_bsdnet_config rtems_bsdnet_config;
32
33static void command(char *device_name, void *arg)
34{
35}
36
37static void test_command_null(void)
38{
39  static const rtems_telnetd_config_table config = {
40    .command = NULL
41  };
42  rtems_status_code sc;
43
44  sc = rtems_telnetd_start(&config);
45  rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
46}
47
48static void test_cannot_start_server_task(void)
49{
50  static const rtems_telnetd_config_table config = {
51    .command = command,
52    .priority = UINT32_MAX
53  };
54  rtems_status_code sc;
55
56  sc = rtems_telnetd_start(&config);
57  rtems_test_assert(sc == RTEMS_UNSATISFIED);
58}
59
60static void test_successful_start(void)
61{
62  static const rtems_telnetd_config_table config = {
63    .command = command,
64    .stack_size = RTEMS_MINIMUM_STACK_SIZE
65  };
66  rtems_status_code sc;
67
68  sc = rtems_telnetd_start(&config);
69  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
70}
71
72static void test_already_started(void)
73{
74  static const rtems_telnetd_config_table config = {
75    .command = command
76  };
77  rtems_status_code sc;
78
79  sc = rtems_telnetd_start(&config);
80  rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE);
81}
82
83static rtems_task Init(rtems_task_argument argument)
84{
85  int rv;
86
87  TEST_BEGIN();
88
89  rv = rtems_bsdnet_initialize_network();
90  rtems_test_assert(rv == 0);
91
92  test_command_null();
93  test_cannot_start_server_task();
94  test_successful_start();
95  test_already_started();
96
97  TEST_END();
98  rtems_test_exit(0);
99}
100
101#define CONFIGURE_INIT
102
103#define CONFIGURE_MICROSECONDS_PER_TICK 10000
104
105#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
106#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
107
108#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (3 + 1 + 5 * 4)
109
110#define CONFIGURE_MAXIMUM_TASKS 8
111
112#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
113
114#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
115
116#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
117
118#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
119
120#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.