summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>1999-03-31 23:22:42 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>1999-03-31 23:22:42 +0000
commit3f06c298b40b50d228d50627b59cea448e46ed26 (patch)
tree2143fc047185063aa02ba8e3fafb1735dcde1386
parentFixed paths to include files so this will build. (diff)
downloadrtems-3f06c298b40b50d228d50627b59cea448e46ed26.tar.bz2
Added prints for calls into the file system. Added O_EXCL for an open that
tested that the same file could not be created twice.
-rw-r--r--c/src/tests/psxtests/psxfile01/test.c33
-rw-r--r--testsuites/psxtests/psxfile01/test.c33
2 files changed, 56 insertions, 10 deletions
diff --git a/c/src/tests/psxtests/psxfile01/test.c b/c/src/tests/psxtests/psxfile01/test.c
index bbfaafdace..c086b3df1a 100644
--- a/c/src/tests/psxtests/psxfile01/test.c
+++ b/c/src/tests/psxtests/psxfile01/test.c
@@ -232,24 +232,33 @@ int main(
status = rmdir( "/usr" );
assert( !status );
+ puts( "rmdir /dev" );
status = rmdir( "/dev" );
assert( status == -1 );
assert( errno == ENOTEMPTY);
+ puts( "rmdir /fred" );
status = rmdir ("/fred");
assert (status == -1);
assert( errno == ENOENT );
+ puts( "mknod /dev/test_console" );
status = mknod( "/dev/test_console", S_IFCHR, 0LL );
assert( !status );
+
+ puts( "mknod /dev/tty/S3" );
status = mknod( "/dev/tty/S3", S_IFCHR, 0xFF00000080LL );
assert( !status );
+
+ puts ("mknod /etc/passwd");
status = mknod( "/etc/passwd", (S_IFREG | S_IRWXU), 0LL );
assert( !status );
+ puts( "mkdir /tmp/my_dir");
status = mkdir( "/tmp/my_dir", S_IRWXU );
assert( status == 0 );
+ puts("mkfifo /c/my_dir" );
status = mkfifo( "/c/my_dir", S_IRWXU );
assert( status == -1 );
@@ -278,13 +287,13 @@ int main(
puts( "open /tmp/j" );
fd = open( "/tmp/j", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
assert( fd != -1 );
-
printf( "open returned file descriptor %d\n", fd );
puts( "close /tmp/j" );
status = close( fd );
assert( !status );
+ puts( "close /tmp/j again" );
status = close( fd );
assert( status == -1 );
@@ -292,6 +301,7 @@ int main(
status = unlink( "/tmp/j" );
assert( !status );
+ puts( "unlink /tmp" );
status = unlink( "/tmp" );
assert( status );
@@ -299,13 +309,22 @@ int main(
* Simple open failure. Trying to create an existing file.
*/
- fd = open( "/tmp/tom", O_CREAT );
+ puts("create and close /tmp/tom");
+ fd = open( "/tmp/tom", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
+ assert( fd != -1 );
status = close( fd );
- fd1 = open( "/tmp/tom", O_CREAT );
- assert( fd1 == -1 );
+ assert( status == 0 );
- fd = open( "/tmp/john", O_CREAT );
+ puts("Attempt to recreate /tmp/tom");
+ fd = open( "/tmp/tom", O_CREAT | O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO );
+ assert( fd == -1 );
+ assert( errno == EEXIST );
+
+ puts("create /tmp/john");
+ fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
assert( fd != -1 );
+
+ puts("tcdrain /tmp/john" );
status = tcdrain( fd );
assert( status == 0 );
@@ -313,6 +332,7 @@ int main(
* Test simple write to a file at offset 0
*/
+ puts( "mknod /tmp/joel" );
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
test_write( "/tmp/joel", 0, "the first write!!!\n" );
test_cat( "/tmp/joel", 0, 0 );
@@ -336,14 +356,17 @@ int main(
* try to read from various offsets and lengths.
*/
+ puts("unlink /tmp/joel");
status = unlink( "/tmp/joel" );
assert( !status );
/* Test a failure path */
+ puts( "unlink /tmp/joel" );
status = unlink( "/tmp/joel" );
assert( status == -1 );
+ puts( "mknod /tmp/joel");
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
assert( !status );
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index bbfaafdace..c086b3df1a 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -232,24 +232,33 @@ int main(
status = rmdir( "/usr" );
assert( !status );
+ puts( "rmdir /dev" );
status = rmdir( "/dev" );
assert( status == -1 );
assert( errno == ENOTEMPTY);
+ puts( "rmdir /fred" );
status = rmdir ("/fred");
assert (status == -1);
assert( errno == ENOENT );
+ puts( "mknod /dev/test_console" );
status = mknod( "/dev/test_console", S_IFCHR, 0LL );
assert( !status );
+
+ puts( "mknod /dev/tty/S3" );
status = mknod( "/dev/tty/S3", S_IFCHR, 0xFF00000080LL );
assert( !status );
+
+ puts ("mknod /etc/passwd");
status = mknod( "/etc/passwd", (S_IFREG | S_IRWXU), 0LL );
assert( !status );
+ puts( "mkdir /tmp/my_dir");
status = mkdir( "/tmp/my_dir", S_IRWXU );
assert( status == 0 );
+ puts("mkfifo /c/my_dir" );
status = mkfifo( "/c/my_dir", S_IRWXU );
assert( status == -1 );
@@ -278,13 +287,13 @@ int main(
puts( "open /tmp/j" );
fd = open( "/tmp/j", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
assert( fd != -1 );
-
printf( "open returned file descriptor %d\n", fd );
puts( "close /tmp/j" );
status = close( fd );
assert( !status );
+ puts( "close /tmp/j again" );
status = close( fd );
assert( status == -1 );
@@ -292,6 +301,7 @@ int main(
status = unlink( "/tmp/j" );
assert( !status );
+ puts( "unlink /tmp" );
status = unlink( "/tmp" );
assert( status );
@@ -299,13 +309,22 @@ int main(
* Simple open failure. Trying to create an existing file.
*/
- fd = open( "/tmp/tom", O_CREAT );
+ puts("create and close /tmp/tom");
+ fd = open( "/tmp/tom", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
+ assert( fd != -1 );
status = close( fd );
- fd1 = open( "/tmp/tom", O_CREAT );
- assert( fd1 == -1 );
+ assert( status == 0 );
- fd = open( "/tmp/john", O_CREAT );
+ puts("Attempt to recreate /tmp/tom");
+ fd = open( "/tmp/tom", O_CREAT | O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO );
+ assert( fd == -1 );
+ assert( errno == EEXIST );
+
+ puts("create /tmp/john");
+ fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
assert( fd != -1 );
+
+ puts("tcdrain /tmp/john" );
status = tcdrain( fd );
assert( status == 0 );
@@ -313,6 +332,7 @@ int main(
* Test simple write to a file at offset 0
*/
+ puts( "mknod /tmp/joel" );
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
test_write( "/tmp/joel", 0, "the first write!!!\n" );
test_cat( "/tmp/joel", 0, 0 );
@@ -336,14 +356,17 @@ int main(
* try to read from various offsets and lengths.
*/
+ puts("unlink /tmp/joel");
status = unlink( "/tmp/joel" );
assert( !status );
/* Test a failure path */
+ puts( "unlink /tmp/joel" );
status = unlink( "/tmp/joel" );
assert( status == -1 );
+ puts( "mknod /tmp/joel");
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
assert( !status );