summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-14 15:59:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-14 15:59:37 +0000
commit8cd0bb0f00271f13959b72d0d853eca32ee1076c (patch)
treedf9d73665a222eaa52a9769c78fa876df3188500 /testsuites
parent2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-8cd0bb0f00271f13959b72d0d853eca32ee1076c.tar.bz2
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* termios01/init.c, termios01/termios01.scn: Fully exercise tcsetattr.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/ChangeLog4
-rw-r--r--testsuites/libtests/termios01/init.c46
-rw-r--r--testsuites/libtests/termios01/termios01.scn6
3 files changed, 45 insertions, 11 deletions
diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog
index 9bf4e04a6c..ae6f3af3df 100644
--- a/testsuites/libtests/ChangeLog
+++ b/testsuites/libtests/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * termios01/init.c, termios01/termios01.scn: Fully exercise tcsetattr.
+
2010-07-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add test for exercising sbrk() extension
diff --git a/testsuites/libtests/termios01/init.c b/testsuites/libtests/termios01/init.c
index c73e5f3bf8..7276fce144 100644
--- a/testsuites/libtests/termios01/init.c
+++ b/testsuites/libtests/termios01/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2009.
+ * COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -122,10 +122,7 @@ void test_termios_baud2index(void)
int i;
int index;
- puts(
- "\n"
- "Test termios_baud2index..."
- );
+ puts( "Test termios_baud2index..." );
puts( "termios_baud_to_index(-2) - NOT OK" );
i = rtems_termios_baud_to_index( -2 );
rtems_test_assert( i == -1 );
@@ -168,7 +165,10 @@ void test_termios_baud2number(void)
rtems_test_assert( i == -1 );
for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
- printf( "termios_baud_to_number(B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
+ printf(
+ "termios_baud_to_number(B%" PRIdrtems_termios_baud_t ") - OK\n",
+ baud_table[i].baud
+ );
number = rtems_termios_baud_to_number( baud_table[i].constant );
if ( number != baud_table[i].baud ) {
printf(
@@ -202,7 +202,10 @@ void test_termios_number_to_baud(void)
rtems_test_assert( i == -1 );
for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
- printf( "termios_number_to_baud(B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
+ printf(
+ "termios_number_to_baud(B%" PRIdrtems_termios_baud_t ") - OK\n",
+ baud_table[i].baud
+ );
termios_baud = rtems_termios_number_to_baud( baud_table[i].baud );
if ( termios_baud != baud_table[i].constant ) {
printf(
@@ -237,14 +240,20 @@ void test_termios_set_baud(
attr.c_cflag &= ~CBAUD;
attr.c_cflag |= baud_table[i].constant;
- printf( "tcsetattr(TCSANOW, B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
+ printf(
+ "tcsetattr(TCSANOW, B%" PRIdrtems_termios_baud_t ") - OK\n",
+ baud_table[i].baud
+ );
sc = tcsetattr( test, TCSANOW, &attr );
if ( sc != 0 ) {
printf( "ERROR - return %d\n", sc );
rtems_test_exit(0);
}
- printf( "tcsetattr(TCSADRAIN, B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
+ printf(
+ "tcsetattr(TCSADRAIN, B%" PRIdrtems_termios_baud_t ") - OK\n",
+ baud_table[i].baud
+ );
sc = tcsetattr( test, TCSANOW, &attr );
if ( sc != 0 ) {
printf( "ERROR - return %d\n", sc );
@@ -452,6 +461,7 @@ rtems_task Init(
rtems_status_code sc;
rtems_device_major_number registered;
int test;
+ struct termios t;
puts( "\n\n*** TEST TERMIOS 01 ***" );
@@ -459,6 +469,24 @@ 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 );
+
+ /*
+ * Register a driver
+ */
puts(
"\n"
"Init - rtems_io_register_driver - Termios Test Driver - OK"
diff --git a/testsuites/libtests/termios01/termios01.scn b/testsuites/libtests/termios01/termios01.scn
index e6cbbead39..434757015f 100644
--- a/testsuites/libtests/termios01/termios01.scn
+++ b/testsuites/libtests/termios01/termios01.scn
@@ -1,5 +1,4 @@
*** TEST TERMIOS 01 ***
-
Test termios_baud2index...
termios_baud_to_index(-2) - NOT OK
termios_baud_to_index(572) - NOT OK
@@ -33,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) - OK
+termios_baud_to_number(B200) - O
termios_baud_to_number(B300) - OK
termios_baud_to_number(B600) - OK
termios_baud_to_number(B1200) - OK
@@ -71,6 +70,9 @@ 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