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.
This commit is contained in:
Joel Sherrill
2010-07-08 19:37:01 +00:00
parent c302d31ad5
commit 21827289f3
3 changed files with 22 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
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.
2010-07-07 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1606/cpukit

View File

@@ -1,12 +1,9 @@
sparc-rtems4.11-run is /opt/rtems-4.11/bin/sparc-rtems4.11-run
*** FILE TEST 1 ***
*************** Dump of Entire IMFS ***************
/
....dev/
........console (device 0, 0)
........console_b (device 0, 1)
*************** End of Dump ***************
stat of /dev/console
....st_dev (0xfffe:0x0)
@@ -51,6 +48,7 @@ create and close /tmp/tom
Attempt to recreate /tmp/tom
create /tmp/john
tcdrain /tmp/john
Attempt to create a file, open in read-only mode and truncate it
mknod /tmp/joel
(0)the first write!!!
@@ -168,9 +166,8 @@ This is call 5 to fprintf
/
....dev/
........console (device 0, 0)
........console_b (device 0, 1)
........tty/
............S3 (device 255, 128)
............S3 (device 128, 255)
........test_console (device 0, 0)
....etc/
........passwd (file 0)
@@ -199,9 +196,8 @@ truncate /tmp/j to length of 40
/
....dev/
........console (device 0, 0)
........console_b (device 0, 1)
........tty/
............S3 (device 255, 128)
............S3 (device 128, 255)
........test_console (device 0, 0)
....etc/
........passwd (file 0)
@@ -221,9 +217,8 @@ truncate /tmp to length of 0 should fail with EISDIR
/
....dev/
........console (device 0, 0)
........console_b (device 0, 1)
........tty/
............S3 (device 255, 128)
............S3 (device 128, 255)
........test_console (device 0, 0)
....etc/
........passwd (file 0)

View File

@@ -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
*/