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/termios04/test_main.c | |
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/termios04/test_main.c')
-rw-r--r-- | testsuite/termios04/test_main.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/testsuite/termios04/test_main.c b/testsuite/termios04/test_main.c new file mode 100644 index 00000000..f4d94767 --- /dev/null +++ b/testsuite/termios04/test_main.c @@ -0,0 +1,69 @@ +/* + * 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 4" + +const char XON_String[] = "\021"; +const char XOFF_String[] = "\023"; + +const char ExpectedOutput_1[] = +"0123456789012345678901234567890123456789" +"0123456789012345678901234567890123456789" +"0123456789012345678901234567890123456789" +"0123456789012345678901234567890123456789" +"0123456789012345678901234567890123456789\n"; + +static void +test_main(void) +{ + rtems_status_code sc; + + test_termios_make_dev(); + + open_it(); + + change_iflag( "Set XON/XOFF", IXON|IXOFF, IXON|IXOFF ); + + printf( "XOFF\n" ); + termios_test_driver_set_rx( XOFF_String, 1 ); + + write_helper( Test_fd, ExpectedOutput_1 ); + + sc = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() ); + assert( sc == RTEMS_SUCCESSFUL ); + + printf( "XON\n" ); + termios_test_driver_set_rx( XON_String, 1 ); + + termios_test_driver_dump_tx("Transmitted"); + + close_it(); + + exit(0); +} + +#include <rtems/bsd/test/default-termios-init.h>
\ No newline at end of file |