diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2000-11-17 19:06:40 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2000-11-17 19:06:40 +0000 |
commit | 1e566bbb1c772a006a8f6b44f91c520f9c7cfdd2 (patch) | |
tree | 62d27f1bb8832e96c733b634e145cf0bda1ab98f /testsuites/psxtests/psxreaddir/test.c | |
parent | 2000-11-17 Jennifer Averret <jennifer@OARcorp.com> (diff) | |
download | rtems-1e566bbb1c772a006a8f6b44f91c520f9c7cfdd2.tar.bz2 |
2000-11-17 Jennifer Averret <jennifer@OARcorp.com>
* psxmount/test.c, psxmount/psxmount.scn: Improve output to report
expected error condition in one case.
* psxreaddir/test.c, psxreaddir.scn: Added test cases to exercise
readdir() of root of mounted filesystem. Also corrected the screen
file for some mistakes noticed in this effort.
Diffstat (limited to '')
-rw-r--r-- | testsuites/psxtests/psxreaddir/test.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/testsuites/psxtests/psxreaddir/test.c b/testsuites/psxtests/psxreaddir/test.c index 069400b463..7e8f031034 100644 --- a/testsuites/psxtests/psxreaddir/test.c +++ b/testsuites/psxtests/psxreaddir/test.c @@ -28,6 +28,8 @@ #include <assert.h> #include <unistd.h> #include <errno.h> +#include <imfs.h> +#include <assert.h> DIR *directory; DIR *directory2; @@ -64,6 +66,17 @@ void printdir( DIR *directory ) } } +void complete_printdir( char *path ) +{ + DIR *the_dir; + int status; + + the_dir = opendir( path ); + assert( the_dir ); + printdir( the_dir ); + status = closedir( the_dir ); +} + char *many_files[] = { "a", "b", @@ -166,6 +179,44 @@ int compare_descending( struct dirent **a, struct dirent **b ) return i; } +int test_across_mount() +{ + rtems_filesystem_mount_table_entry_t *mt_entry; + int status; + + /* + * Verify Readdir works correctly over mount points. + */ + + printf("Validate readdir across mount point\n"); + assert( mkdir( "/imfs", 0777 ) == 0 ); + assert( mkdir( "/imfs/should_be_hidden", 0777 ) == 0 ); + complete_printdir("/imfs" ); + printf("Attempting to mount IMFS file system at /imfs \n"); + status = mount( + &mt_entry, + &IMFS_ops, + RTEMS_FILESYSTEM_READ_WRITE, + NULL, + "/imfs" ); + assert( status == 0 ); + if( mt_entry == NULL ){ + printf(" NULL mount table entry was returned\n"); + } + printf( "create /imfs/testdir and /imfs/testdir/testsubdir\n"); + + status = mkdir( "/imfs/testdir", 0777 ); + assert( status == 0 ); + status = mkdir( "/imfs/testdir/testsubdir", 0777 ); + assert( status == 0 ); + + complete_printdir("/imfs" ); + complete_printdir("/imfs/" ); + complete_printdir("/imfs/." ); + complete_printdir("/imfs/testdir" ); + complete_printdir("/imfs/testdir/.." ); +} + #if defined(__rtems__) int test_main(void) #else @@ -442,7 +493,7 @@ int main( printf("Selected and Sorted Node Name: %s\n", namelist[i]->d_name ); } - + test_across_mount(); printf( "\n\n*** END OF READDIR TEST ***\n" ); exit(0); } |