source: rtems/testsuites/samples/pppd/init.c @ 98c6d50

Last change on this file since 98c6d50 was 98c6d50, checked in by Chris Johns <chrisj@…>, on Oct 19, 2017 at 5:39:16 AM

testsuite: Use printk for all test output where possible.

  • Remove the printf support leaving the direct printk support configured with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf call to printk.
  • Control the test's single init for functions and global data with TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define TEST_INIT
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19
20#define CONFIGURE_INIT
21#include "system.h"
22
23#include <rtems/rtems_bsdnet.h>
24#include <rtems/rtemspppd.h>
25#include <rtems/shell.h>
26#include "netconfig.h"
27
28const char rtems_test_name[] = "PPPD";
29rtems_printer rtems_test_printer;
30
31static void notification(int fd, int seconds_remaining, void *arg)
32{
33  printf(
34    "Press any key to start pppd (%is remaining)\n",
35    seconds_remaining
36  );
37}
38
39rtems_task Init(rtems_task_argument argument)
40{
41  rtems_status_code status;
42
43  rtems_print_printer_printf(&rtems_test_printer);
44
45  rtems_test_begin();
46
47  status = rtems_shell_wait_for_input(
48    STDIN_FILENO,
49    10,
50    notification,
51    NULL
52  );
53  if (status != RTEMS_SUCCESSFUL) {
54    rtems_test_end();
55    exit( 0 );
56  }
57
58  /* initialize network */
59  rtems_bsdnet_initialize_network();
60  rtems_pppd_initialize();
61  pppdapp_initialize();
62  rtems_task_delete(RTEMS_SELF);
63}
Note: See TracBrowser for help on using the repository browser.