Cleaned up test.

Updated scn files to match present expected test output.
This commit is contained in:
Jennifer Averett
1998-12-03 22:41:57 +00:00
parent 5b8e885dd7
commit c2f9b97543
14 changed files with 960 additions and 640 deletions

View File

@@ -0,0 +1,15 @@
Files initialized successfully.
Testing device_lseek()... Success.
Testing dup()............ Success.
Testing dup2()........... Success.
Testing fdatasync()...... Success.
Testing umask().......... Success.
Testing utime().......... Success.
Testing pipe()........... Success.
Testing fsync().......... Success.
Testing pathconf()....... Success.
Testing fpathconf()...... Success.
*** END OF TEST PSX13 ***

View File

@@ -161,8 +161,8 @@ int DupTest(void) {
if (fd2 != -1) { if (fd2 != -1) {
fcntl(F_SETFL, fd1, O_APPEND); fcntl(fd1, F_SETFL, O_APPEND);
flags = fcntl(F_GETFL, fd2); flags = fcntl(fd2, F_GETFL);
close (fd1); close (fd1);
@@ -214,8 +214,8 @@ int Dup2Test(void) {
if (error != -1) { if (error != -1) {
fcntl(F_SETFL, fd1, O_APPEND); fcntl(fd1, F_SETFL, O_APPEND);
flags = fcntl(F_GETFL, fd1); flags = fcntl(fd1, F_GETFL);
flags = (flags & O_APPEND); flags = (flags & O_APPEND);
retval = (flags == O_APPEND); retval = (flags == O_APPEND);
@@ -600,76 +600,74 @@ int main(
#endif #endif
{ {
if (InitFiles() == TRUE) { if (InitFiles() == TRUE) {
puts ("\nFiles initialized successfully.\n"); printf ("\nFiles initialized successfully.\n");
puts ("Testing device_lseek()..."); printf ("Testing device_lseek()... ");
if (DeviceLSeekTest() == TRUE) if (DeviceLSeekTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing dup()..."); printf ("Testing dup()............ ");
if (DupTest() == TRUE) if (DupTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing dup2()..."); printf ("Testing dup2()........... ");
if (Dup2Test() == TRUE) if (Dup2Test() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fdatasync()..."); printf ("Testing fdatasync()...... ");
if (FDataSyncTest() == TRUE) if (FDataSyncTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing umask()..."); printf ("Testing umask().......... ");
if (UMaskTest() == TRUE) if (UMaskTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing utime()..."); printf ("Testing utime().......... ");
if (UTimeTest() == TRUE) if (UTimeTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing pipe()..."); printf ("Testing pipe()........... ");
if (PipeTest() == TRUE) if (PipeTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fsync()..."); printf ("Testing fsync().......... ");
if (FSyncTest() == TRUE) if (FSyncTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing pathconf()..."); printf ("Testing pathconf()....... ");
if (PathConfTest() == TRUE) if (PathConfTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fpathconf()..."); printf ("Testing fpathconf()...... ");
if (FPathConfTest() == TRUE) if (FPathConfTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
} }
else else
puts ("\n\nError opening files for write!!!!\n"); printf ("\n\nError opening files for write!!!!\n");
puts( "\n\n*** XXX ***" ); printf( "\n\n*** END OF TEST PSX13 ***" );
puts( "\n\n*** END OF TEST PSX13 ***" );
exit(0); exit(0);
} }

View File

@@ -1,168 +1,168 @@
*** FILE TEST 1 *** *** FILE TEST 1 ***
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
*************** End of Dump *************** *************** End of Dump ***************
stat of /dev/console stat of /dev/console
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino 3 st_ino 3
mode = 00020771 mode = 00020771
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Fri Jan 01 00:00:00 1988 atime = Fri Jan 01 00:00:00 1988
mtime = Fri Jan 01 00:00:00 1988 mtime = Fri Jan 01 00:00:00 1988
ctime = Fri Jan 01 00:00:00 1988 ctime = Fri Jan 01 00:00:00 1988
mkdir /dev/tty mkdir /dev/tty
mkdir /usr mkdir /usr
mkdir /etc mkdir /etc
mkdir /tmp mkdir /tmp
mkdir /tmp/.. mkdir /tmp/..
mkdir /tmp/ mkdir /tmp/
mkdir /j/j1 mkdir /j/j1
mkdir tmp mkdir tmp
rmdir /usr rmdir /usr
mkdir /etc/passwd/j mkdir /etc/passwd/j
open /tmp/joel - should fail with ENOENT open /tmp/joel - should fail with ENOENT
open /tmp/j open /tmp/j
open returned file descriptor 3 open returned file descriptor 3
close /tmp/j close /tmp/j
unlink /tmp/j unlink /tmp/j
(0)the first write!!! (0)the first write!!!
(10)the first write!!! (10)the first write!!!
stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0) stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0)
st_ino d st_ino d
mode = 00100700 mode = 00100700
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
(514)the first write!!! (514)the first write!!!
(513)the first write!!! (513)the first write!!!
(24)the first write!!! (24)the first write!!!
(2)the first write!!! (2)the first write!!!
(1)the first write!!! (1)the first write!!!
(0)the first write!!! (0)the first write!!!
(0)rst write!!! (0)rst write!!!
(513)the first write!!! (513)the first write!!!
(139743) (139743)
stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0) stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0)
st_ino e st_ino e
mode = 00100700 mode = 00100700
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
stat of /tmp/j stat of /tmp/j
stat(/tmp/j) returned -1 (errno=2) stat(/tmp/j) returned -1 (errno=2)
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino 3 st_ino 3
mode = 00020771 mode = 00020771
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Fri Jan 01 00:00:00 1988 atime = Fri Jan 01 00:00:00 1988
mtime = Fri Jan 01 00:00:00 1988 mtime = Fri Jan 01 00:00:00 1988
ctime = Fri Jan 01 00:00:00 1988 ctime = Fri Jan 01 00:00:00 1988
fopen of /tmp/j fopen of /tmp/j
fprintf to /tmp/j fprintf to /tmp/j
(1) 26 characters written to the file (1) 26 characters written to the file
(2) 26 characters written to the file (2) 26 characters written to the file
(3) 26 characters written to the file (3) 26 characters written to the file
(4) 26 characters written to the file (4) 26 characters written to the file
(5) 26 characters written to the file (5) 26 characters written to the file
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
This is call 1 to fprintf This is call 1 to fprintf
This is call 2 to fprintf This is call 2 to fprintf
This is call 3 to fprintf This is call 3 to fprintf
This is call 4 to fprintf This is call 4 to fprintf
This is call 5 to fprintf This is call 5 to fprintf
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:01 1988 atime = Sat Dec 31 09:00:01 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
joel (file 279487 0x3d5ac0 0x3d5570 0x3d5020) joel (file 279487 0x3d5ac0 0x3d5570 0x3d5020)
j (file 130 0x37f530 0x0 0x0) j (file 130 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
truncate /tmp/j to length of 40 truncate /tmp/j to length of 40
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:02 1988 atime = Sat Dec 31 09:00:02 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
j (file 40 0x37f530 0x0 0x0) j (file 40 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
truncate /tmp/j to length of 0 truncate /tmp/j to length of 0
truncate /tmp to length of 0 should fail with EISDIR truncate /tmp to length of 0 should fail with EISDIR
21: Is a directory 21: Is a directory
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
j (file 0 0x37f530 0x0 0x0) j (file 0 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
*** END OF FILE TEST 1 *** *** END OF FILE TEST 1 ***

View File

@@ -238,6 +238,7 @@ int main(
status = rmdir ("/fred"); status = rmdir ("/fred");
assert (status == -1); assert (status == -1);
assert( errno == ENOENT );
status = mknod( "/dev/test_console", S_IFCHR, 0LL ); status = mknod( "/dev/test_console", S_IFCHR, 0LL );
assert( !status ); assert( !status );

View File

@@ -0,0 +1,86 @@
*** MOUNT/UNMOUNT TEST ***
chdir to the root directory
chdir() status : 0
Creating a series of directories under /
Creating : a 0 0 Success
Creating : b 0 0 Success
Creating : c 0 0 Success
Creating : d 0 0 Success
Creating : e 0 0 Success
Creating : f 0 0 Success
Creating : c/y 0 0 Success
Creating : c/z 0 0 Success
Creating : c/x 0 0 Success
Creating : c/y/a3333 0 0 Success
Creating : c/y/j123 0 0 Success
Creating : c/y/my_mount_point 0 0 Success
Creating : c/y/my_mount_point/my_dir 0 0 Success
Creating : c/z/my_mount_point 0 0 Success
create /b/my_file
Verify /b/my_file
create c/y/my_mount_point/my_dir/d
Verify c/y/my_mount_point/my_dir/d
Attempting to mount IMFS file system at /c/z/my_mount_point
2nd file system successfully mounted at /c/z/my_mount_point
chdir to /c/z/my_mount_point.
chdir() status : 0
Creating a series of directories under /c/z/my_mount_point
Creating: a 0 2 Success
Creating: b 0 2 Success
Creating: c 0 2 Success
Creating: d 0 2 Success
Creating: e 0 2 Success
Creating: f 0 2 Success
Creating: c/y 0 2 Success
Creating: c/z 0 2 Success
Creating: c/x 0 2 Success
Creating: c/y/a3333 0 2 Success
Creating: c/y/j123 0 2 Success
Creating: c/y/my_mount_point 0 2 Success
Creating: c/y/my_mount_point/my_dir 0 2 Success
Creating: c/y/my_mount_point/my_dir/d 0 2 Success
Creating: c/z/my_mount_point 0 2 Success
Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g 0 2 Success
chdir to /
chdir() status : 0
Unmount status: 0
Mount a NULL file system and verify EINVAL
mount with option RA should fail with EINVAL
Mount a Read Only filesystem at /c/y/my_mount_point
Read only file system successfully mounted at /c/y/my_mount_point
create c/y/my_mount_point/../../y/my_mount_point/new_dir
Verify a mount point retruns EBUSY for another mount
Mount on a file should fail with ENOTDIR
Create and chdir to /c/y/my_mount_point/mydir
unmount of /c/y/my_mount_point should fail with EBUSY
chdir to / and verify we can unmount /c/y/my_mount_point
unmount /c/y/my_mount_point
unmount /b/mount_point should fail with EINVAL
Mount /c/y/my_mount_point
Create and open /c/y/my_mount_point/my_file
mkdir /c/y/my_mount_point/my_dir
Open /c/y/my_mount_point/my_dir
Unmount /c/y/my_mount_point should fail with EBUSY
Close /c/y/my_mount_point/my_dir
Unmount /c/y/my_mount_point/my_dir
Mount a file system at /c/y/my_mount_point/my_dir
unmount /c/y/my_mount_point should fail with EBUSY
Verify a hard link across filesystems fails with EXDEV
Verify a symbolic link across file systems works
unmount /c/y/my_mount_point/my_dir
Verify the symbolic link now fails
unmount /c/y/my_mount_point
*** END OF MOUNT/UNMOUNT TEST ***

View File

@@ -99,6 +99,11 @@ int main(
printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" ); printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" );
/*
* Change directory to the root and create files under
* the base file system.
*/
printf( "\nchdir to the root directory\n" ); printf( "\nchdir to the root directory\n" );
status = chdir( "/" ); status = chdir( "/" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -108,7 +113,7 @@ int main(
while ( strcmp(dnames[i], "END") != 0 ) while ( strcmp(dnames[i], "END") != 0 )
{ {
status = mkdir( dnames[i], 0777 ); status = mkdir( dnames[i], 0777 );
printf("Creating directory: %s %d %d ", dnames[i], status, errno ); printf("Creating : %25s %d %d ", dnames[i], status, errno );
if ( status == 0 ) if ( status == 0 )
printf(" Success\n"); printf(" Success\n");
else else
@@ -117,16 +122,36 @@ int main(
i++; i++;
} }
/*
* Create a Files with all rwx for others group and user. Verify
* the created file.
*/
printf("create /b/my_file\n");
fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close (fd); close (fd);
printf("Verify /b/my_file\n");
fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO); fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close( fd ); close( fd );
printf("create c/y/my_mount_point/my_dir/d\n");
fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close (fd); close (fd);
printf("Verify c/y/my_mount_point/my_dir/d\n");
fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO); fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close( fd ); close( fd );
/*
* Mount an the IMFS file system on the base file system.
*/
printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n"); printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n");
status = mount( status = mount(
&mt_entry, &mt_entry,
@@ -142,8 +167,12 @@ int main(
printf("2nd file system successfully mounted at /c/z/my_mount_point \n"); printf("2nd file system successfully mounted at /c/z/my_mount_point \n");
} }
printf( "\nchdir to /c/z/my_mount_point the mount point of the \n" ); /*
printf( "second file system \n" ); * Change directory to the mount point and create a group of files under
* the mounted file system.
*/
printf( "\nchdir to /c/z/my_mount_point.\n" );
status = chdir( "/c/z/my_mount_point" ); status = chdir( "/c/z/my_mount_point" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -152,7 +181,7 @@ int main(
while ( strcmp(fnames[i], "END") != 0 ) while ( strcmp(fnames[i], "END") != 0 )
{ {
status = mkdir( fnames[i], 0777 ); status = mkdir( fnames[i], 0777 );
printf("Creating directory: %s %d %d ", fnames[i], status, errno ); printf("Creating: %46s %d %d ", fnames[i], status, errno );
if ( status == 0 ) if ( status == 0 )
printf(" Success\n"); printf(" Success\n");
else { else {
@@ -167,7 +196,7 @@ int main(
i++; i++;
} }
printf( "\nchdir to / the mount point of the first file system \n" ); printf( "\nchdir to /\n" );
status = chdir( "/" ); status = chdir( "/" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -179,28 +208,12 @@ int main(
status = unmount( "/c/z/my_mount_point" ); status = unmount( "/c/z/my_mount_point" );
printf( " %d\n", status ); printf( " %d\n", status );
/*
status = chmod( "c/y/j123", S_IRUSR );
assert( status == 0 );
printf("Attempting to mount IMFS file system at c/y/j123\n"); /*
status = mount( * Mount a NULL filesystem and verify it fails.
&mt_entry, */
&IMFS_ops,
"RO",
NULL,
"c/y/j123" );
assert( status == 0 );
status = mkdir( "c/y/j123/new_dir", S_IRUSR ); printf("Mount a NULL file system and verify EINVAL\n");
assert( status == -1 );
printf("Unmount c/y/j123\n");
status = unmount( "c/y/j123" );
assert( status == 0 );
*/
printf(" File system type should be invalid.\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
NULL, NULL,
@@ -210,7 +223,25 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
printf("Attempting to mount IMFS file system at /c/y/my_mount_point \n"); /*
* Verify mount with option RA fails with EINVAL
*/
printf("mount with option RA should fail with EINVAL\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RA",
NULL,
"/c/y/my_mount_point" );
assert( status == -1 );
assert( errno == EINVAL );
/*
* Mount a Read Only File system.
*/
printf("Mount a Read Only filesystem at /c/y/my_mount_point \n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -222,18 +253,26 @@ int main(
printf(" NULL mount table entry was returned\n"); printf(" NULL mount table entry was returned\n");
} }
else { else {
printf("3rd file system successfully mounted at /c/y/my_mount_point \n"); printf("Read only file system successfully mounted at /c/y/my_mount_point \n");
} }
/*
* Create a directory that passes through the read only file system.
*/
printf("create c/y/my_mount_point/../../y/my_mount_point/new_dir\n");
status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU ); status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU );
assert( status == 0 ); assert( status == 0 );
status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf ); status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf );
assert( status == 0 ); assert( status == 0 );
status = stat("c/y/my_mount_point/new_dir/..", &statbuf ); status = stat("c/y/my_mount_point/new_dir/..", &statbuf );
assert( status == 0 ); assert( status == 0 );
printf("Mount another file system at /c/y/my_mount_point should fail with EBUSY\n"); /*
* Attempt to mount a second file system at a used mount point.
*/
printf("Verify a mount point retruns EBUSY for another mount\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -243,7 +282,11 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY); assert( errno == EBUSY);
printf("Mount /b/my_file should fail in rtems_filesystem_evaluate_path\n"); /*
* Attempt to mount at a file.
*/
printf("Mount on a file should fail with ENOTDIR\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -251,24 +294,14 @@ int main(
NULL, NULL,
"/b/my_file" ); "/b/my_file" );
assert( status == -1 ); assert( status == -1 );
assert( errno == ENOTDIR );
printf("Unmount /c/y/my_mount_point\n"); /*
status = unmount( "/c/y/my_mount_point" ); * Verify we cannot unmount a file system while we are in it.
assert( status == 0 ); */
/* What's wrong with this? It should be causing failure at unmount.c:87, printf("Create and chdir to /c/y/my_mount_point/mydir\n");
* instead, it's returning a status of 0.
*/
printf("Mount /c/y/my_mount_point to cause error\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RO",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
status = mkdir( "/c/y/my_mount_point/mydir", 0777); status = mkdir( "/c/y/my_mount_point/mydir", 0777);
assert( status == 0 ); assert( status == 0 );
@@ -280,6 +313,11 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY ); assert( errno == EBUSY );
/*
* Chdir to root and verify we can unmount the file system now.
*/
printf("chdir to / and verify we can unmount /c/y/my_mount_point\n");
status = chdir( "/" ); status = chdir( "/" );
assert( status == 0 ); assert( status == 0 );
@@ -287,9 +325,18 @@ int main(
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
printf(" unmount /b/mount_point should fail\n"); /*
* Attempt to unmount a directory that does not exist.
*/
printf(" unmount /b/mount_point should fail with EINVAL\n");
status = unmount( "/b/mount_point" ); status = unmount( "/b/mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == ENOENT );
/*
* Remount the filesystem.
*/
printf("Mount /c/y/my_mount_point\n"); printf("Mount /c/y/my_mount_point\n");
status = mount( status = mount(
@@ -300,9 +347,13 @@ int main(
"/c/y/my_mount_point" ); "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
/* XXX - There is an error in open that calculates incorrect mode. */ /*
* Create a file and directory then open the directory.
* Verify unmount will return EBUSY while directory is open.
*/
printf("Create and open /c/y/my_mount_point/my_file\n"); printf("Create and open /c/y/my_mount_point/my_file\n");
fd = open( "/c/y/my_mount_point/my_file", O_CREAT ); fd = open( "/c/y/my_mount_point/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != -1 ); assert( fd != -1 );
status = close( fd ); status = close( fd );
assert( status == 0 ); assert( status == 0 );
@@ -316,27 +367,25 @@ int main(
printf("Unmount /c/y/my_mount_point should fail with EBUSY\n"); printf("Unmount /c/y/my_mount_point should fail with EBUSY\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY );
printf("Close /c/y/my_mount_point/my_dir\n"); printf("Close /c/y/my_mount_point/my_dir\n");
status = closedir( directory ); status = closedir( directory );
assert( status == 0 ); assert( status == 0 );
printf("Unmount /c/y/my_mount_point/d should fail at 107\n"); /*
status = unmount( "/c/y/my_mount_point/d" ); * Attempt to unmount a directory that is not a mount point.
assert( status == -1 ); */
printf("unmount /c/y/my_mount_point\n"); printf("Unmount /c/y/my_mount_point/my_dir\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point/my_dir" );
assert( status == 0 );
printf("mount with option RA should fail with EINVAL\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RA",
NULL,
"/c/y/my_mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EACCES );
/*
* Verify a file system can not be unmounted with a mounted file system
* in it.
*/
printf("Mount a file system at /c/y/my_mount_point/my_dir\n"); printf("Mount a file system at /c/y/my_mount_point/my_dir\n");
status = mount( status = mount(
@@ -347,61 +396,49 @@ int main(
"/c/y/my_mount_point/my_dir"); "/c/y/my_mount_point/my_dir");
assert( status == 0 ); assert( status == 0 );
printf("unmount /c/y/my_mount_point/my_dir should fail in "); printf("unmount /c/y/my_mount_point should fail with EBUSY\n");
printf("file_systems_below_this_mountpoint \n"); status = unmount( "/c/y/my_mount_point" );
status = unmount( "/c/y/my_mount_point/my_dir" ); assert( status == -1 );
assert( status == 0 ); assert( errno == EBUSY );
printf("mount first filesystem /c/y/my_mount_point/\n"); /*
status = mount( * Verify you cannot create a hard link across mounted file systems.
&mt_entry, */
&IMFS_ops,
"RW",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
printf("\nmkdir /c/y/my_mount_point/my_dir\n");
status = mkdir( "/c/y/my_mount_point/my_dir", S_IRWXU );
assert( status == 0 );
printf("Mount another filesystem at /c/y/my_mount_point/my_dir\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RW",
NULL,
"/c/y/my_mount_point/my_dir");
assert( status == 0 );
printf("Verify a hard link across filesystems fails with EXDEV\n");
status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU ); status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU );
assert( status != -1 ); assert( status == 0 );
status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EXDEV );
printf("unmount /c/y/my_mount_point\n"); /*
status = unmount( "/c/y/my_mount_point" ); * Create a symbolic link across mountpoints.
assert( status == -1 ); */
printf("Verify a symbolic link across file systems works\n");
status = symlink( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
assert( status == 0 );
status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
assert( status == 0 );
printf("unmount /c/y/my_mount_point/my_dir\n"); printf("unmount /c/y/my_mount_point/my_dir\n");
status = unmount( "/c/y/my_mount_point/my_dir" ); status = unmount( "/c/y/my_mount_point/my_dir" );
assert( status == 0 ); assert( status == 0 );
/*
* Verify symblic link no longer works.
*/
printf("Verify the symbolic link now fails\n");
status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
assert( status != 0 );
printf("unmount /c/y/my_mount_point\n"); printf("unmount /c/y/my_mount_point\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
/* printf("Mount /c/y/my_mount_point\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RO",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
*/
printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" ); printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" );
exit(0); exit(0);
} }

View File

@@ -205,68 +205,95 @@ int main(
i++; i++;
} }
/*
* Create files under many and open the directory.
*/
printf("Create a lot of files\n");
status = mkdir( "/many", 0x1c0 ); status = mkdir( "/many", 0x1c0 );
status = chdir( "/many" ); status = chdir( "/many" );
for (i = 0; i<=44; i++) { for (i = 0; i<44; i++) {
fd = open (many_files[i], O_CREAT); printf(" Create %s\n", many_files[i]);
fd = open (many_files[i], O_CREAT, S_IRWXU);
close (fd); close (fd);
} }
printf("Open /many and print the directory\n");
directory_not = opendir( "/many" ); directory_not = opendir( "/many" );
printdir ( directory_not ); printdir ( directory_not );
d_not = readdir( directory_not ); d_not = readdir( directory_not );
fd = open ("/b/my_file", O_CREAT); printf("open /b/myfile\n");
fd = open ("/b/my_file", O_CREAT, S_IRWXU);
assert( fd != -1 ); assert( fd != -1 );
close (fd); close (fd);
printf("scandir a file status: ");
status = scandir( status = scandir(
"/b/my_file", "/b/my_file",
&namelist, &namelist,
select1, select1,
NULL NULL
); );
printf("%d\n", status);
fd = open( "/b/new_file", O_CREAT ); printf("Open /b/new_file\n");
fd = open( "/b/new_file", O_CREAT, S_IRWXU );
assert( fd != -1 ); assert( fd != -1 );
printf("fcntl F_SETFD should return 0\n");
status = fcntl( fd, F_SETFD, 1 ); status = fcntl( fd, F_SETFD, 1 );
assert( status == 0 ); assert( status == 0 );
printf("fcntl F_SETFD should return 1\n");
status = fcntl( fd, F_GETFD, 1 ); status = fcntl( fd, F_GETFD, 1 );
assert( status == 1 ); assert( status == 1 );
status = fcntl( fd, F_DUPFD, 1 ); printf("fcntl F_DUPFD should return 0\n");
assert ( status == -1 ); status = fcntl( fd, F_DUPFD, 0 );
assert ( status == 0 );
printf("fcntl F_GETFL should return -1\n");
status = fcntl( fd, F_GETFL, 1 ); status = fcntl( fd, F_GETFL, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETFL should return -1\n");
status = fcntl( fd, F_SETFL, 1 ); status = fcntl( fd, F_SETFL, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_GETLK should return -1\n");
status = fcntl( fd, F_GETLK, 1 ); status = fcntl( fd, F_GETLK, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETLK should return -1\n");
status = fcntl( fd, F_SETLK, 1 ); status = fcntl( fd, F_SETLK, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETLKW should return -1\n");
status = fcntl( fd, F_SETLKW, 1 ); status = fcntl( fd, F_SETLKW, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETOWN should return -1\n");
status = fcntl( fd, F_SETOWN, 1 ); status = fcntl( fd, F_SETOWN, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_GETOWN should return -1\n");
status = fcntl( fd, F_GETOWN, 1 ); status = fcntl( fd, F_GETOWN, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl invalid argument should return -1\n");
status = fcntl( fd, 0xb, 1 ); status = fcntl( fd, 0xb, 1 );
printf("Status %d\n",status);
assert( status == -1 ); assert( status == -1 );
printf("opendir and readdir /b/myfile\n");
directory_not = opendir ("/b/my_file"); directory_not = opendir ("/b/my_file");
d_not = readdir(directory_not); d_not = readdir(directory_not);
printf("opendir and readdir\n");
directory_not = opendir ("/a"); directory_not = opendir ("/a");
d_not = readdir (directory_not); d_not = readdir (directory_not);
printf("chdir to /b/myfile\n");
status = chdir ("/b/my_file"); status = chdir ("/b/my_file");
assert (status == -1); assert (status == -1);
@@ -275,11 +302,9 @@ int main(
printf("status for stat : %d, size of directory: %d\n\n", printf("status for stat : %d, size of directory: %d\n\n",
status,(int)s.st_size); status,(int)s.st_size);
puts( "\nOpening directory /" ); puts( "\nOpen and print directory /" );
directory = opendir("/"); directory = opendir("/");
assert( directory ); assert( directory );
printdir(directory); printdir(directory);
printf("\nmkdir /d/my_dir\n"); printf("\nmkdir /d/my_dir\n");
@@ -305,9 +330,7 @@ int main(
printf( "\nOpening directory /c/y\n" ); printf( "\nOpening directory /c/y\n" );
directory3 = opendir("/c/y"); directory3 = opendir("/c/y");
assert( directory3 ); assert( directory3 );
printdir(directory3); printdir(directory3);
status = closedir( directory3 ); status = closedir( directory3 );

View File

@@ -0,0 +1,15 @@
Files initialized successfully.
Testing device_lseek()... Success.
Testing dup()............ Success.
Testing dup2()........... Success.
Testing fdatasync()...... Success.
Testing umask().......... Success.
Testing utime().......... Success.
Testing pipe()........... Success.
Testing fsync().......... Success.
Testing pathconf()....... Success.
Testing fpathconf()...... Success.
*** END OF TEST PSX13 ***

View File

@@ -161,8 +161,8 @@ int DupTest(void) {
if (fd2 != -1) { if (fd2 != -1) {
fcntl(F_SETFL, fd1, O_APPEND); fcntl(fd1, F_SETFL, O_APPEND);
flags = fcntl(F_GETFL, fd2); flags = fcntl(fd2, F_GETFL);
close (fd1); close (fd1);
@@ -214,8 +214,8 @@ int Dup2Test(void) {
if (error != -1) { if (error != -1) {
fcntl(F_SETFL, fd1, O_APPEND); fcntl(fd1, F_SETFL, O_APPEND);
flags = fcntl(F_GETFL, fd1); flags = fcntl(fd1, F_GETFL);
flags = (flags & O_APPEND); flags = (flags & O_APPEND);
retval = (flags == O_APPEND); retval = (flags == O_APPEND);
@@ -600,76 +600,74 @@ int main(
#endif #endif
{ {
if (InitFiles() == TRUE) { if (InitFiles() == TRUE) {
puts ("\nFiles initialized successfully.\n"); printf ("\nFiles initialized successfully.\n");
puts ("Testing device_lseek()..."); printf ("Testing device_lseek()... ");
if (DeviceLSeekTest() == TRUE) if (DeviceLSeekTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing dup()..."); printf ("Testing dup()............ ");
if (DupTest() == TRUE) if (DupTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing dup2()..."); printf ("Testing dup2()........... ");
if (Dup2Test() == TRUE) if (Dup2Test() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fdatasync()..."); printf ("Testing fdatasync()...... ");
if (FDataSyncTest() == TRUE) if (FDataSyncTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing umask()..."); printf ("Testing umask().......... ");
if (UMaskTest() == TRUE) if (UMaskTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing utime()..."); printf ("Testing utime().......... ");
if (UTimeTest() == TRUE) if (UTimeTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing pipe()..."); printf ("Testing pipe()........... ");
if (PipeTest() == TRUE) if (PipeTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fsync()..."); printf ("Testing fsync().......... ");
if (FSyncTest() == TRUE) if (FSyncTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing pathconf()..."); printf ("Testing pathconf()....... ");
if (PathConfTest() == TRUE) if (PathConfTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
puts ("Testing fpathconf()..."); printf ("Testing fpathconf()...... ");
if (FPathConfTest() == TRUE) if (FPathConfTest() == TRUE)
puts ("Success.\n"); printf ("Success.\n");
else else
puts ("Failed!!!\n"); printf ("Failed!!!\n");
} }
else else
puts ("\n\nError opening files for write!!!!\n"); printf ("\n\nError opening files for write!!!!\n");
puts( "\n\n*** XXX ***" ); printf( "\n\n*** END OF TEST PSX13 ***" );
puts( "\n\n*** END OF TEST PSX13 ***" );
exit(0); exit(0);
} }

View File

@@ -1,168 +1,168 @@
*** FILE TEST 1 *** *** FILE TEST 1 ***
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
*************** End of Dump *************** *************** End of Dump ***************
stat of /dev/console stat of /dev/console
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino 3 st_ino 3
mode = 00020771 mode = 00020771
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Fri Jan 01 00:00:00 1988 atime = Fri Jan 01 00:00:00 1988
mtime = Fri Jan 01 00:00:00 1988 mtime = Fri Jan 01 00:00:00 1988
ctime = Fri Jan 01 00:00:00 1988 ctime = Fri Jan 01 00:00:00 1988
mkdir /dev/tty mkdir /dev/tty
mkdir /usr mkdir /usr
mkdir /etc mkdir /etc
mkdir /tmp mkdir /tmp
mkdir /tmp/.. mkdir /tmp/..
mkdir /tmp/ mkdir /tmp/
mkdir /j/j1 mkdir /j/j1
mkdir tmp mkdir tmp
rmdir /usr rmdir /usr
mkdir /etc/passwd/j mkdir /etc/passwd/j
open /tmp/joel - should fail with ENOENT open /tmp/joel - should fail with ENOENT
open /tmp/j open /tmp/j
open returned file descriptor 3 open returned file descriptor 3
close /tmp/j close /tmp/j
unlink /tmp/j unlink /tmp/j
(0)the first write!!! (0)the first write!!!
(10)the first write!!! (10)the first write!!!
stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0) stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0)
st_ino d st_ino d
mode = 00100700 mode = 00100700
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
(514)the first write!!! (514)the first write!!!
(513)the first write!!! (513)the first write!!!
(24)the first write!!! (24)the first write!!!
(2)the first write!!! (2)the first write!!!
(1)the first write!!! (1)the first write!!!
(0)the first write!!! (0)the first write!!!
(0)rst write!!! (0)rst write!!!
(513)the first write!!! (513)the first write!!!
(139743) (139743)
stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0) stat( /tmp/joel ) returned st_dev (0x1a7f8:0x3e86f0)
st_ino e st_ino e
mode = 00100700 mode = 00100700
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
stat of /tmp/j stat of /tmp/j
stat(/tmp/j) returned -1 (errno=2) stat(/tmp/j) returned -1 (errno=2)
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino 3 st_ino 3
mode = 00020771 mode = 00020771
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Fri Jan 01 00:00:00 1988 atime = Fri Jan 01 00:00:00 1988
mtime = Fri Jan 01 00:00:00 1988 mtime = Fri Jan 01 00:00:00 1988
ctime = Fri Jan 01 00:00:00 1988 ctime = Fri Jan 01 00:00:00 1988
fopen of /tmp/j fopen of /tmp/j
fprintf to /tmp/j fprintf to /tmp/j
(1) 26 characters written to the file (1) 26 characters written to the file
(2) 26 characters written to the file (2) 26 characters written to the file
(3) 26 characters written to the file (3) 26 characters written to the file
(4) 26 characters written to the file (4) 26 characters written to the file
(5) 26 characters written to the file (5) 26 characters written to the file
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:00 1988 atime = Sat Dec 31 09:00:00 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
This is call 1 to fprintf This is call 1 to fprintf
This is call 2 to fprintf This is call 2 to fprintf
This is call 3 to fprintf This is call 3 to fprintf
This is call 4 to fprintf This is call 4 to fprintf
This is call 5 to fprintf This is call 5 to fprintf
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:01 1988 atime = Sat Dec 31 09:00:01 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
joel (file 279487 0x3d5ac0 0x3d5570 0x3d5020) joel (file 279487 0x3d5ac0 0x3d5570 0x3d5020)
j (file 130 0x37f530 0x0 0x0) j (file 130 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
truncate /tmp/j to length of 40 truncate /tmp/j to length of 40
st_dev (0x0:0x0) st_dev (0x0:0x0)
st_ino f st_ino f
mode = 00100660 mode = 00100660
nlink = 1 nlink = 1
uid = 0 uid = 0
gid = 0 gid = 0
atime = Sat Dec 31 09:00:02 1988 atime = Sat Dec 31 09:00:02 1988
mtime = Sat Dec 31 09:00:00 1988 mtime = Sat Dec 31 09:00:00 1988
ctime = Sat Dec 31 09:00:00 1988 ctime = Sat Dec 31 09:00:00 1988
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
j (file 40 0x37f530 0x0 0x0) j (file 40 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
truncate /tmp/j to length of 0 truncate /tmp/j to length of 0
truncate /tmp to length of 0 should fail with EISDIR truncate /tmp to length of 0 should fail with EISDIR
21: Is a directory 21: Is a directory
*************** Dump of Entire IMFS *************** *************** Dump of Entire IMFS ***************
/ /
dev/ dev/
console (device 0, 0) console (device 0, 0)
tty/ tty/
S3 (device 255, 128) S3 (device 255, 128)
test_console (device 0, 0) test_console (device 0, 0)
etc/ etc/
passwd (file 0 0x0 0x0 0x0) passwd (file 0 0x0 0x0 0x0)
tmp/ tmp/
j (file 0 0x37f530 0x0 0x0) j (file 0 0x37f530 0x0 0x0)
*************** End of Dump *************** *************** End of Dump ***************
*** END OF FILE TEST 1 *** *** END OF FILE TEST 1 ***

View File

@@ -238,6 +238,7 @@ int main(
status = rmdir ("/fred"); status = rmdir ("/fred");
assert (status == -1); assert (status == -1);
assert( errno == ENOENT );
status = mknod( "/dev/test_console", S_IFCHR, 0LL ); status = mknod( "/dev/test_console", S_IFCHR, 0LL );
assert( !status ); assert( !status );

View File

@@ -0,0 +1,86 @@
*** MOUNT/UNMOUNT TEST ***
chdir to the root directory
chdir() status : 0
Creating a series of directories under /
Creating : a 0 0 Success
Creating : b 0 0 Success
Creating : c 0 0 Success
Creating : d 0 0 Success
Creating : e 0 0 Success
Creating : f 0 0 Success
Creating : c/y 0 0 Success
Creating : c/z 0 0 Success
Creating : c/x 0 0 Success
Creating : c/y/a3333 0 0 Success
Creating : c/y/j123 0 0 Success
Creating : c/y/my_mount_point 0 0 Success
Creating : c/y/my_mount_point/my_dir 0 0 Success
Creating : c/z/my_mount_point 0 0 Success
create /b/my_file
Verify /b/my_file
create c/y/my_mount_point/my_dir/d
Verify c/y/my_mount_point/my_dir/d
Attempting to mount IMFS file system at /c/z/my_mount_point
2nd file system successfully mounted at /c/z/my_mount_point
chdir to /c/z/my_mount_point.
chdir() status : 0
Creating a series of directories under /c/z/my_mount_point
Creating: a 0 2 Success
Creating: b 0 2 Success
Creating: c 0 2 Success
Creating: d 0 2 Success
Creating: e 0 2 Success
Creating: f 0 2 Success
Creating: c/y 0 2 Success
Creating: c/z 0 2 Success
Creating: c/x 0 2 Success
Creating: c/y/a3333 0 2 Success
Creating: c/y/j123 0 2 Success
Creating: c/y/my_mount_point 0 2 Success
Creating: c/y/my_mount_point/my_dir 0 2 Success
Creating: c/y/my_mount_point/my_dir/d 0 2 Success
Creating: c/z/my_mount_point 0 2 Success
Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g 0 2 Success
chdir to /
chdir() status : 0
Unmount status: 0
Mount a NULL file system and verify EINVAL
mount with option RA should fail with EINVAL
Mount a Read Only filesystem at /c/y/my_mount_point
Read only file system successfully mounted at /c/y/my_mount_point
create c/y/my_mount_point/../../y/my_mount_point/new_dir
Verify a mount point retruns EBUSY for another mount
Mount on a file should fail with ENOTDIR
Create and chdir to /c/y/my_mount_point/mydir
unmount of /c/y/my_mount_point should fail with EBUSY
chdir to / and verify we can unmount /c/y/my_mount_point
unmount /c/y/my_mount_point
unmount /b/mount_point should fail with EINVAL
Mount /c/y/my_mount_point
Create and open /c/y/my_mount_point/my_file
mkdir /c/y/my_mount_point/my_dir
Open /c/y/my_mount_point/my_dir
Unmount /c/y/my_mount_point should fail with EBUSY
Close /c/y/my_mount_point/my_dir
Unmount /c/y/my_mount_point/my_dir
Mount a file system at /c/y/my_mount_point/my_dir
unmount /c/y/my_mount_point should fail with EBUSY
Verify a hard link across filesystems fails with EXDEV
Verify a symbolic link across file systems works
unmount /c/y/my_mount_point/my_dir
Verify the symbolic link now fails
unmount /c/y/my_mount_point
*** END OF MOUNT/UNMOUNT TEST ***

View File

@@ -99,6 +99,11 @@ int main(
printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" ); printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" );
/*
* Change directory to the root and create files under
* the base file system.
*/
printf( "\nchdir to the root directory\n" ); printf( "\nchdir to the root directory\n" );
status = chdir( "/" ); status = chdir( "/" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -108,7 +113,7 @@ int main(
while ( strcmp(dnames[i], "END") != 0 ) while ( strcmp(dnames[i], "END") != 0 )
{ {
status = mkdir( dnames[i], 0777 ); status = mkdir( dnames[i], 0777 );
printf("Creating directory: %s %d %d ", dnames[i], status, errno ); printf("Creating : %25s %d %d ", dnames[i], status, errno );
if ( status == 0 ) if ( status == 0 )
printf(" Success\n"); printf(" Success\n");
else else
@@ -117,16 +122,36 @@ int main(
i++; i++;
} }
/*
* Create a Files with all rwx for others group and user. Verify
* the created file.
*/
printf("create /b/my_file\n");
fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close (fd); close (fd);
printf("Verify /b/my_file\n");
fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO); fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close( fd ); close( fd );
printf("create c/y/my_mount_point/my_dir/d\n");
fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close (fd); close (fd);
printf("Verify c/y/my_mount_point/my_dir/d\n");
fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO); fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != 0 );
close( fd ); close( fd );
/*
* Mount an the IMFS file system on the base file system.
*/
printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n"); printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n");
status = mount( status = mount(
&mt_entry, &mt_entry,
@@ -142,8 +167,12 @@ int main(
printf("2nd file system successfully mounted at /c/z/my_mount_point \n"); printf("2nd file system successfully mounted at /c/z/my_mount_point \n");
} }
printf( "\nchdir to /c/z/my_mount_point the mount point of the \n" ); /*
printf( "second file system \n" ); * Change directory to the mount point and create a group of files under
* the mounted file system.
*/
printf( "\nchdir to /c/z/my_mount_point.\n" );
status = chdir( "/c/z/my_mount_point" ); status = chdir( "/c/z/my_mount_point" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -152,7 +181,7 @@ int main(
while ( strcmp(fnames[i], "END") != 0 ) while ( strcmp(fnames[i], "END") != 0 )
{ {
status = mkdir( fnames[i], 0777 ); status = mkdir( fnames[i], 0777 );
printf("Creating directory: %s %d %d ", fnames[i], status, errno ); printf("Creating: %46s %d %d ", fnames[i], status, errno );
if ( status == 0 ) if ( status == 0 )
printf(" Success\n"); printf(" Success\n");
else { else {
@@ -167,7 +196,7 @@ int main(
i++; i++;
} }
printf( "\nchdir to / the mount point of the first file system \n" ); printf( "\nchdir to /\n" );
status = chdir( "/" ); status = chdir( "/" );
printf( "chdir() status : %d\n\n", status ); printf( "chdir() status : %d\n\n", status );
@@ -179,28 +208,12 @@ int main(
status = unmount( "/c/z/my_mount_point" ); status = unmount( "/c/z/my_mount_point" );
printf( " %d\n", status ); printf( " %d\n", status );
/*
status = chmod( "c/y/j123", S_IRUSR );
assert( status == 0 );
printf("Attempting to mount IMFS file system at c/y/j123\n"); /*
status = mount( * Mount a NULL filesystem and verify it fails.
&mt_entry, */
&IMFS_ops,
"RO",
NULL,
"c/y/j123" );
assert( status == 0 );
status = mkdir( "c/y/j123/new_dir", S_IRUSR ); printf("Mount a NULL file system and verify EINVAL\n");
assert( status == -1 );
printf("Unmount c/y/j123\n");
status = unmount( "c/y/j123" );
assert( status == 0 );
*/
printf(" File system type should be invalid.\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
NULL, NULL,
@@ -210,7 +223,25 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
printf("Attempting to mount IMFS file system at /c/y/my_mount_point \n"); /*
* Verify mount with option RA fails with EINVAL
*/
printf("mount with option RA should fail with EINVAL\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RA",
NULL,
"/c/y/my_mount_point" );
assert( status == -1 );
assert( errno == EINVAL );
/*
* Mount a Read Only File system.
*/
printf("Mount a Read Only filesystem at /c/y/my_mount_point \n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -222,18 +253,26 @@ int main(
printf(" NULL mount table entry was returned\n"); printf(" NULL mount table entry was returned\n");
} }
else { else {
printf("3rd file system successfully mounted at /c/y/my_mount_point \n"); printf("Read only file system successfully mounted at /c/y/my_mount_point \n");
} }
/*
* Create a directory that passes through the read only file system.
*/
printf("create c/y/my_mount_point/../../y/my_mount_point/new_dir\n");
status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU ); status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU );
assert( status == 0 ); assert( status == 0 );
status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf ); status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf );
assert( status == 0 ); assert( status == 0 );
status = stat("c/y/my_mount_point/new_dir/..", &statbuf ); status = stat("c/y/my_mount_point/new_dir/..", &statbuf );
assert( status == 0 ); assert( status == 0 );
printf("Mount another file system at /c/y/my_mount_point should fail with EBUSY\n"); /*
* Attempt to mount a second file system at a used mount point.
*/
printf("Verify a mount point retruns EBUSY for another mount\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -243,7 +282,11 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY); assert( errno == EBUSY);
printf("Mount /b/my_file should fail in rtems_filesystem_evaluate_path\n"); /*
* Attempt to mount at a file.
*/
printf("Mount on a file should fail with ENOTDIR\n");
status = mount( status = mount(
&mt_entry, &mt_entry,
&IMFS_ops, &IMFS_ops,
@@ -251,24 +294,14 @@ int main(
NULL, NULL,
"/b/my_file" ); "/b/my_file" );
assert( status == -1 ); assert( status == -1 );
assert( errno == ENOTDIR );
printf("Unmount /c/y/my_mount_point\n"); /*
status = unmount( "/c/y/my_mount_point" ); * Verify we cannot unmount a file system while we are in it.
assert( status == 0 ); */
/* What's wrong with this? It should be causing failure at unmount.c:87, printf("Create and chdir to /c/y/my_mount_point/mydir\n");
* instead, it's returning a status of 0.
*/
printf("Mount /c/y/my_mount_point to cause error\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RO",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
status = mkdir( "/c/y/my_mount_point/mydir", 0777); status = mkdir( "/c/y/my_mount_point/mydir", 0777);
assert( status == 0 ); assert( status == 0 );
@@ -280,6 +313,11 @@ int main(
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY ); assert( errno == EBUSY );
/*
* Chdir to root and verify we can unmount the file system now.
*/
printf("chdir to / and verify we can unmount /c/y/my_mount_point\n");
status = chdir( "/" ); status = chdir( "/" );
assert( status == 0 ); assert( status == 0 );
@@ -287,9 +325,18 @@ int main(
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
printf(" unmount /b/mount_point should fail\n"); /*
* Attempt to unmount a directory that does not exist.
*/
printf(" unmount /b/mount_point should fail with EINVAL\n");
status = unmount( "/b/mount_point" ); status = unmount( "/b/mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == ENOENT );
/*
* Remount the filesystem.
*/
printf("Mount /c/y/my_mount_point\n"); printf("Mount /c/y/my_mount_point\n");
status = mount( status = mount(
@@ -300,9 +347,13 @@ int main(
"/c/y/my_mount_point" ); "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
/* XXX - There is an error in open that calculates incorrect mode. */ /*
* Create a file and directory then open the directory.
* Verify unmount will return EBUSY while directory is open.
*/
printf("Create and open /c/y/my_mount_point/my_file\n"); printf("Create and open /c/y/my_mount_point/my_file\n");
fd = open( "/c/y/my_mount_point/my_file", O_CREAT ); fd = open( "/c/y/my_mount_point/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
assert( fd != -1 ); assert( fd != -1 );
status = close( fd ); status = close( fd );
assert( status == 0 ); assert( status == 0 );
@@ -316,27 +367,25 @@ int main(
printf("Unmount /c/y/my_mount_point should fail with EBUSY\n"); printf("Unmount /c/y/my_mount_point should fail with EBUSY\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EBUSY );
printf("Close /c/y/my_mount_point/my_dir\n"); printf("Close /c/y/my_mount_point/my_dir\n");
status = closedir( directory ); status = closedir( directory );
assert( status == 0 ); assert( status == 0 );
printf("Unmount /c/y/my_mount_point/d should fail at 107\n"); /*
status = unmount( "/c/y/my_mount_point/d" ); * Attempt to unmount a directory that is not a mount point.
assert( status == -1 ); */
printf("unmount /c/y/my_mount_point\n"); printf("Unmount /c/y/my_mount_point/my_dir\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point/my_dir" );
assert( status == 0 );
printf("mount with option RA should fail with EINVAL\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RA",
NULL,
"/c/y/my_mount_point" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EACCES );
/*
* Verify a file system can not be unmounted with a mounted file system
* in it.
*/
printf("Mount a file system at /c/y/my_mount_point/my_dir\n"); printf("Mount a file system at /c/y/my_mount_point/my_dir\n");
status = mount( status = mount(
@@ -347,61 +396,49 @@ int main(
"/c/y/my_mount_point/my_dir"); "/c/y/my_mount_point/my_dir");
assert( status == 0 ); assert( status == 0 );
printf("unmount /c/y/my_mount_point/my_dir should fail in "); printf("unmount /c/y/my_mount_point should fail with EBUSY\n");
printf("file_systems_below_this_mountpoint \n"); status = unmount( "/c/y/my_mount_point" );
status = unmount( "/c/y/my_mount_point/my_dir" ); assert( status == -1 );
assert( status == 0 ); assert( errno == EBUSY );
printf("mount first filesystem /c/y/my_mount_point/\n"); /*
status = mount( * Verify you cannot create a hard link across mounted file systems.
&mt_entry, */
&IMFS_ops,
"RW",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
printf("\nmkdir /c/y/my_mount_point/my_dir\n");
status = mkdir( "/c/y/my_mount_point/my_dir", S_IRWXU );
assert( status == 0 );
printf("Mount another filesystem at /c/y/my_mount_point/my_dir\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RW",
NULL,
"/c/y/my_mount_point/my_dir");
assert( status == 0 );
printf("Verify a hard link across filesystems fails with EXDEV\n");
status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU ); status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU );
assert( status != -1 ); assert( status == 0 );
status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
assert( status == -1 ); assert( status == -1 );
assert( errno == EXDEV );
printf("unmount /c/y/my_mount_point\n"); /*
status = unmount( "/c/y/my_mount_point" ); * Create a symbolic link across mountpoints.
assert( status == -1 ); */
printf("Verify a symbolic link across file systems works\n");
status = symlink( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
assert( status == 0 );
status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
assert( status == 0 );
printf("unmount /c/y/my_mount_point/my_dir\n"); printf("unmount /c/y/my_mount_point/my_dir\n");
status = unmount( "/c/y/my_mount_point/my_dir" ); status = unmount( "/c/y/my_mount_point/my_dir" );
assert( status == 0 ); assert( status == 0 );
/*
* Verify symblic link no longer works.
*/
printf("Verify the symbolic link now fails\n");
status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
assert( status != 0 );
printf("unmount /c/y/my_mount_point\n"); printf("unmount /c/y/my_mount_point\n");
status = unmount( "/c/y/my_mount_point" ); status = unmount( "/c/y/my_mount_point" );
assert( status == 0 ); assert( status == 0 );
/* printf("Mount /c/y/my_mount_point\n");
status = mount(
&mt_entry,
&IMFS_ops,
"RO",
NULL,
"/c/y/my_mount_point" );
assert( status == 0 );
*/
printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" ); printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" );
exit(0); exit(0);
} }

View File

@@ -205,68 +205,95 @@ int main(
i++; i++;
} }
/*
* Create files under many and open the directory.
*/
printf("Create a lot of files\n");
status = mkdir( "/many", 0x1c0 ); status = mkdir( "/many", 0x1c0 );
status = chdir( "/many" ); status = chdir( "/many" );
for (i = 0; i<=44; i++) { for (i = 0; i<44; i++) {
fd = open (many_files[i], O_CREAT); printf(" Create %s\n", many_files[i]);
fd = open (many_files[i], O_CREAT, S_IRWXU);
close (fd); close (fd);
} }
printf("Open /many and print the directory\n");
directory_not = opendir( "/many" ); directory_not = opendir( "/many" );
printdir ( directory_not ); printdir ( directory_not );
d_not = readdir( directory_not ); d_not = readdir( directory_not );
fd = open ("/b/my_file", O_CREAT); printf("open /b/myfile\n");
fd = open ("/b/my_file", O_CREAT, S_IRWXU);
assert( fd != -1 ); assert( fd != -1 );
close (fd); close (fd);
printf("scandir a file status: ");
status = scandir( status = scandir(
"/b/my_file", "/b/my_file",
&namelist, &namelist,
select1, select1,
NULL NULL
); );
printf("%d\n", status);
fd = open( "/b/new_file", O_CREAT ); printf("Open /b/new_file\n");
fd = open( "/b/new_file", O_CREAT, S_IRWXU );
assert( fd != -1 ); assert( fd != -1 );
printf("fcntl F_SETFD should return 0\n");
status = fcntl( fd, F_SETFD, 1 ); status = fcntl( fd, F_SETFD, 1 );
assert( status == 0 ); assert( status == 0 );
printf("fcntl F_SETFD should return 1\n");
status = fcntl( fd, F_GETFD, 1 ); status = fcntl( fd, F_GETFD, 1 );
assert( status == 1 ); assert( status == 1 );
status = fcntl( fd, F_DUPFD, 1 ); printf("fcntl F_DUPFD should return 0\n");
assert ( status == -1 ); status = fcntl( fd, F_DUPFD, 0 );
assert ( status == 0 );
printf("fcntl F_GETFL should return -1\n");
status = fcntl( fd, F_GETFL, 1 ); status = fcntl( fd, F_GETFL, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETFL should return -1\n");
status = fcntl( fd, F_SETFL, 1 ); status = fcntl( fd, F_SETFL, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_GETLK should return -1\n");
status = fcntl( fd, F_GETLK, 1 ); status = fcntl( fd, F_GETLK, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETLK should return -1\n");
status = fcntl( fd, F_SETLK, 1 ); status = fcntl( fd, F_SETLK, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETLKW should return -1\n");
status = fcntl( fd, F_SETLKW, 1 ); status = fcntl( fd, F_SETLKW, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_SETOWN should return -1\n");
status = fcntl( fd, F_SETOWN, 1 ); status = fcntl( fd, F_SETOWN, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl F_GETOWN should return -1\n");
status = fcntl( fd, F_GETOWN, 1 ); status = fcntl( fd, F_GETOWN, 1 );
assert ( status == -1 ); assert ( status == -1 );
printf("fcntl invalid argument should return -1\n");
status = fcntl( fd, 0xb, 1 ); status = fcntl( fd, 0xb, 1 );
printf("Status %d\n",status);
assert( status == -1 ); assert( status == -1 );
printf("opendir and readdir /b/myfile\n");
directory_not = opendir ("/b/my_file"); directory_not = opendir ("/b/my_file");
d_not = readdir(directory_not); d_not = readdir(directory_not);
printf("opendir and readdir\n");
directory_not = opendir ("/a"); directory_not = opendir ("/a");
d_not = readdir (directory_not); d_not = readdir (directory_not);
printf("chdir to /b/myfile\n");
status = chdir ("/b/my_file"); status = chdir ("/b/my_file");
assert (status == -1); assert (status == -1);
@@ -275,11 +302,9 @@ int main(
printf("status for stat : %d, size of directory: %d\n\n", printf("status for stat : %d, size of directory: %d\n\n",
status,(int)s.st_size); status,(int)s.st_size);
puts( "\nOpening directory /" ); puts( "\nOpen and print directory /" );
directory = opendir("/"); directory = opendir("/");
assert( directory ); assert( directory );
printdir(directory); printdir(directory);
printf("\nmkdir /d/my_dir\n"); printf("\nmkdir /d/my_dir\n");
@@ -305,9 +330,7 @@ int main(
printf( "\nOpening directory /c/y\n" ); printf( "\nOpening directory /c/y\n" );
directory3 = opendir("/c/y"); directory3 = opendir("/c/y");
assert( directory3 ); assert( directory3 );
printdir(directory3); printdir(directory3);
status = closedir( directory3 ); status = closedir( directory3 );