summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-09 14:36:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-09 14:36:47 +0000
commit2e54cdc4d85a3b5d8d98ddcee2c3de6322e6af2c (patch)
tree56decc236f29385af6f03be21f8f2cc8f88f8490 /testsuites/libtests
parent2010-08-09 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-2e54cdc4d85a3b5d8d98ddcee2c3de6322e6af2c.tar.bz2
2010-08-09 Bharath Suri <bharath.s.jois@gmail.com>
PR 1661/testing * termios01/init.c, termios01/termios_testdriver.c, termios01/termios01.scn: Changes to improve coverage of rtems_termios_open routine.
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/ChangeLog7
-rw-r--r--testsuites/libtests/termios01/init.c49
-rw-r--r--testsuites/libtests/termios01/termios01.scn89
-rw-r--r--testsuites/libtests/termios01/termios_testdriver.c40
4 files changed, 126 insertions, 59 deletions
diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog
index 23886bbb25..64f6ed19cb 100644
--- a/testsuites/libtests/ChangeLog
+++ b/testsuites/libtests/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-09 Bharath Suri <bharath.s.jois@gmail.com>
+
+ PR 1661/testing
+ * termios01/init.c, termios01/termios_testdriver.c,
+ termios01/termios01.scn: Changes to improve coverage of
+ rtems_termios_open routine.
+
2010-08-06 Bharath Suri <bharath.s.jois@gmail.com>
PR 1654/testing
diff --git a/testsuites/libtests/termios01/init.c b/testsuites/libtests/termios01/init.c
index 7276fce144..ce2afe456d 100644
--- a/testsuites/libtests/termios01/init.c
+++ b/testsuites/libtests/termios01/init.c
@@ -469,21 +469,9 @@ rtems_task Init(
test_termios_baud2number();
test_termios_number_to_baud();
- /*
- * tcsetattr - ERROR invalid operation
- */
- puts( "tcsetattr - invalid operation - ENOTSUP" );
- rc = tcsetattr( 0, 0x12345, &t );
- rtems_test_assert( rc == -1 );
- rtems_test_assert( errno == ENOTSUP );
-
- /*
- * tcsetattr - TCSADRAIN
- */
- puts( "\ntcsetattr - drain - OK" );
- rc = tcsetattr( 1, TCSADRAIN, &t );
- rtems_test_assert( rc == 0 );
-
+ sc = rtems_termios_bufsize( 256, 138, 64 );
+ directive_failed( sc, "rtems_termios_bufsize" );
+
/*
* Register a driver
*/
@@ -505,6 +493,21 @@ rtems_task Init(
rtems_test_exit(0);
}
+ /*
+ * tcsetattr - ERROR invalid operation
+ */
+ puts( "tcsetattr - invalid operation - ENOTSUP" );
+ rc = tcsetattr( test, 0x12345, &t );
+ rtems_test_assert( rc == -1 );
+ rtems_test_assert( errno == ENOTSUP );
+
+ /*
+ * tcsetattr - TCSADRAIN
+ */
+ puts( "\ntcsetattr - drain - OK" );
+ rc = tcsetattr( test, TCSADRAIN, &t );
+ rtems_test_assert( rc == 0 );
+
test_termios_set_baud(test);
puts( "Init - close - " TERMIOS_TEST_DRIVER_DEVICE_NAME " - OK" );
@@ -588,6 +591,22 @@ rtems_task Init(
rtems_test_exit(0);
}
+ /*
+ TODO: This must be enabled, but is facing a strange problem
+ where the code dies off at rtems_termios_open.
+ */
+
+ /*
+ puts( "Multiple open of the device" );
+ for( ; index < 26; ++index ) {
+ printf( "...%d ", index );
+ test = open( TERMIOS_TEST_DRIVER_DEVICE_NAME, O_RDWR );
+ rtems_test_assert( test != -1 );
+ rc = close( test );
+ rtems_test_assert( rc == 0 );
+ }
+ puts( "" );
+ */
puts( "*** END OF TEST TERMIOS 01 ***" );
rtems_test_exit(0);
}
diff --git a/testsuites/libtests/termios01/termios01.scn b/testsuites/libtests/termios01/termios01.scn
index 434757015f..9eee32c45d 100644
--- a/testsuites/libtests/termios01/termios01.scn
+++ b/testsuites/libtests/termios01/termios01.scn
@@ -32,7 +32,7 @@ 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) - O
+termios_baud_to_number(B200) - OK
termios_baud_to_number(B300) - OK
termios_baud_to_number(B600) - OK
termios_baud_to_number(B1200) - OK
@@ -70,9 +70,6 @@ termios_number_to_baud(B57600) - OK
termios_number_to_baud(B115200) - OK
termios_number_to_baud(B230400) - OK
termios_number_to_baud(B460800) - OK
-tcsetattr - invalid operation - ENOTSUP
-
-tcsetattr - drain - OK
Init - rtems_io_register_driver - Termios Test Driver - OK
Termios_test_driver - rtems_io_register /dev/test - OK
@@ -80,87 +77,91 @@ 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
+tcsetattr - invalid operation - ENOTSUP
+
+tcsetattr - drain - OK
+set_attributes - B0 5-NONE-1
Test termios setting device baud rate...
tcsetattr(TCSANOW, B0) - OK
-set_attributes - B0 8-NONE-1
+set_attributes - B0 5-NONE-1
tcsetattr(TCSADRAIN, B0) - OK
-set_attributes - B0 8-NONE-1
+set_attributes - B0 5-NONE-1
tcsetattr(TCSANOW, B50) - OK
-set_attributes - B50 8-NONE-1
+set_attributes - B50 5-NONE-1
tcsetattr(TCSADRAIN, B50) - OK
-set_attributes - B50 8-NONE-1
+set_attributes - B50 5-NONE-1
tcsetattr(TCSANOW, B75) - OK
-set_attributes - B75 8-NONE-1
+set_attributes - B75 5-NONE-1
tcsetattr(TCSADRAIN, B75) - OK
-set_attributes - B75 8-NONE-1
+set_attributes - B75 5-NONE-1
tcsetattr(TCSANOW, B110) - OK
-set_attributes - B110 8-NONE-1
+set_attributes - B110 5-NONE-1
tcsetattr(TCSADRAIN, B110) - OK
-set_attributes - B110 8-NONE-1
+set_attributes - B110 5-NONE-1
tcsetattr(TCSANOW, B134) - OK
-set_attributes - B134 8-NONE-1
+set_attributes - B134 5-NONE-1
tcsetattr(TCSADRAIN, B134) - OK
-set_attributes - B134 8-NONE-1
+set_attributes - B134 5-NONE-1
tcsetattr(TCSANOW, B150) - OK
-set_attributes - B150 8-NONE-1
+set_attributes - B150 5-NONE-1
tcsetattr(TCSADRAIN, B150) - OK
-set_attributes - B150 8-NONE-1
+set_attributes - B150 5-NONE-1
tcsetattr(TCSANOW, B200) - OK
-set_attributes - B200 8-NONE-1
+set_attributes - B200 5-NONE-1
tcsetattr(TCSADRAIN, B200) - OK
-set_attributes - B200 8-NONE-1
+set_attributes - B200 5-NONE-1
tcsetattr(TCSANOW, B300) - OK
-set_attributes - B300 8-NONE-1
+set_attributes - B300 5-NONE-1
tcsetattr(TCSADRAIN, B300) - OK
-set_attributes - B300 8-NONE-1
+set_attributes - B300 5-NONE-1
tcsetattr(TCSANOW, B600) - OK
-set_attributes - B600 8-NONE-1
+set_attributes - B600 5-NONE-1
tcsetattr(TCSADRAIN, B600) - OK
-set_attributes - B600 8-NONE-1
+set_attributes - B600 5-NONE-1
tcsetattr(TCSANOW, B1200) - OK
-set_attributes - B1200 8-NONE-1
+set_attributes - B1200 5-NONE-1
tcsetattr(TCSADRAIN, B1200) - OK
-set_attributes - B1200 8-NONE-1
+set_attributes - B1200 5-NONE-1
tcsetattr(TCSANOW, B1800) - OK
-set_attributes - B1800 8-NONE-1
+set_attributes - B1800 5-NONE-1
tcsetattr(TCSADRAIN, B1800) - OK
-set_attributes - B1800 8-NONE-1
+set_attributes - B1800 5-NONE-1
tcsetattr(TCSANOW, B2400) - OK
-set_attributes - B2400 8-NONE-1
+set_attributes - B2400 5-NONE-1
tcsetattr(TCSADRAIN, B2400) - OK
-set_attributes - B2400 8-NONE-1
+set_attributes - B2400 5-NONE-1
tcsetattr(TCSANOW, B4800) - OK
-set_attributes - B4800 8-NONE-1
+set_attributes - B4800 5-NONE-1
tcsetattr(TCSADRAIN, B4800) - OK
-set_attributes - B4800 8-NONE-1
+set_attributes - B4800 5-NONE-1
tcsetattr(TCSANOW, B9600) - OK
-set_attributes - B9600 8-NONE-1
+set_attributes - B9600 5-NONE-1
tcsetattr(TCSADRAIN, B9600) - OK
-set_attributes - B9600 8-NONE-1
+set_attributes - B9600 5-NONE-1
tcsetattr(TCSANOW, B19200) - OK
-set_attributes - B19200 8-NONE-1
+set_attributes - B19200 5-NONE-1
tcsetattr(TCSADRAIN, B19200) - OK
-set_attributes - B19200 8-NONE-1
+set_attributes - B19200 5-NONE-1
tcsetattr(TCSANOW, B38400) - OK
-set_attributes - B38400 8-NONE-1
+set_attributes - B38400 5-NONE-1
tcsetattr(TCSADRAIN, B38400) - OK
-set_attributes - B38400 8-NONE-1
+set_attributes - B38400 5-NONE-1
tcsetattr(TCSANOW, B57600) - OK
-set_attributes - B57600 8-NONE-1
+set_attributes - B57600 5-NONE-1
tcsetattr(TCSADRAIN, B57600) - OK
-set_attributes - B57600 8-NONE-1
+set_attributes - B57600 5-NONE-1
tcsetattr(TCSANOW, B115200) - OK
-set_attributes - B115200 8-NONE-1
+set_attributes - B115200 5-NONE-1
tcsetattr(TCSADRAIN, B115200) - OK
-set_attributes - B115200 8-NONE-1
+set_attributes - B115200 5-NONE-1
tcsetattr(TCSANOW, B230400) - OK
-set_attributes - B230400 8-NONE-1
+set_attributes - B230400 5-NONE-1
tcsetattr(TCSADRAIN, B230400) - OK
-set_attributes - B230400 8-NONE-1
+set_attributes - B230400 5-NONE-1
tcsetattr(TCSANOW, B460800) - OK
-set_attributes - B460800 8-NONE-1
+set_attributes - B460800 5-NONE-1
tcsetattr(TCSADRAIN, B460800) - OK
-set_attributes - B460800 8-NONE-1
+set_attributes - B460800 5-NONE-1
Init - close - /dev/test - OK
Init - open - /dev/test - OK
diff --git a/testsuites/libtests/termios01/termios_testdriver.c b/testsuites/libtests/termios01/termios_testdriver.c
index 699e0a9e89..4b46af51a5 100644
--- a/testsuites/libtests/termios01/termios_testdriver.c
+++ b/testsuites/libtests/termios01/termios_testdriver.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <termios.h>
#include <rtems/termiostypes.h>
+#include <rtems/libcsupport.h>
#include "termios_testdriver.h"
int termios_test_driver_inbyte_nonblocking( int port )
@@ -138,6 +139,10 @@ rtems_device_driver termios_test_driver_open(
rtems_status_code sc;
int rc;
rtems_libio_open_close_args_t *args = arg;
+ void *alloc_ptr = (void *)0;
+ static int test = 0;
+ size_t freeMemory;
+
static const rtems_termios_callbacks Callbacks = {
NULL, /* firstOpen */
NULL, /* lastClose */
@@ -154,6 +159,41 @@ rtems_device_driver termios_test_driver_open(
rtems_test_exit(0);
}
+ freeMemory = malloc_free_space();
+ if( test == 0 ) {
+ alloc_ptr = malloc( freeMemory - 4 );
+
+ sc = rtems_termios_open (major, minor, arg, &Callbacks);
+ rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+ free( alloc_ptr );
+ alloc_ptr = malloc( freeMemory - 4 - 10 -
+ sizeof( struct rtems_termios_tty ) );
+
+ sc = rtems_termios_open (major, minor, arg, &Callbacks);
+ rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+ free( alloc_ptr );
+ alloc_ptr = malloc( freeMemory - 4 - 20 -
+ sizeof( struct rtems_termios_tty ) -
+ 128 );
+
+ sc = rtems_termios_open (major, minor, arg, &Callbacks);
+ rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+ free( alloc_ptr );
+ alloc_ptr = malloc( freeMemory - 4 - 20 -
+ sizeof( struct rtems_termios_tty ) -
+ 128 -
+ 80 );
+
+ sc = rtems_termios_open (major, minor, arg, &Callbacks);
+ rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+ free( alloc_ptr );
+ test = 1;
+ }
+
sc = rtems_termios_open (major, minor, arg, &Callbacks);
directive_failed( sc, "rtems_termios_open" );