summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-08 19:37:01 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-08 19:37:01 +0000
commit21827289f30c9ce4c8411304ec542aa665c051d7 (patch)
treea41200584b0319f02bf9d8f514e8085798a25593 /testsuites
parentRegenerate. (diff)
downloadrtems-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 'testsuites')
-rw-r--r--testsuites/psxtests/ChangeLog6
-rw-r--r--testsuites/psxtests/psxfile01/psxfile01.scn13
-rw-r--r--testsuites/psxtests/psxfile01/test.c12
3 files changed, 22 insertions, 9 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 98927c1425..a27e0e2b71 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -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
diff --git a/testsuites/psxtests/psxfile01/psxfile01.scn b/testsuites/psxtests/psxfile01/psxfile01.scn
index e3fc50095a..f4bbe70c59 100644
--- a/testsuites/psxtests/psxfile01/psxfile01.scn
+++ b/testsuites/psxtests/psxfile01/psxfile01.scn
@@ -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)
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
*/