summaryrefslogtreecommitdiffstats
path: root/c/src/tests/psxtests/psxstat/test.c
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2003-11-11 00:59:49 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2003-11-11 00:59:49 +0000
commitff6ab1b594d9f073ece9b7fedf1f6977f52aeee5 (patch)
treef0b2e3afb63f53a922a0c42137a6d6763548edc5 /c/src/tests/psxtests/psxstat/test.c
parent2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff)
downloadrtems-ff6ab1b594d9f073ece9b7fedf1f6977f52aeee5.tar.bz2
2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Remove. * ChangeLog: Remove. * Makefile.am: Remove. * configure.ac: Remove. * psxtests.am: Remove. * include/.cvsignore: Remove. * include/Makefile.am: Remove. * include/pmacros.h: Remove. * psx01/.cvsignore: Remove. * psx01/Makefile.am: Remove. * psx01/init.c: Remove. * psx01/psx01.scn: Remove. * psx01/system.h: Remove. * psx01/task.c: Remove. * psx02/.cvsignore: Remove. * psx02/Makefile.am: Remove. * psx02/init.c: Remove. * psx02/psx02.scn: Remove. * psx02/system.h: Remove. * psx02/task.c: Remove. * psx03/.cvsignore: Remove. * psx03/Makefile.am: Remove. * psx03/init.c: Remove. * psx03/psx03.scn: Remove. * psx03/system.h: Remove. * psx03/task.c: Remove. * psx04/.cvsignore: Remove. * psx04/Makefile.am: Remove. * psx04/init.c: Remove. * psx04/psx04.scn: Remove. * psx04/system.h: Remove. * psx04/task1.c: Remove. * psx04/task2.c: Remove. * psx04/task3.c: Remove. * psx05/.cvsignore: Remove. * psx05/Makefile.am: Remove. * psx05/init.c: Remove. * psx05/psx05.scn: Remove. * psx05/system.h: Remove. * psx05/task.c: Remove. * psx05/task2.c: Remove. * psx05/task3.c: Remove. * psx06/.cvsignore: Remove. * psx06/Makefile.am: Remove. * psx06/init.c: Remove. * psx06/psx06.scn: Remove. * psx06/system.h: Remove. * psx06/task.c: Remove. * psx06/task2.c: Remove. * psx07/.cvsignore: Remove. * psx07/Makefile.am: Remove. * psx07/init.c: Remove. * psx07/psx07.scn: Remove. * psx07/system.h: Remove. * psx07/task.c: Remove. * psx08/.cvsignore: Remove. * psx08/Makefile.am: Remove. * psx08/init.c: Remove. * psx08/psx08.scn: Remove. * psx08/system.h: Remove. * psx08/task1.c: Remove. * psx08/task2.c: Remove. * psx08/task3.c: Remove. * psx09/.cvsignore: Remove. * psx09/Makefile.am: Remove. * psx09/init.c: Remove. * psx09/psx09.scn: Remove. * psx09/system.h: Remove. * psx10/.cvsignore: Remove. * psx10/Makefile.am: Remove. * psx10/init.c: Remove. * psx10/psx10.scn: Remove. * psx10/system.h: Remove. * psx10/task.c: Remove. * psx10/task2.c: Remove. * psx10/task3.c: Remove. * psx11/.cvsignore: Remove. * psx11/Makefile.am: Remove. * psx11/init.c: Remove. * psx11/psx11.scn: Remove. * psx11/system.h: Remove. * psx11/task.c: Remove. * psx12/.cvsignore: Remove. * psx12/Makefile.am: Remove. * psx12/init.c: Remove. * psx12/psx12.scn: Remove. * psx12/system.h: Remove. * psx12/task.c: Remove. * psx13/.cvsignore: Remove. * psx13/Makefile.am: Remove. * psx13/main.c: Remove. * psx13/psx13.scn: Remove. * psx13/test.c: Remove. * psxcancel/.cvsignore: Remove. * psxcancel/Makefile.am: Remove. * psxcancel/init.c: Remove. * psxcancel/psxcancel.scn: Remove. * psxchroot01/.cvsignore: Remove. * psxchroot01/Makefile.am: Remove. * psxchroot01/main.c: Remove. * psxchroot01/psxchroot01.scn: Remove. * psxchroot01/test.c: Remove. * psxfile01/.cvsignore: Remove. * psxfile01/Makefile.am: Remove. * psxfile01/main.c: Remove. * psxfile01/psxfile01.scn: Remove. * psxfile01/test.c: Remove. * psxfile01/test_cat.c: Remove. * psxfile01/test_extend.c: Remove. * psxfile01/test_write.c: Remove. * psxhdrs/.cvsignore: Remove. * psxhdrs/Makefile.am: Remove. * psxhdrs/clock01.c: Remove. * psxhdrs/clock02.c: Remove. * psxhdrs/clock03.c: Remove. * psxhdrs/clock04.c: Remove. * psxhdrs/clock05.c: Remove. * psxhdrs/clock06.c: Remove. * psxhdrs/cond01.c: Remove. * psxhdrs/cond02.c: Remove. * psxhdrs/cond03.c: Remove. * psxhdrs/cond04.c: Remove. * psxhdrs/cond05.c: Remove. * psxhdrs/cond06.c: Remove. * psxhdrs/cond07.c: Remove. * psxhdrs/cond08.c: Remove. * psxhdrs/cond09.c: Remove. * psxhdrs/cond10.c: Remove. * psxhdrs/key01.c: Remove. * psxhdrs/key02.c: Remove. * psxhdrs/key03.c: Remove. * psxhdrs/key04.c: Remove. * psxhdrs/mutex01.c: Remove. * psxhdrs/mutex02.c: Remove. * psxhdrs/mutex03.c: Remove. * psxhdrs/mutex04.c: Remove. * psxhdrs/mutex05.c: Remove. * psxhdrs/mutex06.c: Remove. * psxhdrs/mutex07.c: Remove. * psxhdrs/mutex08.c: Remove. * psxhdrs/mutex09.c: Remove. * psxhdrs/mutex10.c: Remove. * psxhdrs/mutex11.c: Remove. * psxhdrs/mutex12.c: Remove. * psxhdrs/mutex13.c: Remove. * psxhdrs/mutex14.c: Remove. * psxhdrs/mutex15.c: Remove. * psxhdrs/mutex16.c: Remove. * psxhdrs/proc01.c: Remove. * psxhdrs/proc02.c: Remove. * psxhdrs/proc03.c: Remove. * psxhdrs/proc04.c: Remove. * psxhdrs/proc05.c: Remove. * psxhdrs/proc06.c: Remove. * psxhdrs/proc07.c: Remove. * psxhdrs/proc08.c: Remove. * psxhdrs/proc09.c: Remove. * psxhdrs/proc10.c: Remove. * psxhdrs/proc11.c: Remove. * psxhdrs/proc12.c: Remove. * psxhdrs/proc13.c: Remove. * psxhdrs/proc14.c: Remove. * psxhdrs/pthread01.c: Remove. * psxhdrs/pthread02.c: Remove. * psxhdrs/pthread03.c: Remove. * psxhdrs/pthread04.c: Remove. * psxhdrs/pthread05.c: Remove. * psxhdrs/pthread06.c: Remove. * psxhdrs/pthread07.c: Remove. * psxhdrs/pthread08.c: Remove. * psxhdrs/pthread09.c: Remove. * psxhdrs/pthread10.c: Remove. * psxhdrs/pthread11.c: Remove. * psxhdrs/pthread12.c: Remove. * psxhdrs/pthread13.c: Remove. * psxhdrs/pthread14.c: Remove. * psxhdrs/pthread15.c: Remove. * psxhdrs/pthread16.c: Remove. * psxhdrs/pthread17.c: Remove. * psxhdrs/pthread18.c: Remove. * psxhdrs/pthread19.c: Remove. * psxhdrs/pthread20.c: Remove. * psxhdrs/pthread21.c: Remove. * psxhdrs/pthread22.c: Remove. * psxhdrs/pthread23.c: Remove. * psxhdrs/pthread24.c: Remove. * psxhdrs/pthread25.c: Remove. * psxhdrs/pthread26.c: Remove. * psxhdrs/pthread27.c: Remove. * psxhdrs/pthread28.c: Remove. * psxhdrs/pthread29.c: Remove. * psxhdrs/pthread30.c: Remove. * psxhdrs/pthread31.c: Remove. * psxhdrs/pthread32.c: Remove. * psxhdrs/pthread33.c: Remove. * psxhdrs/pthread34.c: Remove. * psxhdrs/pthread35.c: Remove. * psxhdrs/pthread36.c: Remove. * psxhdrs/sched01.c: Remove. * psxhdrs/sched02.c: Remove. * psxhdrs/sched03.c: Remove. * psxhdrs/sched04.c: Remove. * psxhdrs/sched05.c: Remove. * psxhdrs/sched06.c: Remove. * psxhdrs/sched07.c: Remove. * psxhdrs/sched08.c: Remove. * psxhdrs/signal01.c: Remove. * psxhdrs/signal02.c: Remove. * psxhdrs/signal03.c: Remove. * psxhdrs/signal04.c: Remove. * psxhdrs/signal05.c: Remove. * psxhdrs/signal06.c: Remove. * psxhdrs/signal07.c: Remove. * psxhdrs/signal08.c: Remove. * psxhdrs/signal09.c: Remove. * psxhdrs/signal10.c: Remove. * psxhdrs/signal11.c: Remove. * psxhdrs/signal12.c: Remove. * psxhdrs/signal13.c: Remove. * psxhdrs/signal14.c: Remove. * psxhdrs/signal15.c: Remove. * psxhdrs/signal16.c: Remove. * psxhdrs/signal17.c: Remove. * psxhdrs/signal18.c: Remove. * psxhdrs/signal19.c: Remove. * psxhdrs/signal20.c: Remove. * psxhdrs/signal21.c: Remove. * psxhdrs/signal22.c: Remove. * psxhdrs/signal23.c: Remove. * psxhdrs/sync01.c: Remove. * psxhdrs/sync02.c: Remove. * psxhdrs/sync03.c: Remove. * psxhdrs/time01.c: Remove. * psxhdrs/time02.c: Remove. * psxhdrs/time03.c: Remove. * psxhdrs/time04.c: Remove. * psxhdrs/time05.c: Remove. * psxhdrs/time06.c: Remove. * psxhdrs/time07.c: Remove. * psxhdrs/time08.c: Remove. * psxhdrs/time09.c: Remove. * psxhdrs/time10.c: Remove. * psxhdrs/time11.c: Remove. * psxhdrs/time12.c: Remove. * psxhdrs/time13.c: Remove. * psxhdrs/timer01.c: Remove. * psxhdrs/timer02.c: Remove. * psxhdrs/timer03.c: Remove. * psxhdrs/timer04.c: Remove. * psxhdrs/timer05.c: Remove. * psxhdrs/timer06.c: Remove. * psxhdrs/timer07.c: Remove. * psxmount/.cvsignore: Remove. * psxmount/Makefile.am: Remove. * psxmount/main.c: Remove. * psxmount/psxmount.scn: Remove. * psxmount/test.c: Remove. * psxmsgq01/.cvsignore: Remove. * psxmsgq01/Makefile.am: Remove. * psxmsgq01/init.c: Remove. * psxmsgq01/psxmsgq01.scn: Remove. * psxmsgq01/system.h: Remove. * psxreaddir/.cvsignore: Remove. * psxreaddir/Makefile.am: Remove. * psxreaddir/main.c: Remove. * psxreaddir/psxreaddir.scn: Remove. * psxreaddir/test.c: Remove. * psxsem01/.cvsignore: Remove. * psxsem01/Makefile.am: Remove. * psxsem01/init.c: Remove. * psxsem01/psxsem01.scn: Remove. * psxsem01/system.h: Remove. * psxstat/.cvsignore: Remove. * psxstat/Makefile.am: Remove. * psxstat/main.c: Remove. * psxstat/psxstat.scn: Remove. * psxstat/test.c: Remove. * psxtime/.cvsignore: Remove. * psxtime/Makefile.am: Remove. * psxtime/main.c: Remove. * psxtime/psxtime.scn: Remove. * psxtime/test.c: Remove. * psxtimer/.cvsignore: Remove. * psxtimer/Makefile.am: Remove. * psxtimer/psxtimer.c: Remove. * psxtimer/psxtimer.scn: Remove. * psxtimer/system.h: Remove.
Diffstat (limited to 'c/src/tests/psxtests/psxstat/test.c')
-rw-r--r--c/src/tests/psxtests/psxstat/test.c857
1 files changed, 0 insertions, 857 deletions
diff --git a/c/src/tests/psxtests/psxstat/test.c b/c/src/tests/psxtests/psxstat/test.c
deleted file mode 100644
index b9426a2328..0000000000
--- a/c/src/tests/psxtests/psxstat/test.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * This test exercises stat() via fstat() and generates as many of the
- * path evaluation cases as possible.
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#include <tmacros.h>
-#include <assert.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <rtems.h>
-#include <rtems/libio.h>
-#include <imfs.h>
-#include <pmacros.h>
-
-#define MAXSYMLINK 5 /* There needs to be a better way of getting this. */
-#define TIMEOUT_VALUE ( 5 * TICKS_PER_SECOND )
-
-
-/*
- * List of files which should exist.
- */
-
-char *Files[] = {
- "/////my_mount_point/dir1/\\//file1\\\\//",
- "/my_mount_point/dir1/file2",
- "/my_mount_point/dir1/file3",
- "/my_mount_point/dir1/file4",
- "/my_mount_point/dir1/dir1/file1",
- "../../..//my_mount_point/dir1/./././dir1/ file1",
- "main.c",
- 0
-};
-
-/*
- * List of directories which should exist.
- */
-
-char *Directories[] = {
- "/my_mount_point/dir1",
- "/my_mount_point/dir2",
- "/my_mount_point/dir3",
- "/my_mount_point/dir4",
- "/my_mount_point/dir1/dir1",
- "/./././my_mount_point/dir1/ dir1",
- "/./././my_mount_point/links",
- "///my_mount_point/dir1/dir1/../../dir1/../symlinks/////",
- 0
-};
-
-char *Links_to_Dirs[]= {
- "dir1/dir1/../../links/dir1",
- "links/dir2",
- "links/dir3",
- "links/dir4",
- "links/dir1_dir1",
- "links/dir1_ dir1",
- "links/../links/../links/links",
- 0
-};
-
-char *Links_to_Files[]= {
- "links/dir1_file1",
- "links/dir1_file2",
- "links/dir1_file3",
- "links/dir1_file4",
- "links/dir1_dir1_f1",
- "links/dir1_dir1 f1",
- 0
-};
-
-char *Links_to_dirlinks[]= {
- "links/links/links/links_dir1",
- "links//links_dir2",
- "links//links_dir3",
- "links//links_dir4",
- "links//links_dir1_d1",
- "links//links_dir1 d1",
- "links//links_links",
- 0
-};
-
-char *Links_to_filelinks[]= {
- "links///links_d1_file1",
- "links///links_d1_file2",
- "links///links_d1_file3",
- "links///links_d1_file4",
- "links///links_d1_d1_f1",
- "links///links_r1_d1 f1",
- 0
-};
-
-char *SymLinks[]= {
- "/my_mount_point/symlinks/a_file_symlink",
- "/my_mount_point/symlinks/a_dir_symlink",
- "/my_mount_point/symlinks/a_link_symlink",
- "../symlinks/no_file",
- "/my_mount_point/symlinks/a_dir_symlink/a_file_symlink",
- 0
-};
-
-/*
- * List of absolute paths to stat.
- */
-
-char *Good_absolute_paths[] = {
- "/my_mount_point/dev",
- "////my_mount_point/dir1/\\//file1\\\\//",
- "/my_mount_point/dir1/\\\\/file2",
- "/my_mount_point/dir1/file3/////\\\\\\",
- "/my_mount_point/dir1/file4",
- "/my_mount_point/dir1/dir1/file1",
- "/my_mount_point/dir1/dir1/ file1",
- "/my_mount_point/dir1",
- "/my_mount_point/dir2//////\\",
- "/my_mount_point/dir3",
- "/my_mount_point/dir4",
- "/my_mount_point/dir1/dir1",
- "/my_mount_point/dir1/ dir1///\\\\",
- "/my_mount_point/\\/\\/\\/\\/\\/\\/links\\/\\/\\/\\/\\/\\",
- 0
-};
-
-
-char *Bad_paths[] = {
- "/my_mount_point/links/ENAMETOOLONG__________________________",
- "/my_mount_point/dir1/file4/NOTADIR",
- "/my_mount_point/dir1/dir1/EACCES__",
- 0
-};
-
-/*
- * List of relative paths to stat.
- */
-
-char *Good_relative_paths[] = {
- "dev",
- "dir1/\\//file1\\\\//",
- "dir1/\\\\/file2",
- "dir1/file3/////\\\\\\",
- "dir1/file4",
- "dir1/dir1/file1",
- "dir1/dir1/ file1",
- "dir1",
- "dir2//////\\",
- "dir3",
- "dir4",
- "dir1/dir1",
- "dir1/ dir1///\\\\",
- "main.c",
- 0
-};
-
-/*
- * Do a stat on a single file and report the status.
- */
-
-void stat_a_file(
- const char *file
-)
-{
- int status;
- struct stat statbuf;
- int major1;
- int minor1;
- int major2;
- int minor2;
-
-
- assert( file );
-
- printf( "stat( %s ) returned ", file );
- fflush( stdout );
-
- status = stat( file, &statbuf );
-
- if ( status == -1 ) {
- printf( ": %s\n", strerror( errno ) );
- } else {
-
- rtems_filesystem_split_dev_t( statbuf.st_dev, major1, minor1 );
- rtems_filesystem_split_dev_t( statbuf.st_rdev, major2, minor2 );
-
-
- printf("\n...st_dev (0x%x:0x%x)\n", major1, minor1 );
- printf( "...st_ino %x\n", (int) statbuf.st_ino );
- printf( "...st_mode %o\n", statbuf.st_mode );
- printf( "...st_nlink %x\n", statbuf.st_nlink );
- printf( "...st_uid %d\n", statbuf.st_uid );
- printf( "...st_gid %d\n", statbuf.st_gid );
- printf( "...st_rdev (0x%x:0x%x)\n", major2, minor2 );
- printf( "...st_size %d\n",(unsigned int) statbuf.st_size );
- printf( "...st_atime %s", ctime( &statbuf.st_atime ) );
- printf( "...st_mtime %s", ctime( &statbuf.st_mtime ) );
- printf( "...st_ctime %s", ctime( &statbuf.st_ctime ) );
-#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
- printf( "...st_blksize %x\n", statbuf.st_blksize );
- printf( "...st_blocks %x\n", statbuf.st_blocks );
-#endif
-
- }
-}
-
-/*
- * stat() multiple files at a time
- */
-
-void stat_multiple_files(
- char **files
-)
-{
- int i;
-
- i = 0;
- while ( files[i] ) {
- stat_a_file( files[i] );
- i++;
- }
-}
-
-/*
- * chown() multiple files at a time
- */
-void chown_multiple_files(
- char **files
-)
-{
- int i;
- uid_t st_uid;
- gid_t st_gid;
-
- st_uid = geteuid();
- st_gid = getegid();
-
- i = 0;
- while ( files[i] ) {
- printf("Change group of %s\n", files[i]);
- chown( files[i], st_uid, (st_gid+1) );
- stat_a_file( files[i] );
-
- printf("Change owner of %s\n", files[i]);
- chown( files[i], (st_uid+1), st_gid );
- stat_a_file( files[i] );
- i++;
- }
-
-}
-
-
-
-/*
- * mknod() multiple files at a time
- */
-
-void make_multiple_files(
- char **files
-)
-{
- int i;
- int status;
-
- i = 0;
- while ( files[i] ) {
- printf( "Making file %s\n", files[i] );
- status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
- assert( !status );
- i++;
- }
- puts( "" );
-}
-
-void make_multiple_bad_files(
- char **files
-)
-{
- int i;
- int status;
-
- i = 0;
- while ( files[i] ) {
- printf( "Making file %s ", files[i] );
- status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
- assert( status );
- printf( ": %s\n", strerror( errno ) );
- i++;
- }
- puts( "" );
-}
-
-void make_multiple_links(
- char **existing,
- char **new
-)
-{
- int i;
- int status;
-
- i = 0;
- while ( new[i] && existing[i] ) {
- printf( "Making file %s\n", new[i] );
- status = link( existing[i], new[i] );
- assert( !status );
- i++;
- }
- puts( "" );
-
- status = link( "fred", "bob" );
- assert( status == -1 );
-
- status = link( existing[1], "doug/bob" );
- assert( status == -1 );
-}
-
-
-void make_too_many_links()
-{
- int i;
- int status;
- char name [20];
-
- status = mkdir("/dummy", S_IRWXU );
- assert( status == 0 );
-
- for (i=1; i<= LINK_MAX; i++) {
-
- sprintf(name,"/LinkName%d",i);
- printf( "Making file %s\n", name );
- status = link("/dummy" , name );
- if( i < LINK_MAX )
- assert( !status );
- else
- assert( status == -1 );
-
- }
-}
-
-
-void make_a_symlink(
- char *existing,
- char *new
-)
-{
- int status;
- char buf[100];
- int len;
-
- memset( buf, 0, 100 );
-
- printf( "Making file %s\n", new );
- status = symlink( existing, new );
- assert( !status );
-
- printf( "Verify with readlink\n");
- status = readlink( new, buf, 100 );
- len = strlen( existing );
- assert ( status == len );
-
- status = readlink( new, buf, 3 );
- len = strlen( existing );
- if (len < 3 )
- assert( status == len );
- else
- assert( status == 3 );
-
- status = strcmp( existing, buf );
- assert( !status );
-}
-
-void make_multiple_symlinks()
-{
- int status;
-
- make_a_symlink( Files[0], SymLinks[0] );
- make_a_symlink( Directories[0], SymLinks[1] );
- make_a_symlink( Links_to_dirlinks[0], SymLinks[2] );
- make_a_symlink( "No_File", SymLinks[3] );
- make_a_symlink( SymLinks[1], SymLinks[4] );
- make_a_symlink( "//my_mount_point/links","/my_mount_point/symlinks/links" );
-
- stat_a_file( SymLinks[0] );
- stat_a_file( SymLinks[1] );
- stat_a_file( SymLinks[2] );
- stat_a_file( SymLinks[3] );
- stat_a_file( SymLinks[4] );
-
- status = symlink( "//links", "bob/frank" );
- assert (status == -1);
-
-}
-/*
-void make_too_many_symlinks()
-{
- int i, status;
- char name1[8];
-
- for (i=1; i <= MAXSYMLINK; i++) {
- sprintf( name1, "SymLink%d", i );
- status = symlink( "/dummy", name1 );
- if( i < MAXSYMLINK )
- assert( !status );
- else
- assert( status == -1 );
- }
-}
-*/
-void make_many_symlinks(
- char *real_file,
- int link_count
-)
-{
- int i;
- char name1[5];
- char name2[5];
- char *link_file;
-
- link_file = real_file;
- for (i=1; i < link_count; i++) {
- sprintf( name1, "%d", i );
- make_a_symlink( link_file, name1 );
- strcpy( name2, name1 );
- link_file = name2;
- }
-
- for (i=1; i < link_count; i++) {
- sprintf( name1, "%d", i );
- stat_a_file( name1 );
- }
-
-}
-
-/*
- * mkdir() multiple directories at a time
- */
-
-void make_multiple_directories(
- char **files
-)
-{
- int i;
- int status;
-
- i = 0;
- while ( files[i] ) {
- printf( "Making directory %s\n", files[i] );
- status = mkdir( files[i], S_IRWXU );
- assert( !status );
- i++;
- }
- puts( "" );
-}
-
-/*
- * Cause faults.
- */
-
-
-void Cause_faults()
-{
- int fd;
- int status;
- char longer_name[100];
- rtems_filesystem_mount_table_entry_t *mt_entry;
-
- /*
- * Verify chmod with an invalid type.
- */
-
- printf("\n\nPass an invalid mode to chmod should fail with EPERM \n" );
- status = chmod( Files[0], S_IFREG );
- assert( status == -1 );
- assert( errno == EPERM );
-
- /*
- * Change file to executable then try to chdir to it.
- */
-
- status = chmod( Files[0], S_IXUSR );
- assert( status != -1 );
-
- printf("chdir to a file should fail with ENOTDIR\n");
- status = chdir( Files[0] );
- assert( status == -1 );
- assert( errno == ENOTDIR );
-
- /*
- * Change mode to read/write on a directory.
- * Verify directory works properly.
- */
-
- printf("Verify RWX permission on %s via access\n", Directories[0]);
- status = access( Directories[0], ( R_OK | W_OK | X_OK ) );
- assert( status == 0 );
-
- printf( "chmod of %s to Read/Write\n", Directories[0] );
- status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
- assert( status == 0 );
-
- printf( "chmod fred should fail with ENOENT\n" );
- status = chmod( "fred", (S_IXGRP | S_IXOTH) );
- assert( status == -1 );
- assert( errno == ENOENT );
-
- strcpy(longer_name, Directories[0] );
- strcat(longer_name, "/BADNAME" );
- printf( "Create under %s should fail with EACCES\n", Directories[0] );
- status = mkdir( longer_name , S_IRWXU );
- assert( status == -1 );
- assert( errno == EACCES );
-
- printf("chdir to %s should fail with EACCES\n", Directories[4] );
- status = chdir( Directories[4] );
- assert( status == -1 );
- assert( errno == EACCES );
-
- /*
- * Check stat with a NULL buffer.
- */
-
- printf("Stat with a NULL buffer should fail with EFAULT\n");
- status = stat( Directories[0], NULL );
- assert( status == -1 );
- assert( errno == EFAULT );
-
- /*
- * Set current to a directory with no owner permissions.
- * Verify it works properly.
- */
-
- printf( "\n\nchmod of %s to Read/Write\n", Directories[0] );
- status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
- assert( status == 0 );
-
- printf("mkdir %s should fail with EACCESS\n", longer_name );
- status = mkdir( longer_name , S_IRWXU );
- assert( status == -1 );
- assert( errno == EACCES );
-
- printf("\n%s Should exist ( access )\n",Directories[0] );
- status = access( Directories[0], F_OK );
- assert( status == 0 );
- printf("\n%s Should have read permission( access )\n",Directories[0] );
- status = access( Directories[0], R_OK );
- assert( status != 0 );
- printf("\n%s Should have write permission( access )\n",Directories[0] );
- status = access( Directories[0], W_OK );
- assert( status != 0 );
- printf("\n%s Should not have execute permission( access )\n",Directories[0] );
- status = access( Directories[0], X_OK );
- assert( status != 0 );
-
- printf("\nRestore %s to RWX\n",Directories[0] );
- status = chmod( Directories[0], S_IRWXU );
- assert( status == 0 );
-
- printf("chdir to /my_mount_point \n");
- status = chdir( "/my_mount_point" );
- assert( status == 0 );
-
- /*
- * Remove one of the directories.
- * Verify links to the removed directory still work.
- */
-
- printf( "Remove %s\n", Directories[5] );
- status = rmdir( Directories[5] );
- assert( status == 0 );
-
- stat_a_file( Directories[5] );
- status = access( Directories[5], F_OK );
- assert( status != 0 );
-
- stat_a_file( Links_to_Dirs[5] );
- status = readlink( Links_to_Dirs[5], longer_name, 3 );
- assert( status == -1 );
- assert( errno == EINVAL );
-
- stat_a_file( Links_to_dirlinks[5] );
- printf("Chdir to %s\n", Links_to_Dirs[5] );
- status = chdir( Links_to_Dirs[5] );
- assert( status == 0 );
-
- /*
- * Verify we cannot move up from a node with no parent node.
- */
-
- printf("Chdir to .. should fail with ENOENT\n" );
- status = chdir( ".." );
- assert( status == -1 );
- assert( errno == ENOENT );
-
- /*
- * Create a subdirectory under the dangling node.
- */
-
- printf("mkdir ../t should fail with ENOENT\n" );
- status = mkdir( "../t" , S_IRWXU );
- assert( status == -1 );
- assert( errno == ENOENT );
-
- printf("mkdir t\n");
- status = mkdir( "t" , S_IRWXU );
- assert( status == 0 );
-
- printf("chdir to /my_mount_point\n");
- status = chdir( "/my_mount_point" );
- assert( status == 0 );
-
- /*
- * Check rmdir, rmnod, and unlink
- */
-
- printf("rmdir %s should fail with ENOTDIR\n", Links_to_Dirs[5] );
- status = rmdir( Links_to_Dirs[5] );
- assert( status == -1 );
- assert( errno == ENOTDIR );
-
- printf("unlink %s\n", Links_to_Dirs[5] );
- status = unlink( Links_to_Dirs[5] );
- assert( status == 0 );
-
- printf("unlink %s should fail with ENOTEMPTY\n", Links_to_dirlinks[5] );
- status = unlink( Links_to_dirlinks[5] );
- assert( status == -1 );
- assert( errno == ENOTEMPTY );
-
- strcpy( longer_name, Links_to_dirlinks[5] );
- strcat( longer_name, "/t");
- printf("rmdir %s\n", longer_name );
- status = rmdir( longer_name );
- assert( status == 0 );
-
- printf("unlink %s\n", Links_to_Dirs[5]);
- status = unlink( Links_to_dirlinks[5] );
- assert( status == 0 );
-
- status = chdir( Directories[0] );
- status = mkdir ( "my_mount_point", S_IRWXU );
- assert( status == 0 );
-
- printf("Attempting to mount IMFS file system at /dir1/my_mount_point \n");
- status = mount(
- &mt_entry,
- &IMFS_ops,
- RTEMS_FILESYSTEM_READ_WRITE,
- NULL,
- "/my_mount_point/dir1/my_mount_point" );
- assert( status == 0 );
-
- printf("rmdir /dir1/my_mount_point should fail with EBUSY\n");
- status = rmdir ("/my_mount_point/dir1/my_mount_point" );
- assert( status == -1 );
- assert( errno == EBUSY );
-
- printf( "Unmount /my_mount_point/dir1/my_mount_point\n");
- status = unmount( "/my_mount_point/dir1/my_mount_point" );
- assert( status == 0 );
-
- /*
- * Verify write permission is checked.
- */
-
- printf("chmod of %s to group and other execute\n", Files[0] );
- status = chmod (Files[0], (S_IXGRP | S_IXOTH) );
- assert( status == 0 );
-
- printf("Open %s for write should fail with EACCES\n", Files[0] );
- fd = open (Files[0], O_WRONLY);
- assert( fd == -1 );
- assert( errno == EACCES );
-
- printf("chmod of %s to User Execute and Read\n", Directories[3] );
- status = chmod (Directories[3], (S_IXUSR | S_IRUSR) );
- assert( status == 0 );
- strcpy(longer_name, Directories[3] );
- strcat(longer_name, "/NewFile" );
- printf("Mkdir of %s should fail with EACCES\n",longer_name );
- status = mkdir( longer_name, S_IRWXU );
- assert( status != 0 );
- assert( errno == EACCES );
-
- printf("Making too many hard links.\n" );
- make_too_many_links( );
-
- printf( "pass fstat a null pointer should fail with EFAULT\n");
- status = fstat( fd, NULL );
- assert( status == -1 );
- assert( errno == EFAULT);
-
- /*
- * The current directory MUST be restored at the end of this test.
- */
-
- printf("chdir to /my_mount_point \n");
- status = chdir( "/my_mount_point" );
- assert( status == 0 );
-
-}
-
-void Show_Time()
-{
- rtems_time_of_day time;
- rtems_status_code status;
-
- status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
- printf(">>>>Current Time: ");
- print_time( " - rtems_clock_get - ", &time, "\n" );
-}
-
-/*
- * main entry point to the test
- */
-
-#if defined(__rtems__)
-int test_main(void)
-#else
-int main(
- int argc,
- char **argv
-)
-#endif
-{
- rtems_status_code status;
- rtems_time_of_day time;
- rtems_filesystem_mount_table_entry_t *mt_entry;
-
- puts( "\n\n*** STAT TEST 01 ***" );
-
- build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
- status = rtems_clock_set( &time );
- Show_Time();
-
- /*
- * Create and mount another version of the filesyste.
- * This allows expected node id's to be consistant across
- * platforms and bsp's.
- */
-
- status = mkdir("/my_mount_point", S_IRWXU );
- assert( status == 0 );
- status = mount(
- &mt_entry,
- &IMFS_ops,
- RTEMS_FILESYSTEM_READ_WRITE,
- NULL,
- "my_mount_point" );
- assert( status == 0 );
- status = chdir( "/my_mount_point" );
- assert( status == 0 );
- status = mkdir("dev", S_IRWXU );
- assert( status == 0 );
-
-
- /*
- * Create the files and directories for the test.
- */
-
- make_multiple_directories( Directories );
- make_multiple_files( Files );
- make_multiple_links( Directories, Links_to_Dirs );
- make_multiple_links( Files, Links_to_Files );
-
- status = rtems_task_wake_after( TIMEOUT_VALUE );
- make_multiple_links( Links_to_Dirs, Links_to_dirlinks );
- status = rtems_task_wake_after( TIMEOUT_VALUE );
- make_multiple_links( Links_to_Files, Links_to_filelinks );
-
- status = rtems_task_wake_after( TIMEOUT_VALUE );
-
- /*
- * Now go through all the absolute path.
- */
-
- puts( "Doing the stat() on all the good absolute paths" );
- stat_multiple_files( Good_absolute_paths );
-
- /*
- * run through the relative paths.
- */
-
- puts( "\nDoing the stat() on all the good relative paths" );
- stat_multiple_files( Good_relative_paths );
-
- /*
- * Change directory and releative paths are now bad.
- */
-
- puts("\nchdir to dev");
- chdir("dev");
- puts("\nstat relative paths that are now bad");
- stat_multiple_files( Good_relative_paths );
-
- /*
- * Change directory to the link directory and follow links.
- */
-
- puts("\nchdir to ../links");
- chdir("../links");
- puts("Doing the stat() on good links\n");
- stat_multiple_files( Links_to_Dirs );
- stat_multiple_files( Links_to_Files );
- stat_multiple_files( Links_to_dirlinks );
- stat_multiple_files( Links_to_filelinks );
-
- /*
- * Chmod on dir1/dir1. This allows the error path to be hit.
- */
-
- printf( "chmod of %s to Read/Write\n", Directories[4] );
- chmod( Directories[4], (S_IROTH|S_IWOTH) );
- puts( "\nDoing the stat() on all the bad paths" );
-
- stat_multiple_files( Bad_paths );
- make_multiple_bad_files( Bad_paths );
-
- printf( "Return %s to RWX\n", Directories[4] );
- chmod( Directories[4], S_IRWXU );
-
-
- /*
- * Check out symbolic links.
- */
-
- make_multiple_symlinks();
- make_many_symlinks( "/symlinks", 10 );
-
- status = rtems_task_wake_after( TIMEOUT_VALUE );
- Cause_faults();
-
- status = rtems_task_wake_after( TIMEOUT_VALUE );
- chown_multiple_files( Files );
-
- status = rtems_task_wake_after( TIMEOUT_VALUE );
- chown_multiple_files( Links_to_Dirs );
-
- puts( "\n\n*** END OF STAT TEST 01 ***" );
- rtems_test_exit(0);
-}
-
-
-
-
-
-
-