source: rtems/testsuites/libtests/termios02/init.c @ 24a5a14

4.115
Last change on this file since 24a5a14 was 9f5f6f53, checked in by Joel Sherrill <joel.sherrill@…>, on 06/07/10 at 18:33:09

2010-06-07 Joel Sherrill <joel.sherrill@…>

  • termios01/init.c, termios01/termios01.scn, termios02/init.c, termios02/termios02.scn: Add tests for cfigetspeed(), cfogetspeed(), cfisetspeed(), cfosetspeed(), ctermid(), tcflow(), tcflush(), tcsendbreak(), tcsetpgrp(), and tcgetpgrp(). Some of these methods are minimal implementations so the tests will have to grow as the methods grow.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include "tmacros.h"
13#include <termios.h>
14#include <errno.h>
15#include <unistd.h>
16
17rtems_task Init(
18  rtems_task_argument ignored
19)
20{
21  int sc;
22  pid_t pid;
23  char *term_name_p;
24  char term_name[32];
25
26  puts( "\n\n*** TERMIOS 02 TEST ***" );
27
28  puts( "tcdrain(12) - EBADF" );
29  sc = tcdrain(12);
30  rtems_test_assert( sc == -1 );
31  rtems_test_assert( errno == EBADF );
32
33  puts( "tcdrain(stdin) - OK" );
34  sc = tcdrain(0);
35  rtems_test_assert( !sc );
36
37  puts( "tcdrain(stdout) - OK" );
38  tcdrain(1);
39  rtems_test_assert( !sc );
40
41  puts( "tcdrain(stderr) - OK" );
42  tcdrain(2);
43  rtems_test_assert( !sc );
44
45  puts( "" );
46
47  /***** TEST TCFLOW *****/
48  puts( "tcflow(stdin, TCOOFF) - ENOTSUP" );
49  sc = tcflow( 0, TCOOFF );
50  rtems_test_assert( sc == -1 );
51  rtems_test_assert( errno = ENOTSUP );
52
53  puts( "tcflow(stdin, TCOON) - ENOTSUP" );
54  sc = tcflow( 0, TCOON );
55  rtems_test_assert( sc == -1 );
56  rtems_test_assert( errno = ENOTSUP );
57
58  puts( "tcflow(stdin, TCIOFF) - ENOTSUP" );
59  sc = tcflow( 0, TCIOFF );
60  rtems_test_assert( sc == -1 );
61  rtems_test_assert( errno = ENOTSUP );
62
63  puts( "tcflow(stdin, TCION) - ENOTSUP" );
64  sc = tcflow( 0, TCION );
65  rtems_test_assert( sc == -1 );
66  rtems_test_assert( errno = ENOTSUP );
67
68  puts( "tcflow(stdin, 22) - EINVAL" );
69  sc = tcflow( 0, 22 );
70  rtems_test_assert( sc == -1 );
71  rtems_test_assert( errno = EINVAL );
72
73  puts( "" );
74
75  /***** TEST TCFLUSH *****/
76  puts( "tcflush(stdin, TCIFLUSH) - ENOTSUP" );
77  sc = tcflush( 0, TCIFLUSH );
78  rtems_test_assert( sc == -1 );
79  rtems_test_assert( errno = ENOTSUP );
80
81  puts( "tcflush(stdin, TCOFLUSH) - ENOTSUP" );
82  sc = tcflush( 0, TCOFLUSH );
83  rtems_test_assert( sc == -1 );
84  rtems_test_assert( errno = ENOTSUP );
85
86  puts( "tcflush(stdin, TCIOFLUSH) - ENOTSUP" );
87  sc = tcflush( 0, TCIOFLUSH );
88  rtems_test_assert( sc == -1 );
89  rtems_test_assert( errno = ENOTSUP );
90
91  puts( "tcflush(stdin, 22) - EINVAL" );
92  sc = tcflush( 0, 22 );
93  rtems_test_assert( sc == -1 );
94  rtems_test_assert( errno = EINVAL );
95
96  puts( "" );
97
98  /***** TEST TCGETPGRP *****/
99  puts( "tcgetpgrp( 1 ) - OK" );
100  pid = tcgetpgrp(1);
101  rtems_test_assert( pid == getpid() );
102
103  puts( "tcsetpgrp( 1, 3 ) - OK" );
104  sc = tcsetpgrp( 1, 3 );
105  rtems_test_assert( !sc );
106
107  puts( "" );
108
109  /***** TEST TCSENDBREAK *****/
110  puts( "tcsendbreak( 1, 0 ) - OK" );
111  sc = tcsendbreak( 1, 0 );
112  rtems_test_assert( !sc );
113
114  puts( "" );
115
116  /***** TEST CTERMID *****/
117  puts( "ctermid( NULL ) - OK" );
118  term_name_p = ctermid( NULL );
119  rtems_test_assert( term_name_p );
120  printf( "ctermid ==> %s\n", term_name_p );
121
122  puts( "ctermid( term_name ) - OK" );
123  term_name_p = ctermid( term_name );
124  rtems_test_assert( term_name_p == term_name );
125  printf( "ctermid ==> %s\n", term_name_p );
126
127  puts( "*** END OF TERMIOS 02 TEST ***" );
128  exit( 0 );
129}
130
131
132/* NOTICE: the clock driver is explicitly disabled */
133#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
134#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
135
136#define CONFIGURE_MAXIMUM_TASKS            1
137#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
138
139#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
140
141#define CONFIGURE_INIT
142#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.