summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxdevctl01/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests/psxdevctl01/test.c')
-rw-r--r--testsuites/psxtests/psxdevctl01/test.c69
1 files changed, 46 insertions, 23 deletions
diff --git a/testsuites/psxtests/psxdevctl01/test.c b/testsuites/psxtests/psxdevctl01/test.c
index b45725cb58..2fe7df1834 100644
--- a/testsuites/psxtests/psxdevctl01/test.c
+++ b/testsuites/psxtests/psxdevctl01/test.c
@@ -53,37 +53,16 @@ int main(
int dev_data;
void *dev_data_ptr;
size_t nbyte;
- int dev_info;
TEST_BEGIN();
- puts( "posix_devctl() FIONBIO on stdin return dev_info -- EBADF" );
- fd = 0;
- dcmd = FIONBIO;
- dev_data_ptr = &dev_data;
- nbyte = sizeof(dev_data);
- status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, &dev_info );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBADF );
- rtems_test_assert( dev_info == 0 );
-
- puts( "posix_devctl() FIONBIO on stdin NULL dev_info -- EBADF" );
- fd = 0;
- dcmd = FIONBIO;
- dev_data_ptr = NULL;
- nbyte = 0;
- status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBADF );
-
puts( "posix_devctl() SOCKCLOSE on invalid file descriptor -- EBADF" );
- fd = 21;
+ fd = -1;
dcmd = SOCKCLOSE;
dev_data_ptr = NULL;
nbyte = 0;
status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBADF );
+ rtems_test_assert( status == EBADF );
/*
* Create a file, open it, and close it via posix_devctl().
@@ -102,6 +81,50 @@ int main(
status = close( fd );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EBADF );
+
+ puts( "posix_devctl() FIONBIO with invalid nbyte -- EINVAL" );
+ fd = 0;
+ dcmd = FIONBIO;
+ dev_data_ptr = NULL;
+ nbyte = 0;
+ status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
+ rtems_test_assert( status == EINVAL );
+
+ puts( "posix_devctl() FIONBIO with invalid file descriptor -- EBADF" );
+ fd = -1;
+ dcmd = FIONBIO;
+ dev_data_ptr = NULL;
+ nbyte = sizeof(int);
+ status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
+ rtems_test_assert( status == EBADF );
+
+ puts( "posix_devctl() FIONBIO flag not zero -- 0" );
+ fd = 0;
+ dcmd = FIONBIO;
+ dev_data = 1;
+ dev_data_ptr = &dev_data;
+ nbyte = sizeof(int);
+ status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
+ rtems_test_assert( status == 0 );
+
+ puts( "posix_devctl() FIONBIO flag is zero -- 0" );
+ fd = 0;
+ dcmd = FIONBIO;
+ dev_data = 0;
+ dev_data_ptr = &dev_data;
+ nbyte = sizeof(int);
+ status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
+ rtems_test_assert( status == 0 );
+
+ puts( "posix_devctl() dcmd not valid value -- EBADF" );
+ fd = 0;
+ dcmd = 1;
+ dev_data = 0;
+ dev_data_ptr = &dev_data;
+ nbyte = sizeof(int);
+ status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL );
+ rtems_test_assert( status == EBADF );
+
TEST_END();
exit(0);
}