diff options
Diffstat (limited to '')
21 files changed, 506 insertions, 541 deletions
diff --git a/testsuites/fstests/ChangeLog b/testsuites/fstests/ChangeLog index e633c61f9b..d17d8234a1 100644 --- a/testsuites/fstests/ChangeLog +++ b/testsuites/fstests/ChangeLog @@ -1,5 +1,99 @@ 2011-08-01 Xiang Cui <medivhc@gmail.com> + * Makefile.am, configure.ac, fslink/fslink.doc, fslink/test.c, + fssymlink/test.c, imfs_fslink/Makefile.am, + imfs_fssymlink/Makefile.am, imfs_support/fs_config.h, + imfs_support/fs_support.c, mdosfs_support/fs_config.h, + mdosfs_support/fs_support.c, mimfs_fslink/Makefile.am, + mimfs_fssymlink/Makefile.am, mimfs_support/fs_config.h, + mimfs_support/fs_support.c, mrfs_fslink/Makefile.am, + mrfs_fssymlink/Makefile.am, mrfs_support/fs_config.h, + mrfs_support/fs_support.c, support/fstest.h, + support/fstest_support.c, support/fstest_support.h, + support/ramdisk_support.c, support/ramdisk_support.h: Submit correct + tarball of current work. + * fs01/init.c, fsfchx/fsfchx.doc, fsfchx/init.c, fsfile01/fsfile01.doc, + fsfile01/test.c, fsfile01/test_cat.c, fsfile01/test_extend.c, + fsfile01/test_write.c, fsfile02/fsfile02.doc, fsfile02/init.c, + fsfstest/fs-test.c, fsfstest/fsfstest.doc, fsimfs01/fsimfs01.doc, + fsimfs01/init.c, fsimfs02/fsimfs02.doc, fsimfs02/init.c, + fsmkdir/fsmkdir.doc, fsmkdir/test.c, fsopen/fsopen.doc, + fsopen/test.c, fsrdwrv/fsrdwrv.doc, fsrdwrv/test.c, + fsreaddir/fsreaddir.doc, fsreaddir/test.c, fsrename/fsrename.doc, + fsrename/test.c, fsrmdir/test.c, fsrwfile/fsrwfile.doc, + fsrwfile/init.c, fsstat/fsstat.doc, fsstat/test.c, + fstruncate/fstruncate.doc, fstruncate/test.c, imfs_fs01/.cvsignore, + imfs_fs01/Makefile.am, imfs_fs01/imfs_fs01.scn, + imfs_fsfchx/.cvsignore, imfs_fsfchx/Makefile.am, + imfs_fsfile01/.cvsignore, imfs_fsfile01/Makefile.am, + imfs_fsfile02/.cvsignore, imfs_fsfile02/Makefile.am, + imfs_fsfstest/.cvsignore, imfs_fsfstest/Makefile.am, + imfs_fsimfs01/.cvsignore, imfs_fsimfs01/Makefile.am, + imfs_fsimfs02/.cvsignore, imfs_fsimfs02/Makefile.am, + imfs_fslink/.cvsignore, imfs_fsmkdir/.cvsignore, + imfs_fsmkdir/Makefile.am, imfs_fsopen/.cvsignore, + imfs_fsopen/Makefile.am, imfs_fsrdwrv/.cvsignore, + imfs_fsrdwrv/Makefile.am, imfs_fsreaddir/.cvsignore, + imfs_fsreaddir/Makefile.am, imfs_fsrename/.cvsignore, + imfs_fsrename/Makefile.am, imfs_fsrmdir/.cvsignore, + imfs_fsrmdir/Makefile.am, imfs_fsrwfile/.cvsignore, + imfs_fsrwfile/Makefile.am, imfs_fsstat/.cvsignore, + imfs_fsstat/Makefile.am, imfs_fssymlink/.cvsignore, + imfs_fstruncate/.cvsignore, imfs_fstruncate/Makefile.am, + mdosfs_fsfchx/.cvsignore, mdosfs_fsfchx/Makefile.am, + mdosfs_fsfile01/.cvsignore, mdosfs_fsfile01/Makefile.am, + mdosfs_fsfile02/.cvsignore, mdosfs_fsfile02/Makefile.am, + mdosfs_fsfstest/.cvsignore, mdosfs_fsfstest/Makefile.am, + mdosfs_fsimfs01/.cvsignore, mdosfs_fsimfs01/Makefile.am, + mdosfs_fsimfs02/.cvsignore, mdosfs_fsimfs02/Makefile.am, + mdosfs_fslink/.cvsignore, mdosfs_fslink/Makefile.am, + mdosfs_fsmkdir/.cvsignore, mdosfs_fsmkdir/Makefile.am, + mdosfs_fsopen/.cvsignore, mdosfs_fsopen/Makefile.am, + mdosfs_fsrdwrv/.cvsignore, mdosfs_fsrdwrv/Makefile.am, + mdosfs_fsreaddir/.cvsignore, mdosfs_fsreaddir/Makefile.am, + mdosfs_fsrename/.cvsignore, mdosfs_fsrename/Makefile.am, + mdosfs_fsrmdir/.cvsignore, mdosfs_fsrmdir/Makefile.am, + mdosfs_fsrwfile/.cvsignore, mdosfs_fsrwfile/Makefile.am, + mdosfs_fsstat/.cvsignore, mdosfs_fsstat/Makefile.am, + mdosfs_fssymlink/.cvsignore, mdosfs_fssymlink/Makefile.am, + mdosfs_fstruncate/.cvsignore, mdosfs_fstruncate/Makefile.am, + mimfs_fs01/.cvsignore, mimfs_fs01/Makefile.am, + mimfs_fs01/mimfs_fs01.scn, mimfs_fsfchx/.cvsignore, + mimfs_fsfchx/Makefile.am, mimfs_fsfile01/.cvsignore, + mimfs_fsfile01/Makefile.am, mimfs_fsfile02/.cvsignore, + mimfs_fsfile02/Makefile.am, mimfs_fsfstest/.cvsignore, + mimfs_fsfstest/Makefile.am, mimfs_fsimfs01/.cvsignore, + mimfs_fsimfs01/Makefile.am, mimfs_fsimfs02/.cvsignore, + mimfs_fsimfs02/Makefile.am, mimfs_fslink/.cvsignore, + mimfs_fsmkdir/.cvsignore, mimfs_fsmkdir/Makefile.am, + mimfs_fsopen/.cvsignore, mimfs_fsopen/Makefile.am, + mimfs_fsrdwrv/.cvsignore, mimfs_fsrdwrv/Makefile.am, + mimfs_fsreaddir/.cvsignore, mimfs_fsreaddir/Makefile.am, + mimfs_fsrename/.cvsignore, mimfs_fsrename/Makefile.am, + mimfs_fsrmdir/.cvsignore, mimfs_fsrmdir/Makefile.am, + mimfs_fsrwfile/.cvsignore, mimfs_fsrwfile/Makefile.am, + mimfs_fsstat/.cvsignore, mimfs_fsstat/Makefile.am, + mimfs_fssymlink/.cvsignore, mimfs_fstruncate/.cvsignore, + mimfs_fstruncate/Makefile.am, mrfs_fsfchx/.cvsignore, + mrfs_fsfchx/Makefile.am, mrfs_fsfile01/.cvsignore, + mrfs_fsfile01/Makefile.am, mrfs_fsfile02/.cvsignore, + mrfs_fsfile02/Makefile.am, mrfs_fsfstest/.cvsignore, + mrfs_fsfstest/Makefile.am, mrfs_fsimfs01/.cvsignore, + mrfs_fsimfs01/Makefile.am, mrfs_fsimfs02/.cvsignore, + mrfs_fsimfs02/Makefile.am, mrfs_fslink/.cvsignore, + mrfs_fsmkdir/.cvsignore, mrfs_fsmkdir/Makefile.am, + mrfs_fsopen/.cvsignore, mrfs_fsopen/Makefile.am, + mrfs_fsrdwrv/.cvsignore, mrfs_fsrdwrv/Makefile.am, + mrfs_fsreaddir/.cvsignore, mrfs_fsreaddir/Makefile.am, + mrfs_fsrename/.cvsignore, mrfs_fsrename/Makefile.am, + mrfs_fsrmdir/.cvsignore, mrfs_fsrmdir/Makefile.am, + mrfs_fsrwfile/.cvsignore, mrfs_fsrwfile/Makefile.am, + mrfs_fsstat/.cvsignore, mrfs_fsstat/Makefile.am, + mrfs_fssymlink/.cvsignore, mrfs_fstruncate/.cvsignore, + mrfs_fstruncate/Makefile.am: Removed. + +2011-08-01 Xiang Cui <medivhc@gmail.com> + * Makefile.am, configure.ac, imfs_support/fs_config.h, imfs_support/fs_support.c, mimfs_support/fs_config.h, mimfs_support/fs_support.c: Add initial version of new filesystem diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am index 6d98b87e7f..7be1e028fa 100644 --- a/testsuites/fstests/Makefile.am +++ b/testsuites/fstests/Makefile.am @@ -4,80 +4,15 @@ ACLOCAL_AMFLAGS = -I ../aclocal +SUBDIRS = imfs_fserror imfs_fslink imfs_fspatheval imfs_fspermission\ + imfs_fsrdwr imfs_fssymlink imfs_fstime mdosfs_fserror\ + mdosfs_fspatheval mdosfs_fsrdwr mdosfs_fstime mimfs_fserror\ + mimfs_fslink mimfs_fspatheval mimfs_fspermission\ + mimfs_fsrdwr mimfs_fssymlink mimfs_fstime mrfs_fserror\ + mrfs_fslink mrfs_fspatheval mrfs_fspermission mrfs_fsrdwr\ + mrfs_fssymlink mrfs_fstime DIST_SUBDIRS = $(SUBDIRS) support -EXTRA_DIST = support/ramdisk_support.c -EXTRA_DIST += support/ramdisk_support.h -EXTRA_DIST += support/fstest_support.c -EXTRA_DIST += support/fstest_support.h - -SUBDIRS = imfs_fsfchx -SUBDIRS += imfs_fsfile01 -SUBDIRS += imfs_fsfile02 -SUBDIRS += imfs_fsfstest -SUBDIRS += imfs_fsimfs01 -SUBDIRS += imfs_fsimfs02 -SUBDIRS += imfs_fslink -SUBDIRS += imfs_fsmkdir -SUBDIRS += imfs_fsopen -SUBDIRS += imfs_fsrdwrv -SUBDIRS += imfs_fsreaddir -SUBDIRS += imfs_fsrename -SUBDIRS += imfs_fsrmdir -SUBDIRS += imfs_fsrwfile -SUBDIRS += imfs_fsstat -SUBDIRS += imfs_fssymlink -SUBDIRS += imfs_fstruncate -SUBDIRS += mdosfs_fsfchx -SUBDIRS += mdosfs_fsfile01 -SUBDIRS += mdosfs_fsfile02 -SUBDIRS += mdosfs_fsfstest -SUBDIRS += mdosfs_fsimfs01 -SUBDIRS += mdosfs_fsimfs02 -SUBDIRS += mdosfs_fslink -SUBDIRS += mdosfs_fsmkdir -SUBDIRS += mdosfs_fsopen -SUBDIRS += mdosfs_fsrdwrv -SUBDIRS += mdosfs_fsreaddir -SUBDIRS += mdosfs_fsrename -SUBDIRS += mdosfs_fsrmdir -SUBDIRS += mdosfs_fsrwfile -SUBDIRS += mdosfs_fsstat -SUBDIRS += mdosfs_fssymlink -SUBDIRS += mdosfs_fstruncate -SUBDIRS += mimfs_fsfchx -SUBDIRS += mimfs_fsfile01 -SUBDIRS += mimfs_fsfile02 -SUBDIRS += mimfs_fsfstest -SUBDIRS += mimfs_fsimfs01 -SUBDIRS += mimfs_fsimfs02 -SUBDIRS += mimfs_fslink -SUBDIRS += mimfs_fsmkdir -SUBDIRS += mimfs_fsopen -SUBDIRS += mimfs_fsrdwrv -SUBDIRS += mimfs_fsreaddir -SUBDIRS += mimfs_fsrename -SUBDIRS += mimfs_fsrmdir -SUBDIRS += mimfs_fsrwfile -SUBDIRS += mimfs_fsstat -SUBDIRS += mimfs_fssymlink -SUBDIRS += mimfs_fstruncate -SUBDIRS += mrfs_fsfchx -SUBDIRS += mrfs_fsfile01 -SUBDIRS += mrfs_fsfile02 -SUBDIRS += mrfs_fsfstest -SUBDIRS += mrfs_fsimfs01 -SUBDIRS += mrfs_fsimfs02 -SUBDIRS += mrfs_fslink -SUBDIRS += mrfs_fsmkdir -SUBDIRS += mrfs_fsopen -SUBDIRS += mrfs_fsrdwrv -SUBDIRS += mrfs_fsreaddir -SUBDIRS += mrfs_fsrename -SUBDIRS += mrfs_fsrmdir -SUBDIRS += mrfs_fsrwfile -SUBDIRS += mrfs_fsstat -SUBDIRS += mrfs_fssymlink -SUBDIRS += mrfs_fstruncate +EXTRA_DIST = support/ramdisk_support.c support/ramdisk_support.h support/fstest_support.c support/fstest_support.h include $(top_srcdir)/../automake/subdirs.am include $(top_srcdir)/../automake/local.am diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac index fb50d02aa3..e279389bc6 100644 --- a/testsuites/fstests/configure.ac +++ b/testsuites/fstests/configure.ac @@ -3,7 +3,8 @@ ## $Id$ AC_PREREQ([2.68]) -AC_INIT([rtems-c-src-tests-fstests],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) +AC_INIT([rtems-c-src-tests-fstests], + [_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) AC_CONFIG_SRCDIR([imfs_support]) RTEMS_TOP([../..],[..]) @@ -78,74 +79,31 @@ AC_CHECK_SIZEOF([blkcnt_t]) # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile -imfs_fsfchx/Makefile -imfs_fsfile01/Makefile -imfs_fsfile02/Makefile -imfs_fsfstest/Makefile -imfs_fsimfs01/Makefile -imfs_fsimfs02/Makefile +imfs_fserror/Makefile imfs_fslink/Makefile -imfs_fsmkdir/Makefile -imfs_fsopen/Makefile -imfs_fsrdwrv/Makefile -imfs_fsreaddir/Makefile -imfs_fsrename/Makefile -imfs_fsrmdir/Makefile -imfs_fsrwfile/Makefile -imfs_fsstat/Makefile +imfs_fspatheval/Makefile +imfs_fspermission/Makefile +imfs_fsrdwr/Makefile imfs_fssymlink/Makefile -imfs_fstruncate/Makefile -mdosfs_fsfchx/Makefile -mdosfs_fsfile01/Makefile -mdosfs_fsfile02/Makefile -mdosfs_fsfstest/Makefile -mdosfs_fsimfs01/Makefile -mdosfs_fsimfs02/Makefile -mdosfs_fslink/Makefile -mdosfs_fsmkdir/Makefile -mdosfs_fsopen/Makefile -mdosfs_fsrdwrv/Makefile -mdosfs_fsreaddir/Makefile -mdosfs_fsrename/Makefile -mdosfs_fsrmdir/Makefile -mdosfs_fsrwfile/Makefile -mdosfs_fsstat/Makefile -mdosfs_fssymlink/Makefile -mdosfs_fstruncate/Makefile -mimfs_fsfchx/Makefile -mimfs_fsfile01/Makefile -mimfs_fsfile02/Makefile -mimfs_fsfstest/Makefile -mimfs_fsimfs01/Makefile -mimfs_fsimfs02/Makefile +imfs_fstime/Makefile +mdosfs_fserror/Makefile +mdosfs_fspatheval/Makefile +mdosfs_fsrdwr/Makefile +mdosfs_fstime/Makefile +mimfs_fserror/Makefile mimfs_fslink/Makefile -mimfs_fsmkdir/Makefile -mimfs_fsopen/Makefile -mimfs_fsrdwrv/Makefile -mimfs_fsreaddir/Makefile -mimfs_fsrename/Makefile -mimfs_fsrmdir/Makefile -mimfs_fsrwfile/Makefile -mimfs_fsstat/Makefile +mimfs_fspatheval/Makefile +mimfs_fspermission/Makefile +mimfs_fsrdwr/Makefile mimfs_fssymlink/Makefile -mimfs_fstruncate/Makefile -mrfs_fsfchx/Makefile -mrfs_fsfile01/Makefile -mrfs_fsfile02/Makefile -mrfs_fsfstest/Makefile -mrfs_fsimfs01/Makefile -mrfs_fsimfs02/Makefile +mimfs_fstime/Makefile +mrfs_fserror/Makefile mrfs_fslink/Makefile -mrfs_fsmkdir/Makefile -mrfs_fsopen/Makefile -mrfs_fsrdwrv/Makefile -mrfs_fsreaddir/Makefile -mrfs_fsrename/Makefile -mrfs_fsrmdir/Makefile -mrfs_fsrwfile/Makefile -mrfs_fsstat/Makefile +mrfs_fspatheval/Makefile +mrfs_fspermission/Makefile +mrfs_fsrdwr/Makefile mrfs_fssymlink/Makefile -mrfs_fstruncate/Makefile +mrfs_fstime/Makefile ]) AC_OUTPUT diff --git a/testsuites/fstests/fslink/fslink.doc b/testsuites/fstests/fslink/fslink.doc index 93b256c1f9..008e671130 100644 --- a/testsuites/fstests/fslink/fslink.doc +++ b/testsuites/fstests/fslink/fslink.doc @@ -15,10 +15,8 @@ test set name: fslink directives: -+ link -+ chmod -+ chown - ++link ++stat concepts: diff --git a/testsuites/fstests/fslink/test.c b/testsuites/fstests/fslink/test.c index 50ec89d48a..a9df8ffd4b 100644 --- a/testsuites/fstests/fslink/test.c +++ b/testsuites/fstests/fslink/test.c @@ -1,4 +1,3 @@ - /* * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). @@ -23,215 +22,137 @@ #include "fstest.h" -mode_t mode = 0644; /* * Test if the successful call works as expect */ -void link_test01(void ) +void link_test01 (void) { - char *name0="t0"; - char *name1="t1"; - char *name2="t2"; - char *name3="t3"; + char *name0 = "t0"; + char *name1 = "t1"; + char *name2 = "t2"; + int status; int fd; + mode_t mode = 0644; struct stat statbuf; - mode_t tmp_mode; - - time_t ctime1,dctime1,dmtime1; - time_t ctime2,dctime2,dmtime2; - - puts("link creates hardlinks"); - - status=mkdir(name3,0755); - rtems_test_assert(status==0); - - status=chdir(name3); - rtems_test_assert(status==0); - fd=creat(name0,mode); - status=close(fd); - rtems_test_assert(status==0); - - status=stat(name0,&statbuf); - rtems_test_assert(status==0); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); - rtems_test_assert(statbuf.st_nlink==1); - printf("the arg is %04o and the is %04o \n",tmp_mode,mode); - puts("test if the stat is the same"); - status=link(name0,name1); - rtems_test_assert(status==0); - status=stat(name0,&statbuf); - rtems_test_assert(status==0); + puts ("link creates hardlinks"); + fd = creat (name0, mode); + status = close (fd); + rtems_test_assert (status == 0); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); - rtems_test_assert(statbuf.st_nlink==2); + status = stat (name0, &statbuf); + rtems_test_assert (status == 0); + rtems_test_assert (statbuf.st_nlink == 1); - status=stat(name1,&statbuf); - rtems_test_assert(status==0); + puts ("test if the stat is the same"); + status = link (name0, name1); + rtems_test_assert (status == 0); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); - rtems_test_assert(statbuf.st_nlink==2); + status = stat (name0, &statbuf); + rtems_test_assert (status == 0); - status=link(name1,name2); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 2); - status=stat(name0,&statbuf); - rtems_test_assert(status==0); - - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); - rtems_test_assert(statbuf.st_nlink==3); - - status=stat(name1,&statbuf); - rtems_test_assert(status==0); - - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); - rtems_test_assert(statbuf.st_nlink==3); - - - status=stat(name2,&statbuf); - rtems_test_assert(status==0); - - rtems_test_assert(S_ISREG(statbuf.st_mode)); - rtems_test_assert(statbuf.st_nlink==3); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0644); -/* - * call chmod and chown and test. - */ + status = stat (name1, &statbuf); + rtems_test_assert (status == 0); - puts("chmod and chown"); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 2); - chmod(name1,0201); - chown(name1,65534,65533); + /* + * link the file and check the nlink + */ + status = link (name1, name2); + rtems_test_assert (status == 0); + status = stat (name0, &statbuf); + rtems_test_assert (status == 0); - status=stat(name0,&statbuf); - rtems_test_assert(status==0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - rtems_test_assert(statbuf.st_nlink==3); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0201); - rtems_test_assert(statbuf.st_uid=65534); - rtems_test_assert(statbuf.st_gid=65533); + status = stat (name1, &statbuf); + rtems_test_assert (status == 0); - status=stat(name1,&statbuf); - rtems_test_assert(status==0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0201); - rtems_test_assert(statbuf.st_nlink==3); - rtems_test_assert(statbuf.st_uid=65534); - rtems_test_assert(statbuf.st_gid=65533); + status = stat (name2, &statbuf); + rtems_test_assert (status == 0); - status=stat(name2,&statbuf); - rtems_test_assert(status==0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0201); - rtems_test_assert(statbuf.st_nlink==3); - rtems_test_assert(statbuf.st_nlink==3); - rtems_test_assert(statbuf.st_uid=65534); - rtems_test_assert(statbuf.st_gid=65533); -/* - * - * unlink then test if the nlink changes - */ + /* + * call chmod and chown and test. + */ + puts ("chmod and chown"); - puts("unlink then stat the file "); + chown (name1, 65534, 65533); - status=unlink(name0); - rtems_test_assert(status==0); + status = stat (name0, &statbuf); + rtems_test_assert (status == 0); - status=stat(name0,&statbuf); - rtems_test_assert(status==-1); - rtems_test_assert(errno=ENOENT); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); + rtems_test_assert (statbuf.st_uid = 65534); + rtems_test_assert (statbuf.st_gid = 65533); + status = stat (name1, &statbuf); + rtems_test_assert (status == 0); - status=stat(name1,&statbuf); - rtems_test_assert(status==0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); + rtems_test_assert (statbuf.st_uid = 65534); + rtems_test_assert (statbuf.st_gid = 65533); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0201); - rtems_test_assert(statbuf.st_nlink==2); + status = stat (name2, &statbuf); + rtems_test_assert (status == 0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 3); + rtems_test_assert (statbuf.st_uid = 65534); + rtems_test_assert (statbuf.st_gid = 65533); - status=stat(name2,&statbuf); - rtems_test_assert(status==0); + /* + * + * unlink then test if the nlink changes + */ + puts ("unlink then stat the file "); - rtems_test_assert(S_ISREG(statbuf.st_mode)); - tmp_mode=(statbuf.st_mode)&ALLPERMS; - rtems_test_assert(tmp_mode==0201); - rtems_test_assert(statbuf.st_nlink==2); + status = unlink (name0); + rtems_test_assert (status == 0); + status = stat (name0, &statbuf); + rtems_test_assert (status == -1); + rtems_test_assert (errno = ENOENT); - status=unlink(name1); - rtems_test_assert(status==0); + status = stat (name1, &statbuf); + rtems_test_assert (status == 0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 2); - status=unlink(name2); - rtems_test_assert(status==0); + status = stat (name2, &statbuf); + rtems_test_assert (status == 0); + rtems_test_assert (S_ISREG (statbuf.st_mode)); + rtems_test_assert (statbuf.st_nlink == 2); + status = unlink (name1); + rtems_test_assert (status == 0); - /* - * successful link() updates ctime - * and the ctime and mtime of the - * directory. - */ - fd=creat(name0,0644); - status=close(fd); - rtems_test_assert(status==0); - - status=stat(name0,&statbuf); - ctime1=statbuf.st_ctime; - status=stat(".",&statbuf); - rtems_test_assert(status==0); - dctime1=statbuf.st_ctime; - dmtime1=statbuf.st_mtime; - - puts("sleep a few seconds"); - sleep(TIME_PRECISION ); - - status=link(name0,name1); - rtems_test_assert(status==0); - status=stat(name0,&statbuf); - ctime2=statbuf.st_ctime; - status=stat(".",&statbuf); - dctime2=statbuf.st_ctime; - dmtime2=statbuf.st_mtime; - - puts("test if the time changes"); - rtems_test_assert(!time_equal(ctime1,ctime2)); -#if !defined(IMFS_TEST) && !defined(MIMFS_TEST) - rtems_test_assert(!time_equal(dctime1,dctime2)); -#endif -#if !defined(IMFS_TEST) && !defined(MIMFS_TEST) - rtems_test_assert(!time_equal(dmtime1,dmtime2)); -#endif + status = unlink (name2); + rtems_test_assert (status == 0); } -void test(void) + +void test (void) { - puts( "\n\n*** LINK TEST ***" ); -#if defined(MDOSFS_TEST) -#else - link_test01(); -#endif - puts( "*** END OF LINK TEST ***" ); + puts ("\n\n*** LINK TEST ***"); + link_test01 (); + puts ("*** END OF LINK TEST ***"); } - diff --git a/testsuites/fstests/fssymlink/test.c b/testsuites/fstests/fssymlink/test.c index 7e12273845..387a210844 100644 --- a/testsuites/fstests/fssymlink/test.c +++ b/testsuites/fstests/fssymlink/test.c @@ -1,6 +1,16 @@ +/* + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ + */ + #include <sys/stat.h> -#include <limits.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> @@ -16,122 +26,138 @@ /* * Test the function of symlink */ -void symlink_test01() + +void symlink_test01(void ) { int fd; - char* name0="file"; - char* name1="symlink"; + char* file01="file"; + char* symlink_file01="symlink"; + char name[20]; int status; struct stat statbuf; - int len=strlen(name0); + size_t len=strlen(file01); + size_t name_len; + - printf("Create a file named %s\n",name0); - fd=creat(name0,0777); + printf("Create a file named %s\n",file01); + fd=creat(file01,0777); status=close(fd); rtems_test_assert(status==0); - printf("Create a symlink named %s to %s\n",name1,name0); - status=symlink(name0,name1); + printf("Create a symlink named %s to %s\n",symlink_file01,file01); + status=symlink(file01,symlink_file01); rtems_test_assert(status==0); - status=stat(name0,&statbuf); + status=stat(file01,&statbuf); rtems_test_assert(status==0); rtems_test_assert(S_ISREG(statbuf.st_mode)); rtems_test_assert(0==statbuf.st_size); - - status=lstat(name1,&statbuf); + status=lstat(symlink_file01,&statbuf); rtems_test_assert(status==0); rtems_test_assert(S_ISLNK(statbuf.st_mode)); -#if !defined(IMFS_TEST) && !defined(MIMFS_TEST) rtems_test_assert(len==statbuf.st_size); -#endif + + puts("call readlink "); + name_len=readlink(symlink_file01,name,sizeof(name)-1); + rtems_test_assert(name_len!=-1); + name[name_len]='\0'; + rtems_test_assert(!strncmp(name,file01,name_len)); + puts(name); puts("Unlink the file"); - status=unlink(name0); + status=unlink(file01); rtems_test_assert(status==0); - - status=lstat(name1,&statbuf); + status=lstat(symlink_file01,&statbuf); rtems_test_assert(status==0); rtems_test_assert(S_ISLNK(statbuf.st_mode)); - - status=unlink(name1); + rtems_test_assert(len==statbuf.st_size); + + puts("call readlink "); + name_len=readlink(symlink_file01,name,sizeof(name)-1); + rtems_test_assert(name_len!=-1); + name[name_len]='\0'; + rtems_test_assert(!strncmp(name,file01,name_len)); + status=unlink(symlink_file01); rtems_test_assert(status==0); - printf("Create a dir named %s\n",name0); - status=mkdir (name0,0777); + printf("Create a dir named %s\n",file01); + status=mkdir (file01,0777); - printf("Create a symlink named %s to %s\n",name1,name0); - status=symlink(name0,name1); + printf("Create a symlink named %s to %s\n",symlink_file01,file01); + status=symlink(file01,symlink_file01); rtems_test_assert(status==0); - - - status=lstat(name1,&statbuf); + status=lstat(symlink_file01,&statbuf); rtems_test_assert(status==0); rtems_test_assert(S_ISLNK(statbuf.st_mode)); -#if !defined(IMFS_TEST) && !defined(MIMFS_TEST) rtems_test_assert(len==statbuf.st_size); -#endif + + + puts("call readlink "); + name_len=readlink(symlink_file01,name,sizeof(name)-1); + rtems_test_assert(name_len!=-1); + name[name_len]='\0'; + rtems_test_assert(!strncmp(name,file01,name_len)); + + name_len=readlink(symlink_file01,name,3); + rtems_test_assert(name_len!=-1); + name[name_len]='\0'; + rtems_test_assert(!strncmp(name,file01,name_len)); puts("rmdir the dir"); - status=rmdir(name0); + status=rmdir(file01); rtems_test_assert(status==0); - - status=lstat(name1,&statbuf); + status=lstat(symlink_file01,&statbuf); rtems_test_assert(status==0); rtems_test_assert(S_ISLNK(statbuf.st_mode)); - status=unlink(name1); + status=unlink(symlink_file01); rtems_test_assert(status==0); } /* - * symlink loop test + * symlink loop error test */ -void symlink_test02() +void symlink_loop_error_test(void ) { + char* file01="file01"; + char* file02="file02"; + + char* file04="file04"; + char* path="file01/t"; - char* name0="symlink0"; - char* name1="symlink1"; int status; + mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; + + puts("symlink loop erro test"); - puts("symlink loop test"); - status=symlink(name0,name1); + status=symlink(file01,file02); rtems_test_assert(status==0); - status=symlink(name1,name0); + status=symlink(file02,file01); rtems_test_assert(status==0); - - puts("create a file Should fail with ELOOP"); - status=creat(name0,0777); - rtems_test_assert(status!=0); -#if !defined(MRFS_TEST) - rtems_test_assert(errno==ELOOP); -#endif - puts("truncate a file Should with ELOOP"); - status=truncate(name0,0777); - rtems_test_assert(status!=0); -#if !defined(MRFS_TEST) - rtems_test_assert(errno==ELOOP); -#endif + + EXPECT_ERROR(ELOOP,creat,path,mode); + EXPECT_ERROR(ELOOP,open,path,O_CREAT|O_WRONLY,mode); + EXPECT_ERROR(ELOOP,truncate,path,0); + EXPECT_ERROR(ELOOP,rename,path,file04); + EXPECT_ERROR(ELOOP,unlink,path); + EXPECT_ERROR(ELOOP,mkdir,path,mode); + EXPECT_ERROR(ELOOP,rmdir,path); } -void test() +void test(void ) { puts( "\n\n*** SYMLINK TEST ***" ); -#if defined(MDOSFS_TEST) -#else symlink_test01(); - symlink_test02(); -#endif - + symlink_loop_error_test(); puts( "*** END OF SYMLINK TEST ***" ); } diff --git a/testsuites/fstests/imfs_support/fs_config.h b/testsuites/fstests/imfs_support/fs_config.h index d2207d5f74..9e4988e0bc 100644 --- a/testsuites/fstests/imfs_support/fs_config.h +++ b/testsuites/fstests/imfs_support/fs_config.h @@ -1,5 +1,12 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ #ifndef __IMFS_SUPPORT_h #define __IMFS_SUPPORT_h @@ -7,18 +14,5 @@ #define IMFS_TEST #define FILESYSTEM "IMFS" -#define BASE_FOR_TEST "/mnt/" - -#ifdef __cplusplus -extern "C" { -#endif - -extern void test_initialize_filesystem(void); - -extern void test_shutdown_filesystem(void); - -#ifdef __cplusplus -}; -#endif #endif diff --git a/testsuites/fstests/imfs_support/fs_support.c b/testsuites/fstests/imfs_support/fs_support.c index 9aaa939783..ce16027a9b 100644 --- a/testsuites/fstests/imfs_support/fs_support.c +++ b/testsuites/fstests/imfs_support/fs_support.c @@ -1,34 +1,44 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "pmacros.h" -#include "fs_config.h" +#include <sys/stat.h> + +#include "fstest.h" -void test_initialize_filesystem(void) +void +test_initialize_filesystem (void) { - int rc=0; - rc=mkdir(BASE_FOR_TEST,0777); - rtems_test_assert(rc==0); + int rc = 0; + rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); + rtems_test_assert (rc == 0); } -void test_shutdown_filesystem(void) +void +test_shutdown_filesystem (void) { } + /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 10 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 #define CONFIGURE_INIT - #include <rtems/confdefs.h> diff --git a/testsuites/fstests/mdosfs_support/fs_config.h b/testsuites/fstests/mdosfs_support/fs_config.h index 834e9bc8a2..f48522dd70 100644 --- a/testsuites/fstests/mdosfs_support/fs_config.h +++ b/testsuites/fstests/mdosfs_support/fs_config.h @@ -1,5 +1,12 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ #ifndef __MIMFS_SUPPORT_h @@ -9,12 +16,5 @@ #define FILESYSTEM "MOUNTED DOSFS" #define BASE_FOR_TEST "/mnt/" -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -}; -#endif #endif diff --git a/testsuites/fstests/mdosfs_support/fs_support.c b/testsuites/fstests/mdosfs_support/fs_support.c index c69a6b1911..d5a2c736ed 100644 --- a/testsuites/fstests/mdosfs_support/fs_support.c +++ b/testsuites/fstests/mdosfs_support/fs_support.c @@ -1,7 +1,13 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -34,7 +40,7 @@ msdos_format_request_param_t rqdata = { void test_initialize_filesystem(void) { int rc=0; - rc=mkdir(BASE_FOR_TEST,0777); + rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); rtems_test_assert(rc==0); init_ramdisk(); @@ -69,20 +75,12 @@ void test_shutdown_filesystem(void) * Configure base RTEMS resources. */ #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MEMORY_OVERHEAD 512 -#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6) -#define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4) -#define CONFIGURE_MAXIMUM_TIMERS 10 - -/** - * Configure file system and libblock. - */ +#define CONFIGURE_MAXIMUM_TASKS 10 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 -#define CONFIGURE_MAXIMUM_DRIVERS 100 +#define CONFIGURE_MAXIMUM_DRIVERS 10 +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 + #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK #define CONFIGURE_FILESYSTEM_DOSFS diff --git a/testsuites/fstests/mimfs_fslink/Makefile.am b/testsuites/fstests/mimfs_fslink/Makefile.am index 9f8686f0ec..ec734ca59e 100644 --- a/testsuites/fstests/mimfs_fslink/Makefile.am +++ b/testsuites/fstests/mimfs_fslink/Makefile.am @@ -5,9 +5,9 @@ MANAGERS = all rtems_tests_PROGRAMS = mimfs_fslink -mimfs_fslink_SOURCES = ../fslink/test.c ../support/ramdisk_support.c\ - ../support/fstest_support.c ../support/fstest_support.h\ - ../support/ramdisk_support.h ../support/fstest.h ../../psxtests/include/pmacros.h \ +mimfs_fslink_SOURCES = ../fslink/test.c ../support/fstest_support.c\ + ../support/fstest_support.h ../support/fstest.h \ + ../../psxtests/include/pmacros.h \ ../mimfs_support/fs_support.c ../mimfs_support/fs_config.h diff --git a/testsuites/fstests/mimfs_fssymlink/Makefile.am b/testsuites/fstests/mimfs_fssymlink/Makefile.am index 09391831e8..4561015154 100644 --- a/testsuites/fstests/mimfs_fssymlink/Makefile.am +++ b/testsuites/fstests/mimfs_fssymlink/Makefile.am @@ -5,9 +5,8 @@ MANAGERS = all rtems_tests_PROGRAMS = mimfs_fssymlink -mimfs_fssymlink_SOURCES = ../fssymlink/test.c ../support/ramdisk_support.c\ - ../support/fstest_support.c ../support/fstest_support.h\ - ../support/ramdisk_support.h ../support/fstest.h ../../psxtests/include/pmacros.h \ +mimfs_fssymlink_SOURCES = ../fssymlink/test.c ../support/fstest_support.c\ + ../support/fstest_support.h ../support/fstest.h ../../psxtests/include/pmacros.h \ ../mimfs_support/fs_support.c ../mimfs_support/fs_config.h diff --git a/testsuites/fstests/mimfs_support/fs_config.h b/testsuites/fstests/mimfs_support/fs_config.h index f68fec47b1..b6260f5902 100644 --- a/testsuites/fstests/mimfs_support/fs_config.h +++ b/testsuites/fstests/mimfs_support/fs_config.h @@ -1,5 +1,12 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ #ifndef __MIMFS_SUPPORT_h @@ -8,13 +15,5 @@ #define MIMFS_TEST #define FILESYSTEM "MOUNTED IMFS" -#define BASE_FOR_TEST "/mnt/" -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -}; -#endif #endif diff --git a/testsuites/fstests/mimfs_support/fs_support.c b/testsuites/fstests/mimfs_support/fs_support.c index dcebd9be49..da59d5e92f 100644 --- a/testsuites/fstests/mimfs_support/fs_support.c +++ b/testsuites/fstests/mimfs_support/fs_support.c @@ -1,5 +1,12 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ #ifdef HAVE_CONFIG_H @@ -7,36 +14,29 @@ #endif #include "pmacros.h" -#include "fs_config.h" - #include <sys/stat.h> -#include <sys/types.h> - #include <rtems/libio.h> +#include "fstest.h" - -void test_initialize_filesystem(void) +void +test_initialize_filesystem (void) { - int rc=0; - rc=mkdir(BASE_FOR_TEST,0777); - rtems_test_assert(rc==0); + int rc = 0; + rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); + rtems_test_assert (rc == 0); - - rc=mount(NULL, - BASE_FOR_TEST, - "imfs", - RTEMS_FILESYSTEM_READ_WRITE, - NULL); - rtems_test_assert(rc==0); + rc = mount (NULL, BASE_FOR_TEST, "imfs", RTEMS_FILESYSTEM_READ_WRITE, NULL); + rtems_test_assert (rc == 0); } -void test_shutdown_filesystem(void) +void +test_shutdown_filesystem (void) { - int rc=0; - rc=unmount(BASE_FOR_TEST) ; - rtems_test_assert(rc==0); + int rc = 0; + rc = unmount (BASE_FOR_TEST); + rtems_test_assert (rc == 0); } /* configuration information */ @@ -49,23 +49,13 @@ void test_shutdown_filesystem(void) * Configure base RTEMS resources. */ #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MEMORY_OVERHEAD 512 -#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6) -#define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4) -#define CONFIGURE_MAXIMUM_TIMERS 10 -/** - * Configure file system and libblock. - */ -#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 -#define CONFIGURE_MAXIMUM_DRIVERS 100 -#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 #define CONFIGURE_INIT #include <rtems/confdefs.h> - diff --git a/testsuites/fstests/mrfs_support/fs_config.h b/testsuites/fstests/mrfs_support/fs_config.h index 808440c356..ba8bbdaa85 100644 --- a/testsuites/fstests/mrfs_support/fs_config.h +++ b/testsuites/fstests/mrfs_support/fs_config.h @@ -8,14 +8,5 @@ #define MRFS_TEST #define FILESYSTEM "MOUNTED RFS" -#define BASE_FOR_TEST "/mnt/" -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -}; -#endif #endif diff --git a/testsuites/fstests/mrfs_support/fs_support.c b/testsuites/fstests/mrfs_support/fs_support.c index 7db033afd5..b4f6b6b108 100644 --- a/testsuites/fstests/mrfs_support/fs_support.c +++ b/testsuites/fstests/mrfs_support/fs_support.c @@ -1,5 +1,12 @@ /* - * $Id$ + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ */ #ifdef HAVE_CONFIG_H @@ -7,79 +14,64 @@ #endif #include "pmacros.h" -#include "fs_config.h" - #include <sys/stat.h> #include <sys/types.h> #include <rtems/libio.h> #include <rtems/rtems-rfs-format.h> + #include "ramdisk_support.h" +#include "fstest.h" + #define BLOCK_SIZE (512) -rtems_rfs_format_config config= -{ +rtems_rfs_format_config config = { block_size:BLOCK_SIZE }; -void test_initialize_filesystem(void) +void +test_initialize_filesystem (void) { - int rc=0; - rc=mkdir(BASE_FOR_TEST,0777); - rtems_test_assert(rc==0); + int rc = 0; + rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); + rtems_test_assert (rc == 0); - init_ramdisk(); + init_ramdisk (); - rc=rtems_rfs_format(RAMDISK_PATH,&config); - rtems_test_assert(rc==0); + rc = rtems_rfs_format (RAMDISK_PATH, &config); + rtems_test_assert (rc == 0); - rc=mount(RAMDISK_PATH, - BASE_FOR_TEST, - "rfs", - RTEMS_FILESYSTEM_READ_WRITE, - NULL); - rtems_test_assert(rc==0); + rc = mount (RAMDISK_PATH, + BASE_FOR_TEST, "rfs", RTEMS_FILESYSTEM_READ_WRITE, NULL); + rtems_test_assert (rc == 0); } -void test_shutdown_filesystem(void) +void +test_shutdown_filesystem (void) { - int rc=0; - rc=unmount(BASE_FOR_TEST) ; - rtems_test_assert(rc==0); - del_ramdisk(); + int rc = 0; + rc = unmount (BASE_FOR_TEST); + rtems_test_assert (rc == 0); + del_ramdisk (); } /* configuration information */ - -/* drivers */ #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -/** - * Configure base RTEMS resources. - */ #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MEMORY_OVERHEAD 512 -#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10) -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6) -#define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4) -#define CONFIGURE_MAXIMUM_TIMERS 10 - -/** - * Configure file system and libblock. - */ +#define CONFIGURE_MAXIMUM_TASKS 10 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 -#define CONFIGURE_MAXIMUM_DRIVERS 100 +#define CONFIGURE_MAXIMUM_DRIVERS 10 +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 + #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK #define CONFIGURE_FILESYSTEM_RFS #define CONFIGURE_INIT #include <rtems/confdefs.h> - diff --git a/testsuites/fstests/support/fstest.h b/testsuites/fstests/support/fstest.h index bc5b591873..94bf87b45c 100644 --- a/testsuites/fstests/support/fstest.h +++ b/testsuites/fstests/support/fstest.h @@ -1,6 +1,12 @@ /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). * - * $Id$ + * 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 Exp $ */ #ifndef __FSTEST_H @@ -9,15 +15,46 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - #include <pmacros.h> -#include "fs_config.h" - #define TIME_PRECISION (2) -#define time_equal(x,y) (abs((x)-(y))<TIME_PRECISION) -#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) -#endif +#define TIME_EQUAL(x,y) (abs((x)-(y))<TIME_PRECISION) + + +#define FS_PASS() do {puts("PASS");} while (0) +#define FS_FAIL() do {printf( "FAIL %s: %d \n", __FILE__, __LINE__ ); } while (0) + +#define SHOW_MESSAGE(e, func, ...) printf(\ + "Testing %-10s with arguments: %-20s EXPECT %s\n",\ + #func,#__VA_ARGS__,#e) + +#define EXPECT_EQUAL(expect, function, ...) do { \ + SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ + if (expect==function(__VA_ARGS__)) \ + FS_PASS();\ + else \ + FS_FAIL();\ + } while (0) + +#define EXPECT_UNEQUAL(expect, function, ...) do { \ + SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ + if (expect!=function(__VA_ARGS__)) \ + FS_PASS();\ + else\ + FS_FAIL();\ + } while (0) + +#define EXPECT_ERROR(ERROR, function, ...) do { \ + SHOW_MESSAGE(#ERROR,function,#__VA_ARGS__);\ + if ((-1==function(__VA_ARGS__)) && (errno==ERROR)) \ + FS_PASS();\ + else \ + FS_FAIL();\ + } while (0) + + +#define BASE_FOR_TEST "/mnt" +#endif diff --git a/testsuites/fstests/support/fstest_support.c b/testsuites/fstests/support/fstest_support.c index c1dac4399e..4202a1040f 100644 --- a/testsuites/fstests/support/fstest_support.c +++ b/testsuites/fstests/support/fstest_support.c @@ -1,3 +1,14 @@ +/* + * COPYRIGHT (c) 1989-2011. + * 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 Exp $ + */ + #include <stdio.h> #include <errno.h> #include <fcntl.h> @@ -11,6 +22,8 @@ #include "fstest_support.h" #include "fs_config.h" +#include "fstest.h" + #define TEMP_DIR "waterbuffalo" @@ -18,8 +31,6 @@ void break_out_of_chroot(void) { - int x; /* Used to move up a directory tree */ - int done=0; /* Are we done yet ? */ int dir_fd; /* File descriptor to directory */ struct stat sbuf; /* The stat() buffer */ chdir("/"); @@ -87,7 +98,6 @@ rtems_task Init( break_out_of_chroot(); chdir("/"); - puts( "\n\nShutting down filesystem " FILESYSTEM ); test_shutdown_filesystem(); @@ -95,4 +105,3 @@ rtems_task Init( rtems_test_exit(0); } - diff --git a/testsuites/fstests/support/fstest_support.h b/testsuites/fstests/support/fstest_support.h index 16972710a1..2fcb208619 100644 --- a/testsuites/fstests/support/fstest_support.h +++ b/testsuites/fstests/support/fstest_support.h @@ -1,17 +1,16 @@ - /* + * COPYRIGHT (c) 1989-2011. + * 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$ + * $Id Exp $ */ #ifndef __FSTEST_SUPPORT_H #define __FSTEST_SUPPORT_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "pmacros.h" - -#include "rtems.h" #ifdef __cplusplus extern "C" { @@ -30,4 +29,5 @@ extern void test_shutdown_filesystem(void); }; #endif + #endif diff --git a/testsuites/fstests/support/ramdisk_support.c b/testsuites/fstests/support/ramdisk_support.c index 2945b3456e..dba0b32a4c 100644 --- a/testsuites/fstests/support/ramdisk_support.c +++ b/testsuites/fstests/support/ramdisk_support.c @@ -1,13 +1,19 @@ - /* + * COPYRIGHT (c) 1989-2011. + * 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$ + * $Id Exp $ */ #include <rtems/ramdisk.h> #include <rtems/blkdev.h> #include <rtems/libio.h> #include "ramdisk_support.h" +#include "fstest.h" /* * Ramdisk information */ @@ -25,6 +31,7 @@ void init_ramdisk(void) rtems_test_assert( rc == 0 ); } + void del_ramdisk(void ) { int rc=0; @@ -35,12 +42,15 @@ void del_ramdisk(void ) rtems_test_assert( rc == 0 ); rtems_filesystem_split_dev_t(dev,major,minor); - + + rtems_test_assert(major>=0); + rtems_test_assert(minor>=0); + rc=rtems_io_unregister_driver(major); rtems_test_assert( rc == 0 ); rc=rtems_disk_io_done(); rtems_test_assert( rc == 0 ); -} +} diff --git a/testsuites/fstests/support/ramdisk_support.h b/testsuites/fstests/support/ramdisk_support.h index f3e0836cce..82f732f539 100644 --- a/testsuites/fstests/support/ramdisk_support.h +++ b/testsuites/fstests/support/ramdisk_support.h @@ -1,6 +1,12 @@ /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). * - * $Id$ + * 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 Exp $ */ #ifndef __RAMDISK_SUPPORT_H #define __RAMDISK_SUPPORT_H @@ -9,8 +15,6 @@ #include "config.h" #endif -#include "fstest_support.h" - #define RAMDISK_BLOCK_SIZE (512) #define RAMDISK_BLOCK_COUNT (1024) #define RAMDISK_PATH "/dev/ramdisk" |