diff options
author | Kevin Kirspel <kevin-kirspel@idexx.com> | 2017-05-04 08:28:00 -0400 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-05-11 11:15:41 +0200 |
commit | 333bfb618bf21fc3f7cca7411acf0f42fcdc4b57 (patch) | |
tree | ed0321198cee02ab0365c28726297bab8a2862ce /testsuite/termios02 | |
parent | Adding RTEMS support for FREEBSD TTY (diff) | |
download | rtems-libbsd-333bfb618bf21fc3f7cca7411acf0f42fcdc4b57.tar.bz2 |
Adding test cases for FREEBSD termios support through tty
Diffstat (limited to 'testsuite/termios02')
-rw-r--r-- | testsuite/termios02/test_main.c | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/testsuite/termios02/test_main.c b/testsuite/termios02/test_main.c new file mode 100644 index 00000000..3ec5c0b2 --- /dev/null +++ b/testsuite/termios02/test_main.c @@ -0,0 +1,140 @@ +/* + * COPYRIGHT (c) 1989-2017. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <fcntl.h> +#include <inttypes.h> + +#include <rtems/console.h> +#include <rtems/shell.h> +#include <rtems/bsd/bsd.h> + +#include <termios.h> +#include <rtems/libcsupport.h> +#include <rtems/termiostypes.h> + +#include "../termios/test_termios_driver.h" +#include "../termios/test_termios_utilities.h" + +#define TEST_NAME "LIBBSD TERMIOS 2" + +static void +test_main(void) +{ + int sc; + pid_t pid; + char *term_name_p; + char term_name[32]; + + test_termios_make_dev(); + + open_it(); + + puts( "tcdrain() - OK" ); + sc = tcdrain(Test_fd); + assert( !sc ); + + puts( "" ); + + /***** TEST TCFLOW *****/ + puts( "tcflow(TCOOFF) - ENOTSUP" ); + errno = 0; + sc = tcflow( Test_fd, TCOOFF ); + assert( sc == -1 ); + assert( errno == ENOTSUP ); + + puts( "tcflow(TCOON) - ENOTSUP" ); + errno = 0; + sc = tcflow( Test_fd, TCOON ); + assert( sc == -1 ); + assert( errno == ENOTSUP ); + + puts( "tcflow(TCIOFF) - ENOTSUP" ); + errno = 0; + sc = tcflow( Test_fd, TCIOFF ); + assert( sc == -1 ); + assert( errno == ENOTSUP ); + + puts( "tcflow(TCION) - ENOTSUP" ); + errno = 0; + sc = tcflow( Test_fd, TCION ); + assert( sc == -1 ); + assert( errno == ENOTSUP ); + + puts( "tcflow(22) - EINVAL" ); + errno = 0; + sc = tcflow( Test_fd, 22 ); + assert( sc == -1 ); + assert( errno == EINVAL ); + + puts( "" ); + + /***** TEST TCFLUSH *****/ + puts( "tcflush(TCIFLUSH) - OK" ); + errno = 0; + sc = tcflush( Test_fd, TCIFLUSH ); + assert( sc == 0 ); + assert( errno == 0 ); + + puts( "tcflush(TCOFLUSH) - OK" ); + sc = tcflush( Test_fd, TCOFLUSH ); + assert( sc == 0 ); + assert( errno == 0 ); + + puts( "tcflush(TCIOFLUSH) - OK" ); + sc = tcflush( Test_fd, TCIOFLUSH ); + assert( sc == 0 ); + assert( errno == 0 ); + + puts( "tcflush(22) - EINVAL" ); + errno = 0; + sc = tcflush( Test_fd, 22 ); + assert( sc == -1 ); + assert( errno == EINVAL ); + + puts( "" ); + + /***** TEST TCGETPGRP *****/ + puts( "tcgetpgrp() - OK" ); + pid = tcgetpgrp(Test_fd); + assert( pid == getpid() ); + + puts( "tcsetpgrp(3) - OK" ); + sc = tcsetpgrp( Test_fd, 3 ); + assert( !sc ); + + puts( "" ); + + /***** TEST TCSENDBREAK *****/ + puts( "tcsendbreak(0) - OK" ); + sc = tcsendbreak( Test_fd, 0 ); + assert( !sc ); + + puts( "" ); + + /***** TEST CTERMID *****/ + puts( "ctermid( NULL ) - OK" ); + term_name_p = ctermid( NULL ); + assert( term_name_p ); + printf( "ctermid ==> %s\n", term_name_p ); + + puts( "ctermid( term_name ) - OK" ); + term_name_p = ctermid( term_name ); + assert( term_name_p == term_name ); + printf( "ctermid ==> %s\n", term_name_p ); + + close_it(); + + exit(0); +} + +#include <rtems/bsd/test/default-termios-init.h>
\ No newline at end of file |