diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-08 19:37:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-08 19:37:01 +0000 |
commit | 21827289f30c9ce4c8411304ec542aa665c051d7 (patch) | |
tree | a41200584b0319f02bf9d8f514e8085798a25593 /testsuites/psxtests/psxfile01/test.c | |
parent | Regenerate. (diff) | |
download | rtems-21827289f30c9ce4c8411304ec542aa665c051d7.tar.bz2 |
2010-07-08 Bharath Suri <bharath.s.jois@gmail.com>
PR 1608/testing
* psxfile01/init.c: Add a simple test case: Open file as read-only
and attemp to truncate. Improves coverage.
Diffstat (limited to '')
-rw-r--r-- | testsuites/psxtests/psxfile01/test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c index 6e8fd22bb4..bcecbcea37 100644 --- a/testsuites/psxtests/psxfile01/test.c +++ b/testsuites/psxtests/psxfile01/test.c @@ -329,6 +329,18 @@ int main( status = tcdrain( fd ); rtems_test_assert( status == 0 ); + /* + * Open a file in read-only mode and try to truncate + */ + + puts( "Attempt to create a file, open in read-only mode and truncate it" ); + fd = open( "/tmp/bha", O_CREAT | O_RDONLY | O_TRUNC, S_IRUSR ); + rtems_test_assert( fd == -1 ); + rtems_test_assert( errno == EINVAL ); + + status = unlink( "/tmp/bha" ); + rtems_test_assert( status == 0 ); + /* * Test simple write to a file at offset 0 */ |