From e958d79b338b8a32c6f182152f4f205e1a35e2ce Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 15 Aug 2009 22:29:38 +0000 Subject: 2009-08-15 Joel Sherrill * termios01/init.c, termios01/termios01.scn: Add a few error paths to complete coverage of termios_XXX_to_YYY() methods. --- testsuites/libtests/ChangeLog | 5 + testsuites/libtests/termios01/init.c | 25 ++++ testsuites/libtests/termios01/termios01.scn | 200 ++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) (limited to 'testsuites/libtests') diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index a902742c3e..33a6374120 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,8 @@ +2009-08-15 Joel Sherrill + + * termios01/init.c, termios01/termios01.scn: Add a few error paths to + complete coverage of termios_XXX_to_YYY() methods. + 2009-08-15 Joel Sherrill * Makefile.am, configure.ac: Add new test to exercise tcgetattr and diff --git a/testsuites/libtests/termios01/init.c b/testsuites/libtests/termios01/init.c index f12c54fe0c..a38bd2c316 100644 --- a/testsuites/libtests/termios01/init.c +++ b/testsuites/libtests/termios01/init.c @@ -124,6 +124,15 @@ void test_termios_baud2index(void) "\n" "Test termios_baud2index..." ); + puts( "termios_baud_to_index(-2) - NOT OK" ); + i = termios_baud_to_index( -2 ); + assert ( i == -1 ); + + puts( "termios_baud_to_index(572) - NOT OK" ); + i = termios_baud_to_index( -2 ); + assert ( i == -1 ); + + if ( i != -1 ) for (i=0 ; baud_table[i].constant != -1 ; i++ ) { printf( "termios_baud_to_index(B%d) - OK\n", baud_table[i].baud ); index = termios_baud_to_index( baud_table[i].constant ); @@ -146,6 +155,14 @@ void test_termios_baud2number(void) "\n" "Test termios_baud2number..." ); + puts( "termios_baud_to_number(-2) - NOT OK" ); + i = termios_baud_to_number( -2 ); + assert ( i == -1 ); + + puts( "termios_baud_to_number(572) - NOT OK" ); + i = termios_baud_to_number( -2 ); + assert ( i == -1 ); + for (i=0 ; baud_table[i].constant != -1 ; i++ ) { printf( "termios_baud_to_number(B%d) - OK\n", baud_table[i].baud ); number = termios_baud_to_number( baud_table[i].constant ); @@ -172,6 +189,14 @@ void test_termios_number_to_baud(void) "\n" "Test termios_number_to_baud..." ); + puts( "termios_number_to_baud(-2) - NOT OK" ); + i = termios_number_to_baud( -2 ); + assert ( i == -1 ); + + puts( "termios_number_to_baud(572) - NOT OK" ); + i = termios_number_to_baud( -2 ); + assert ( i == -1 ); + for (i=0 ; baud_table[i].constant != -1 ; i++ ) { printf( "termios_number_to_baud(B%d) - OK\n", baud_table[i].baud ); termios_baud = termios_number_to_baud( baud_table[i].baud ); diff --git a/testsuites/libtests/termios01/termios01.scn b/testsuites/libtests/termios01/termios01.scn index e69de29bb2..584923fdf6 100644 --- a/testsuites/libtests/termios01/termios01.scn +++ b/testsuites/libtests/termios01/termios01.scn @@ -0,0 +1,200 @@ +*** TEST TERMIOS 01 *** + +Test termios_baud2index... +termios_baud_to_index(-2) - NOT OK +termios_baud_to_index(572) - NOT OK + +Test termios_baud2number... +termios_baud_to_number(-2) - NOT OK +termios_baud_to_number(572) - NOT OK +termios_baud_to_number(B0) - OK +termios_baud_to_number(B50) - OK +termios_baud_to_number(B75) - OK +termios_baud_to_number(B110) - OK +termios_baud_to_number(B134) - OK +termios_baud_to_number(B150) - OK +termios_baud_to_number(B200) - OK +termios_baud_to_number(B300) - OK +termios_baud_to_number(B600) - OK +termios_baud_to_number(B1200) - OK +termios_baud_to_number(B1800) - OK +termios_baud_to_number(B2400) - OK +termios_baud_to_number(B4800) - OK +termios_baud_to_number(B9600) - OK +termios_baud_to_number(B19200) - OK +termios_baud_to_number(B38400) - OK +termios_baud_to_number(B57600) - OK +termios_baud_to_number(B115200) - OK +termios_baud_to_number(B230400) - OK +termios_baud_to_number(B460800) - OK + +Test termios_number_to_baud... +termios_number_to_baud(-2) - NOT OK +termios_number_to_baud(572) - NOT OK +termios_number_to_baud(B0) - OK +termios_number_to_baud(B50) - OK +termios_number_to_baud(B75) - OK +termios_number_to_baud(B110) - OK +termios_number_to_baud(B134) - OK +termios_number_to_baud(B150) - OK +termios_number_to_baud(B200) - OK +termios_number_to_baud(B300) - OK +termios_number_to_baud(B600) - OK +termios_number_to_baud(B1200) - OK +termios_number_to_baud(B1800) - OK +termios_number_to_baud(B2400) - OK +termios_number_to_baud(B4800) - OK +termios_number_to_baud(B9600) - OK +termios_number_to_baud(B19200) - OK +termios_number_to_baud(B38400) - OK +termios_number_to_baud(B57600) - OK +termios_number_to_baud(B115200) - OK +termios_number_to_baud(B230400) - OK +termios_number_to_baud(B460800) - OK + +Init - rtems_io_register_driver - Termios Test Driver - OK +Termios_test_driver - rtems_io_register /dev/test - OK +Init - Major slot returned = 2 +Init - open - /dev/test - OK +Termios_test_driver - rtems_set_initial_baud - bad baud - OK +Termios_test_driver - rtems_set_initial_baud - 38400 - OK +Test termios setting device baud rate... +tcsetattr(TCSANOW, B0) - OK +set_attributes - B0 8-NONE-1 +tcsetattr(TCSADRAIN, B0) - OK +set_attributes - B0 8-NONE-1 +tcsetattr(TCSANOW, B50) - OK +set_attributes - B50 8-NONE-1 +tcsetattr(TCSADRAIN, B50) - OK +set_attributes - B50 8-NONE-1 +tcsetattr(TCSANOW, B75) - OK +set_attributes - B75 8-NONE-1 +tcsetattr(TCSADRAIN, B75) - OK +set_attributes - B75 8-NONE-1 +tcsetattr(TCSANOW, B110) - OK +set_attributes - B110 8-NONE-1 +tcsetattr(TCSADRAIN, B110) - OK +set_attributes - B110 8-NONE-1 +tcsetattr(TCSANOW, B134) - OK +set_attributes - B134 8-NONE-1 +tcsetattr(TCSADRAIN, B134) - OK +set_attributes - B134 8-NONE-1 +tcsetattr(TCSANOW, B150) - OK +set_attributes - B150 8-NONE-1 +tcsetattr(TCSADRAIN, B150) - OK +set_attributes - B150 8-NONE-1 +tcsetattr(TCSANOW, B200) - OK +set_attributes - B200 8-NONE-1 +tcsetattr(TCSADRAIN, B200) - OK +set_attributes - B200 8-NONE-1 +tcsetattr(TCSANOW, B300) - OK +set_attributes - B300 8-NONE-1 +tcsetattr(TCSADRAIN, B300) - OK +set_attributes - B300 8-NONE-1 +tcsetattr(TCSANOW, B600) - OK +set_attributes - B600 8-NONE-1 +tcsetattr(TCSADRAIN, B600) - OK +set_attributes - B600 8-NONE-1 +tcsetattr(TCSANOW, B1200) - OK +set_attributes - B1200 8-NONE-1 +tcsetattr(TCSADRAIN, B1200) - OK +set_attributes - B1200 8-NONE-1 +tcsetattr(TCSANOW, B1800) - OK +set_attributes - B1800 8-NONE-1 +tcsetattr(TCSADRAIN, B1800) - OK +set_attributes - B1800 8-NONE-1 +tcsetattr(TCSANOW, B2400) - OK +set_attributes - B2400 8-NONE-1 +tcsetattr(TCSADRAIN, B2400) - OK +set_attributes - B2400 8-NONE-1 +tcsetattr(TCSANOW, B4800) - OK +set_attributes - B4800 8-NONE-1 +tcsetattr(TCSADRAIN, B4800) - OK +set_attributes - B4800 8-NONE-1 +tcsetattr(TCSANOW, B9600) - OK +set_attributes - B9600 8-NONE-1 +tcsetattr(TCSADRAIN, B9600) - OK +set_attributes - B9600 8-NONE-1 +tcsetattr(TCSANOW, B19200) - OK +set_attributes - B19200 8-NONE-1 +tcsetattr(TCSADRAIN, B19200) - OK +set_attributes - B19200 8-NONE-1 +tcsetattr(TCSANOW, B38400) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSADRAIN, B38400) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSANOW, B57600) - OK +set_attributes - B57600 8-NONE-1 +tcsetattr(TCSADRAIN, B57600) - OK +set_attributes - B57600 8-NONE-1 +tcsetattr(TCSANOW, B115200) - OK +set_attributes - B115200 8-NONE-1 +tcsetattr(TCSADRAIN, B115200) - OK +set_attributes - B115200 8-NONE-1 +tcsetattr(TCSANOW, B230400) - OK +set_attributes - B230400 8-NONE-1 +tcsetattr(TCSADRAIN, B230400) - OK +set_attributes - B230400 8-NONE-1 +tcsetattr(TCSANOW, B460800) - OK +set_attributes - B460800 8-NONE-1 +tcsetattr(TCSADRAIN, B460800) - OK +set_attributes - B460800 8-NONE-1 +Init - close - /dev/test - OK + +Init - open - /dev/test - OK +Termios_test_driver - rtems_set_initial_baud - bad baud - OK +Termios_test_driver - rtems_set_initial_baud - 38400 - OK + +Test termios setting device character size ... +tcsetattr(TCSANOW, CS5) - OK +set_attributes - B38400 5-NONE-1 +tcsetattr(TCSADRAIN, CS5) - OK +set_attributes - B38400 5-NONE-1 +tcsetattr(TCSANOW, CS6) - OK +set_attributes - B38400 6-NONE-1 +tcsetattr(TCSADRAIN, CS6) - OK +set_attributes - B38400 6-NONE-1 +tcsetattr(TCSANOW, CS7) - OK +set_attributes - B38400 7-NONE-1 +tcsetattr(TCSADRAIN, CS7) - OK +set_attributes - B38400 7-NONE-1 +tcsetattr(TCSANOW, CS8) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSADRAIN, CS8) - OK +set_attributes - B38400 8-NONE-1 +Init - close - /dev/test - OK + +Init - open - /dev/test - OK +Termios_test_driver - rtems_set_initial_baud - bad baud - OK +Termios_test_driver - rtems_set_initial_baud - 38400 - OK + +Test termios setting device parity ... +tcsetattr(TCSANOW, none) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSADRAIN, none) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSANOW, even) - OK +set_attributes - B38400 8-ODD-1 +tcsetattr(TCSADRAIN, even) - OK +set_attributes - B38400 8-ODD-1 +tcsetattr(TCSANOW, odd) - OK +set_attributes - B38400 8-EVEN-1 +tcsetattr(TCSADRAIN, odd) - OK +set_attributes - B38400 8-EVEN-1 +Init - close - /dev/test - OK + +Init - open - /dev/test - OK +Termios_test_driver - rtems_set_initial_baud - bad baud - OK +Termios_test_driver - rtems_set_initial_baud - 38400 - OK + +Test termios setting device character size ... +tcsetattr(TCSANOW, 1 bit) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSADRAIN, 1 bits) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSANOW, 2 bits) - OK +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSADRAIN, 2 bits) - OK +set_attributes - B38400 8-NONE-2 +Init - close - /dev/test - OK +*** END OF TEST TERMIOS 01 *** -- cgit v1.2.3