Changeset 858e013f in rtems
- Timestamp:
- Aug 1, 2011, 8:54:15 PM (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- a7c39d3
- Parents:
- 32eba74
- Location:
- testsuites/fstests
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuites/fstests/ChangeLog
r32eba74 r858e013f 1 2011-08-01 Xiang Cui <medivhc@gmail.com> 2 3 * Makefile.am, configure.ac, fslink/fslink.doc, fslink/test.c, 4 fssymlink/test.c, imfs_fslink/Makefile.am, 5 imfs_fssymlink/Makefile.am, imfs_support/fs_config.h, 6 imfs_support/fs_support.c, mdosfs_support/fs_config.h, 7 mdosfs_support/fs_support.c, mimfs_fslink/Makefile.am, 8 mimfs_fssymlink/Makefile.am, mimfs_support/fs_config.h, 9 mimfs_support/fs_support.c, mrfs_fslink/Makefile.am, 10 mrfs_fssymlink/Makefile.am, mrfs_support/fs_config.h, 11 mrfs_support/fs_support.c, support/fstest.h, 12 support/fstest_support.c, support/fstest_support.h, 13 support/ramdisk_support.c, support/ramdisk_support.h: Submit correct 14 tarball of current work. 15 * fs01/init.c, fsfchx/fsfchx.doc, fsfchx/init.c, fsfile01/fsfile01.doc, 16 fsfile01/test.c, fsfile01/test_cat.c, fsfile01/test_extend.c, 17 fsfile01/test_write.c, fsfile02/fsfile02.doc, fsfile02/init.c, 18 fsfstest/fs-test.c, fsfstest/fsfstest.doc, fsimfs01/fsimfs01.doc, 19 fsimfs01/init.c, fsimfs02/fsimfs02.doc, fsimfs02/init.c, 20 fsmkdir/fsmkdir.doc, fsmkdir/test.c, fsopen/fsopen.doc, 21 fsopen/test.c, fsrdwrv/fsrdwrv.doc, fsrdwrv/test.c, 22 fsreaddir/fsreaddir.doc, fsreaddir/test.c, fsrename/fsrename.doc, 23 fsrename/test.c, fsrmdir/test.c, fsrwfile/fsrwfile.doc, 24 fsrwfile/init.c, fsstat/fsstat.doc, fsstat/test.c, 25 fstruncate/fstruncate.doc, fstruncate/test.c, imfs_fs01/.cvsignore, 26 imfs_fs01/Makefile.am, imfs_fs01/imfs_fs01.scn, 27 imfs_fsfchx/.cvsignore, imfs_fsfchx/Makefile.am, 28 imfs_fsfile01/.cvsignore, imfs_fsfile01/Makefile.am, 29 imfs_fsfile02/.cvsignore, imfs_fsfile02/Makefile.am, 30 imfs_fsfstest/.cvsignore, imfs_fsfstest/Makefile.am, 31 imfs_fsimfs01/.cvsignore, imfs_fsimfs01/Makefile.am, 32 imfs_fsimfs02/.cvsignore, imfs_fsimfs02/Makefile.am, 33 imfs_fslink/.cvsignore, imfs_fsmkdir/.cvsignore, 34 imfs_fsmkdir/Makefile.am, imfs_fsopen/.cvsignore, 35 imfs_fsopen/Makefile.am, imfs_fsrdwrv/.cvsignore, 36 imfs_fsrdwrv/Makefile.am, imfs_fsreaddir/.cvsignore, 37 imfs_fsreaddir/Makefile.am, imfs_fsrename/.cvsignore, 38 imfs_fsrename/Makefile.am, imfs_fsrmdir/.cvsignore, 39 imfs_fsrmdir/Makefile.am, imfs_fsrwfile/.cvsignore, 40 imfs_fsrwfile/Makefile.am, imfs_fsstat/.cvsignore, 41 imfs_fsstat/Makefile.am, imfs_fssymlink/.cvsignore, 42 imfs_fstruncate/.cvsignore, imfs_fstruncate/Makefile.am, 43 mdosfs_fsfchx/.cvsignore, mdosfs_fsfchx/Makefile.am, 44 mdosfs_fsfile01/.cvsignore, mdosfs_fsfile01/Makefile.am, 45 mdosfs_fsfile02/.cvsignore, mdosfs_fsfile02/Makefile.am, 46 mdosfs_fsfstest/.cvsignore, mdosfs_fsfstest/Makefile.am, 47 mdosfs_fsimfs01/.cvsignore, mdosfs_fsimfs01/Makefile.am, 48 mdosfs_fsimfs02/.cvsignore, mdosfs_fsimfs02/Makefile.am, 49 mdosfs_fslink/.cvsignore, mdosfs_fslink/Makefile.am, 50 mdosfs_fsmkdir/.cvsignore, mdosfs_fsmkdir/Makefile.am, 51 mdosfs_fsopen/.cvsignore, mdosfs_fsopen/Makefile.am, 52 mdosfs_fsrdwrv/.cvsignore, mdosfs_fsrdwrv/Makefile.am, 53 mdosfs_fsreaddir/.cvsignore, mdosfs_fsreaddir/Makefile.am, 54 mdosfs_fsrename/.cvsignore, mdosfs_fsrename/Makefile.am, 55 mdosfs_fsrmdir/.cvsignore, mdosfs_fsrmdir/Makefile.am, 56 mdosfs_fsrwfile/.cvsignore, mdosfs_fsrwfile/Makefile.am, 57 mdosfs_fsstat/.cvsignore, mdosfs_fsstat/Makefile.am, 58 mdosfs_fssymlink/.cvsignore, mdosfs_fssymlink/Makefile.am, 59 mdosfs_fstruncate/.cvsignore, mdosfs_fstruncate/Makefile.am, 60 mimfs_fs01/.cvsignore, mimfs_fs01/Makefile.am, 61 mimfs_fs01/mimfs_fs01.scn, mimfs_fsfchx/.cvsignore, 62 mimfs_fsfchx/Makefile.am, mimfs_fsfile01/.cvsignore, 63 mimfs_fsfile01/Makefile.am, mimfs_fsfile02/.cvsignore, 64 mimfs_fsfile02/Makefile.am, mimfs_fsfstest/.cvsignore, 65 mimfs_fsfstest/Makefile.am, mimfs_fsimfs01/.cvsignore, 66 mimfs_fsimfs01/Makefile.am, mimfs_fsimfs02/.cvsignore, 67 mimfs_fsimfs02/Makefile.am, mimfs_fslink/.cvsignore, 68 mimfs_fsmkdir/.cvsignore, mimfs_fsmkdir/Makefile.am, 69 mimfs_fsopen/.cvsignore, mimfs_fsopen/Makefile.am, 70 mimfs_fsrdwrv/.cvsignore, mimfs_fsrdwrv/Makefile.am, 71 mimfs_fsreaddir/.cvsignore, mimfs_fsreaddir/Makefile.am, 72 mimfs_fsrename/.cvsignore, mimfs_fsrename/Makefile.am, 73 mimfs_fsrmdir/.cvsignore, mimfs_fsrmdir/Makefile.am, 74 mimfs_fsrwfile/.cvsignore, mimfs_fsrwfile/Makefile.am, 75 mimfs_fsstat/.cvsignore, mimfs_fsstat/Makefile.am, 76 mimfs_fssymlink/.cvsignore, mimfs_fstruncate/.cvsignore, 77 mimfs_fstruncate/Makefile.am, mrfs_fsfchx/.cvsignore, 78 mrfs_fsfchx/Makefile.am, mrfs_fsfile01/.cvsignore, 79 mrfs_fsfile01/Makefile.am, mrfs_fsfile02/.cvsignore, 80 mrfs_fsfile02/Makefile.am, mrfs_fsfstest/.cvsignore, 81 mrfs_fsfstest/Makefile.am, mrfs_fsimfs01/.cvsignore, 82 mrfs_fsimfs01/Makefile.am, mrfs_fsimfs02/.cvsignore, 83 mrfs_fsimfs02/Makefile.am, mrfs_fslink/.cvsignore, 84 mrfs_fsmkdir/.cvsignore, mrfs_fsmkdir/Makefile.am, 85 mrfs_fsopen/.cvsignore, mrfs_fsopen/Makefile.am, 86 mrfs_fsrdwrv/.cvsignore, mrfs_fsrdwrv/Makefile.am, 87 mrfs_fsreaddir/.cvsignore, mrfs_fsreaddir/Makefile.am, 88 mrfs_fsrename/.cvsignore, mrfs_fsrename/Makefile.am, 89 mrfs_fsrmdir/.cvsignore, mrfs_fsrmdir/Makefile.am, 90 mrfs_fsrwfile/.cvsignore, mrfs_fsrwfile/Makefile.am, 91 mrfs_fsstat/.cvsignore, mrfs_fsstat/Makefile.am, 92 mrfs_fssymlink/.cvsignore, mrfs_fstruncate/.cvsignore, 93 mrfs_fstruncate/Makefile.am: Removed. 94 1 95 2011-08-01 Xiang Cui <medivhc@gmail.com> 2 96 -
testsuites/fstests/Makefile.am
r32eba74 r858e013f 5 5 ACLOCAL_AMFLAGS = -I ../aclocal 6 6 7 SUBDIRS = imfs_fserror imfs_fslink imfs_fspatheval imfs_fspermission\ 8 imfs_fsrdwr imfs_fssymlink imfs_fstime mdosfs_fserror\ 9 mdosfs_fspatheval mdosfs_fsrdwr mdosfs_fstime mimfs_fserror\ 10 mimfs_fslink mimfs_fspatheval mimfs_fspermission\ 11 mimfs_fsrdwr mimfs_fssymlink mimfs_fstime mrfs_fserror\ 12 mrfs_fslink mrfs_fspatheval mrfs_fspermission mrfs_fsrdwr\ 13 mrfs_fssymlink mrfs_fstime 7 14 DIST_SUBDIRS = $(SUBDIRS) support 8 EXTRA_DIST = support/ramdisk_support.c 9 EXTRA_DIST += support/ramdisk_support.h 10 EXTRA_DIST += support/fstest_support.c 11 EXTRA_DIST += support/fstest_support.h 12 13 SUBDIRS = imfs_fsfchx 14 SUBDIRS += imfs_fsfile01 15 SUBDIRS += imfs_fsfile02 16 SUBDIRS += imfs_fsfstest 17 SUBDIRS += imfs_fsimfs01 18 SUBDIRS += imfs_fsimfs02 19 SUBDIRS += imfs_fslink 20 SUBDIRS += imfs_fsmkdir 21 SUBDIRS += imfs_fsopen 22 SUBDIRS += imfs_fsrdwrv 23 SUBDIRS += imfs_fsreaddir 24 SUBDIRS += imfs_fsrename 25 SUBDIRS += imfs_fsrmdir 26 SUBDIRS += imfs_fsrwfile 27 SUBDIRS += imfs_fsstat 28 SUBDIRS += imfs_fssymlink 29 SUBDIRS += imfs_fstruncate 30 SUBDIRS += mdosfs_fsfchx 31 SUBDIRS += mdosfs_fsfile01 32 SUBDIRS += mdosfs_fsfile02 33 SUBDIRS += mdosfs_fsfstest 34 SUBDIRS += mdosfs_fsimfs01 35 SUBDIRS += mdosfs_fsimfs02 36 SUBDIRS += mdosfs_fslink 37 SUBDIRS += mdosfs_fsmkdir 38 SUBDIRS += mdosfs_fsopen 39 SUBDIRS += mdosfs_fsrdwrv 40 SUBDIRS += mdosfs_fsreaddir 41 SUBDIRS += mdosfs_fsrename 42 SUBDIRS += mdosfs_fsrmdir 43 SUBDIRS += mdosfs_fsrwfile 44 SUBDIRS += mdosfs_fsstat 45 SUBDIRS += mdosfs_fssymlink 46 SUBDIRS += mdosfs_fstruncate 47 SUBDIRS += mimfs_fsfchx 48 SUBDIRS += mimfs_fsfile01 49 SUBDIRS += mimfs_fsfile02 50 SUBDIRS += mimfs_fsfstest 51 SUBDIRS += mimfs_fsimfs01 52 SUBDIRS += mimfs_fsimfs02 53 SUBDIRS += mimfs_fslink 54 SUBDIRS += mimfs_fsmkdir 55 SUBDIRS += mimfs_fsopen 56 SUBDIRS += mimfs_fsrdwrv 57 SUBDIRS += mimfs_fsreaddir 58 SUBDIRS += mimfs_fsrename 59 SUBDIRS += mimfs_fsrmdir 60 SUBDIRS += mimfs_fsrwfile 61 SUBDIRS += mimfs_fsstat 62 SUBDIRS += mimfs_fssymlink 63 SUBDIRS += mimfs_fstruncate 64 SUBDIRS += mrfs_fsfchx 65 SUBDIRS += mrfs_fsfile01 66 SUBDIRS += mrfs_fsfile02 67 SUBDIRS += mrfs_fsfstest 68 SUBDIRS += mrfs_fsimfs01 69 SUBDIRS += mrfs_fsimfs02 70 SUBDIRS += mrfs_fslink 71 SUBDIRS += mrfs_fsmkdir 72 SUBDIRS += mrfs_fsopen 73 SUBDIRS += mrfs_fsrdwrv 74 SUBDIRS += mrfs_fsreaddir 75 SUBDIRS += mrfs_fsrename 76 SUBDIRS += mrfs_fsrmdir 77 SUBDIRS += mrfs_fsrwfile 78 SUBDIRS += mrfs_fsstat 79 SUBDIRS += mrfs_fssymlink 80 SUBDIRS += mrfs_fstruncate 15 EXTRA_DIST = support/ramdisk_support.c support/ramdisk_support.h support/fstest_support.c support/fstest_support.h 81 16 82 17 include $(top_srcdir)/../automake/subdirs.am -
testsuites/fstests/configure.ac
r32eba74 r858e013f 4 4 5 5 AC_PREREQ([2.68]) 6 AC_INIT([rtems-c-src-tests-fstests],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) 6 AC_INIT([rtems-c-src-tests-fstests], 7 [_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) 7 8 AC_CONFIG_SRCDIR([imfs_support]) 8 9 RTEMS_TOP([../..],[..]) … … 79 80 # Explicitly list all Makefiles here 80 81 AC_CONFIG_FILES([Makefile 81 imfs_fsfchx/Makefile 82 imfs_fsfile01/Makefile 83 imfs_fsfile02/Makefile 84 imfs_fsfstest/Makefile 85 imfs_fsimfs01/Makefile 86 imfs_fsimfs02/Makefile 82 imfs_fserror/Makefile 87 83 imfs_fslink/Makefile 88 imfs_fsmkdir/Makefile 89 imfs_fsopen/Makefile 90 imfs_fsrdwrv/Makefile 91 imfs_fsreaddir/Makefile 92 imfs_fsrename/Makefile 93 imfs_fsrmdir/Makefile 94 imfs_fsrwfile/Makefile 95 imfs_fsstat/Makefile 84 imfs_fspatheval/Makefile 85 imfs_fspermission/Makefile 86 imfs_fsrdwr/Makefile 96 87 imfs_fssymlink/Makefile 97 imfs_fstruncate/Makefile 98 mdosfs_fsfchx/Makefile 99 mdosfs_fsfile01/Makefile 100 mdosfs_fsfile02/Makefile 101 mdosfs_fsfstest/Makefile 102 mdosfs_fsimfs01/Makefile 103 mdosfs_fsimfs02/Makefile 104 mdosfs_fslink/Makefile 105 mdosfs_fsmkdir/Makefile 106 mdosfs_fsopen/Makefile 107 mdosfs_fsrdwrv/Makefile 108 mdosfs_fsreaddir/Makefile 109 mdosfs_fsrename/Makefile 110 mdosfs_fsrmdir/Makefile 111 mdosfs_fsrwfile/Makefile 112 mdosfs_fsstat/Makefile 113 mdosfs_fssymlink/Makefile 114 mdosfs_fstruncate/Makefile 115 mimfs_fsfchx/Makefile 116 mimfs_fsfile01/Makefile 117 mimfs_fsfile02/Makefile 118 mimfs_fsfstest/Makefile 119 mimfs_fsimfs01/Makefile 120 mimfs_fsimfs02/Makefile 88 imfs_fstime/Makefile 89 mdosfs_fserror/Makefile 90 mdosfs_fspatheval/Makefile 91 mdosfs_fsrdwr/Makefile 92 mdosfs_fstime/Makefile 93 mimfs_fserror/Makefile 121 94 mimfs_fslink/Makefile 122 mimfs_fsmkdir/Makefile 123 mimfs_fsopen/Makefile 124 mimfs_fsrdwrv/Makefile 125 mimfs_fsreaddir/Makefile 126 mimfs_fsrename/Makefile 127 mimfs_fsrmdir/Makefile 128 mimfs_fsrwfile/Makefile 129 mimfs_fsstat/Makefile 95 mimfs_fspatheval/Makefile 96 mimfs_fspermission/Makefile 97 mimfs_fsrdwr/Makefile 130 98 mimfs_fssymlink/Makefile 131 mimfs_fstruncate/Makefile 132 mrfs_fsfchx/Makefile 133 mrfs_fsfile01/Makefile 134 mrfs_fsfile02/Makefile 135 mrfs_fsfstest/Makefile 136 mrfs_fsimfs01/Makefile 137 mrfs_fsimfs02/Makefile 99 mimfs_fstime/Makefile 100 mrfs_fserror/Makefile 138 101 mrfs_fslink/Makefile 139 mrfs_fsmkdir/Makefile 140 mrfs_fsopen/Makefile 141 mrfs_fsrdwrv/Makefile 142 mrfs_fsreaddir/Makefile 143 mrfs_fsrename/Makefile 144 mrfs_fsrmdir/Makefile 145 mrfs_fsrwfile/Makefile 146 mrfs_fsstat/Makefile 102 mrfs_fspatheval/Makefile 103 mrfs_fspermission/Makefile 104 mrfs_fsrdwr/Makefile 147 105 mrfs_fssymlink/Makefile 148 mrfs_fst runcate/Makefile106 mrfs_fstime/Makefile 149 107 150 108 ]) -
testsuites/fstests/fslink/test.c
r32eba74 r858e013f 1 2 1 /* 3 2 * COPYRIGHT (c) 1989-2011. … … 24 23 #include "fstest.h" 25 24 26 mode_t mode = 0644;27 25 /* 28 26 * Test if the successful call works as expect 29 27 */ 30 void link_test01 (void)28 void link_test01 (void) 31 29 { 32 char *name0 ="t0";33 char *name1 ="t1";34 char *name2 ="t2";35 char *name3="t3"; 30 char *name0 = "t0"; 31 char *name1 = "t1"; 32 char *name2 = "t2"; 33 36 34 37 35 int status; 38 36 int fd; 39 37 38 mode_t mode = 0644; 40 39 struct stat statbuf; 41 mode_t tmp_mode;42 43 time_t ctime1,dctime1,dmtime1;44 time_t ctime2,dctime2,dmtime2;45 46 puts("link creates hardlinks");47 48 status=mkdir(name3,0755);49 rtems_test_assert(status==0);50 51 status=chdir(name3);52 rtems_test_assert(status==0);53 fd=creat(name0,mode);54 status=close(fd);55 rtems_test_assert(status==0);56 57 status=stat(name0,&statbuf);58 rtems_test_assert(status==0);59 rtems_test_assert(S_ISREG(statbuf.st_mode));60 tmp_mode=(statbuf.st_mode)&ALLPERMS;61 rtems_test_assert(tmp_mode==0644);62 rtems_test_assert(statbuf.st_nlink==1);63 64 printf("the arg is %04o and the is %04o \n",tmp_mode,mode);65 puts("test if the stat is the same");66 status=link(name0,name1);67 rtems_test_assert(status==0);68 69 status=stat(name0,&statbuf);70 rtems_test_assert(status==0);71 72 rtems_test_assert(S_ISREG(statbuf.st_mode));73 tmp_mode=(statbuf.st_mode)&ALLPERMS;74 rtems_test_assert(tmp_mode==0644);75 rtems_test_assert(statbuf.st_nlink==2);76 77 status=stat(name1,&statbuf);78 rtems_test_assert(status==0);79 80 rtems_test_assert(S_ISREG(statbuf.st_mode));81 tmp_mode=(statbuf.st_mode)&ALLPERMS;82 rtems_test_assert(tmp_mode==0644);83 rtems_test_assert(statbuf.st_nlink==2);84 85 status=link(name1,name2);86 87 status=stat(name0,&statbuf);88 rtems_test_assert(status==0);89 90 rtems_test_assert(S_ISREG(statbuf.st_mode));91 tmp_mode=(statbuf.st_mode)&ALLPERMS;92 rtems_test_assert(tmp_mode==0644);93 rtems_test_assert(statbuf.st_nlink==3);94 95 status=stat(name1,&statbuf);96 rtems_test_assert(status==0);97 98 rtems_test_assert(S_ISREG(statbuf.st_mode));99 tmp_mode=(statbuf.st_mode)&ALLPERMS;100 rtems_test_assert(tmp_mode==0644);101 rtems_test_assert(statbuf.st_nlink==3);102 40 103 41 104 status=stat(name2,&statbuf); 105 rtems_test_assert(status==0); 42 puts ("link creates hardlinks"); 43 fd = creat (name0, mode); 44 status = close (fd); 45 rtems_test_assert (status == 0); 106 46 107 rtems_test_assert(S_ISREG(statbuf.st_mode)); 108 rtems_test_assert(statbuf.st_nlink==3); 109 tmp_mode=(statbuf.st_mode)&ALLPERMS; 110 rtems_test_assert(tmp_mode==0644); 111 /* 112 * call chmod and chown and test. 113 */ 47 status = stat (name0, &statbuf); 48 rtems_test_assert (status == 0); 49 rtems_test_assert (statbuf.st_nlink == 1); 114 50 115 puts("chmod and chown"); 51 puts ("test if the stat is the same"); 52 status = link (name0, name1); 53 rtems_test_assert (status == 0); 116 54 117 chmod(name1,0201);118 chown(name1,65534,65533);55 status = stat (name0, &statbuf); 56 rtems_test_assert (status == 0); 119 57 58 rtems_test_assert (S_ISREG (statbuf.st_mode)); 59 rtems_test_assert (statbuf.st_nlink == 2); 120 60 121 status =stat(name0,&statbuf);122 rtems_test_assert (status==0);61 status = stat (name1, &statbuf); 62 rtems_test_assert (status == 0); 123 63 124 rtems_test_assert(S_ISREG(statbuf.st_mode)); 125 rtems_test_assert(statbuf.st_nlink==3); 126 tmp_mode=(statbuf.st_mode)&ALLPERMS; 127 rtems_test_assert(tmp_mode==0201); 128 rtems_test_assert(statbuf.st_uid=65534); 129 rtems_test_assert(statbuf.st_gid=65533); 130 131 status=stat(name1,&statbuf); 132 rtems_test_assert(status==0); 133 134 rtems_test_assert(S_ISREG(statbuf.st_mode)); 135 tmp_mode=(statbuf.st_mode)&ALLPERMS; 136 rtems_test_assert(tmp_mode==0201); 137 rtems_test_assert(statbuf.st_nlink==3); 138 rtems_test_assert(statbuf.st_uid=65534); 139 rtems_test_assert(statbuf.st_gid=65533); 140 141 status=stat(name2,&statbuf); 142 rtems_test_assert(status==0); 143 144 rtems_test_assert(S_ISREG(statbuf.st_mode)); 145 tmp_mode=(statbuf.st_mode)&ALLPERMS; 146 rtems_test_assert(tmp_mode==0201); 147 rtems_test_assert(statbuf.st_nlink==3); 148 rtems_test_assert(statbuf.st_nlink==3); 149 rtems_test_assert(statbuf.st_uid=65534); 150 rtems_test_assert(statbuf.st_gid=65533); 151 /* 152 * 153 * unlink then test if the nlink changes 154 */ 155 156 puts("unlink then stat the file "); 157 158 status=unlink(name0); 159 rtems_test_assert(status==0); 160 161 status=stat(name0,&statbuf); 162 rtems_test_assert(status==-1); 163 rtems_test_assert(errno=ENOENT); 164 165 166 status=stat(name1,&statbuf); 167 rtems_test_assert(status==0); 168 169 rtems_test_assert(S_ISREG(statbuf.st_mode)); 170 tmp_mode=(statbuf.st_mode)&ALLPERMS; 171 rtems_test_assert(tmp_mode==0201); 172 rtems_test_assert(statbuf.st_nlink==2); 173 174 175 status=stat(name2,&statbuf); 176 rtems_test_assert(status==0); 177 178 rtems_test_assert(S_ISREG(statbuf.st_mode)); 179 tmp_mode=(statbuf.st_mode)&ALLPERMS; 180 rtems_test_assert(tmp_mode==0201); 181 rtems_test_assert(statbuf.st_nlink==2); 182 183 184 status=unlink(name1); 185 rtems_test_assert(status==0); 186 187 status=unlink(name2); 188 rtems_test_assert(status==0); 189 64 rtems_test_assert (S_ISREG (statbuf.st_mode)); 65 rtems_test_assert (statbuf.st_nlink == 2); 190 66 191 67 /* 192 * successful link() updates ctime 193 * and the ctime and mtime of the 194 * directory. 68 * link the file and check the nlink 195 69 */ 196 fd=creat(name0,0644); 197 status=close(fd); 198 rtems_test_assert(status==0); 70 status = link (name1, name2); 71 rtems_test_assert (status == 0); 199 72 200 status=stat(name0,&statbuf); 201 ctime1=statbuf.st_ctime; 202 status=stat(".",&statbuf); 203 rtems_test_assert(status==0); 204 dctime1=statbuf.st_ctime; 205 dmtime1=statbuf.st_mtime; 73 status = stat (name0, &statbuf); 74 rtems_test_assert (status == 0); 206 75 207 puts("sleep a few seconds");208 sleep(TIME_PRECISION);76 rtems_test_assert (S_ISREG (statbuf.st_mode)); 77 rtems_test_assert (statbuf.st_nlink == 3); 209 78 210 status=link(name0,name1); 211 rtems_test_assert(status==0); 212 status=stat(name0,&statbuf); 213 ctime2=statbuf.st_ctime; 214 status=stat(".",&statbuf); 215 dctime2=statbuf.st_ctime; 216 dmtime2=statbuf.st_mtime; 79 status = stat (name1, &statbuf); 80 rtems_test_assert (status == 0); 217 81 218 puts("test if the time changes"); 219 rtems_test_assert(!time_equal(ctime1,ctime2)); 220 #if !defined(IMFS_TEST) && !defined(MIMFS_TEST) 221 rtems_test_assert(!time_equal(dctime1,dctime2)); 222 #endif 223 #if !defined(IMFS_TEST) && !defined(MIMFS_TEST) 224 rtems_test_assert(!time_equal(dmtime1,dmtime2)); 225 #endif 82 rtems_test_assert (S_ISREG (statbuf.st_mode)); 83 rtems_test_assert (statbuf.st_nlink == 3); 84 85 status = stat (name2, &statbuf); 86 rtems_test_assert (status == 0); 87 88 rtems_test_assert (S_ISREG (statbuf.st_mode)); 89 rtems_test_assert (statbuf.st_nlink == 3); 90 91 /* 92 * call chmod and chown and test. 93 */ 94 puts ("chmod and chown"); 95 96 chown (name1, 65534, 65533); 97 98 status = stat (name0, &statbuf); 99 rtems_test_assert (status == 0); 100 101 rtems_test_assert (S_ISREG (statbuf.st_mode)); 102 rtems_test_assert (statbuf.st_nlink == 3); 103 rtems_test_assert (statbuf.st_uid = 65534); 104 rtems_test_assert (statbuf.st_gid = 65533); 105 106 status = stat (name1, &statbuf); 107 rtems_test_assert (status == 0); 108 109 rtems_test_assert (S_ISREG (statbuf.st_mode)); 110 rtems_test_assert (statbuf.st_nlink == 3); 111 rtems_test_assert (statbuf.st_uid = 65534); 112 rtems_test_assert (statbuf.st_gid = 65533); 113 114 status = stat (name2, &statbuf); 115 rtems_test_assert (status == 0); 116 117 rtems_test_assert (S_ISREG (statbuf.st_mode)); 118 rtems_test_assert (statbuf.st_nlink == 3); 119 rtems_test_assert (statbuf.st_uid = 65534); 120 rtems_test_assert (statbuf.st_gid = 65533); 121 122 /* 123 * 124 * unlink then test if the nlink changes 125 */ 126 puts ("unlink then stat the file "); 127 128 status = unlink (name0); 129 rtems_test_assert (status == 0); 130 131 status = stat (name0, &statbuf); 132 rtems_test_assert (status == -1); 133 rtems_test_assert (errno = ENOENT); 134 135 status = stat (name1, &statbuf); 136 rtems_test_assert (status == 0); 137 rtems_test_assert (S_ISREG (statbuf.st_mode)); 138 rtems_test_assert (statbuf.st_nlink == 2); 139 140 status = stat (name2, &statbuf); 141 rtems_test_assert (status == 0); 142 rtems_test_assert (S_ISREG (statbuf.st_mode)); 143 rtems_test_assert (statbuf.st_nlink == 2); 144 145 status = unlink (name1); 146 rtems_test_assert (status == 0); 147 148 status = unlink (name2); 149 rtems_test_assert (status == 0); 226 150 227 151 } 228 void test(void) 152 153 void test (void) 229 154 { 230 puts( "\n\n*** LINK TEST ***" ); 231 #if defined(MDOSFS_TEST) 232 #else 233 link_test01(); 234 #endif 235 puts( "*** END OF LINK TEST ***" ); 155 puts ("\n\n*** LINK TEST ***"); 156 link_test01 (); 157 puts ("*** END OF LINK TEST ***"); 236 158 } 237 -
testsuites/fstests/fssymlink/test.c
r32eba74 r858e013f 1 2 /* 3 * COPYRIGHT (c) 1989-2011. 4 * On-Line Applications Research Corporation (OAR). 5 * 6 * The license and distribution terms for this file may be 7 * found in the file LICENSE in this distribution or at 8 * http://www.rtems.com/license/LICENSE. 9 * 10 * $Id Exp $ 11 */ 1 12 2 13 #include <sys/stat.h> 3 #include <limits.h>4 14 #include <fcntl.h> 5 15 #include <errno.h> … … 17 27 * Test the function of symlink 18 28 */ 19 void symlink_test01() 29 30 void symlink_test01(void ) 20 31 { 21 32 int fd; 22 char* name0="file"; 23 char* name1="symlink"; 33 char* file01="file"; 34 char* symlink_file01="symlink"; 35 char name[20]; 24 36 int status; 25 37 struct stat statbuf; 26 int len=strlen(name0); 38 size_t len=strlen(file01); 39 size_t name_len; 40 27 41 28 printf("Create a file named %s\n", name0);29 fd=creat( name0,0777);42 printf("Create a file named %s\n",file01); 43 fd=creat(file01,0777); 30 44 status=close(fd); 31 45 rtems_test_assert(status==0); 32 46 33 printf("Create a symlink named %s to %s\n", name1,name0);34 status=symlink( name0,name1);47 printf("Create a symlink named %s to %s\n",symlink_file01,file01); 48 status=symlink(file01,symlink_file01); 35 49 rtems_test_assert(status==0); 36 50 37 status=stat( name0,&statbuf);51 status=stat(file01,&statbuf); 38 52 rtems_test_assert(status==0); 39 53 rtems_test_assert(S_ISREG(statbuf.st_mode)); 40 54 rtems_test_assert(0==statbuf.st_size); 41 42 55 43 status=lstat( name1,&statbuf);56 status=lstat(symlink_file01,&statbuf); 44 57 rtems_test_assert(status==0); 45 58 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 46 #if !defined(IMFS_TEST) && !defined(MIMFS_TEST)47 59 rtems_test_assert(len==statbuf.st_size); 48 #endif49 60 61 62 puts("call readlink "); 63 name_len=readlink(symlink_file01,name,sizeof(name)-1); 64 rtems_test_assert(name_len!=-1); 65 name[name_len]='\0'; 66 rtems_test_assert(!strncmp(name,file01,name_len)); 67 puts(name); 50 68 51 69 puts("Unlink the file"); 52 70 53 status=unlink( name0);71 status=unlink(file01); 54 72 rtems_test_assert(status==0); 55 73 74 status=lstat(symlink_file01,&statbuf); 75 rtems_test_assert(status==0); 76 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 77 rtems_test_assert(len==statbuf.st_size); 78 79 puts("call readlink "); 80 name_len=readlink(symlink_file01,name,sizeof(name)-1); 81 rtems_test_assert(name_len!=-1); 82 name[name_len]='\0'; 83 rtems_test_assert(!strncmp(name,file01,name_len)); 84 status=unlink(symlink_file01); 85 rtems_test_assert(status==0); 56 86 57 status=lstat(name1,&statbuf); 87 printf("Create a dir named %s\n",file01); 88 status=mkdir (file01,0777); 89 90 printf("Create a symlink named %s to %s\n",symlink_file01,file01); 91 status=symlink(file01,symlink_file01); 92 rtems_test_assert(status==0); 93 94 status=lstat(symlink_file01,&statbuf); 95 rtems_test_assert(status==0); 96 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 97 rtems_test_assert(len==statbuf.st_size); 98 99 100 puts("call readlink "); 101 name_len=readlink(symlink_file01,name,sizeof(name)-1); 102 rtems_test_assert(name_len!=-1); 103 name[name_len]='\0'; 104 rtems_test_assert(!strncmp(name,file01,name_len)); 105 106 name_len=readlink(symlink_file01,name,3); 107 rtems_test_assert(name_len!=-1); 108 name[name_len]='\0'; 109 rtems_test_assert(!strncmp(name,file01,name_len)); 110 111 puts("rmdir the dir"); 112 status=rmdir(file01); 113 rtems_test_assert(status==0); 114 115 status=lstat(symlink_file01,&statbuf); 58 116 rtems_test_assert(status==0); 59 117 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 60 118 61 status=unlink(name1); 62 rtems_test_assert(status==0); 63 64 printf("Create a dir named %s\n",name0); 65 status=mkdir (name0,0777); 66 67 printf("Create a symlink named %s to %s\n",name1,name0); 68 status=symlink(name0,name1); 69 rtems_test_assert(status==0); 70 71 72 73 status=lstat(name1,&statbuf); 74 rtems_test_assert(status==0); 75 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 76 #if !defined(IMFS_TEST) && !defined(MIMFS_TEST) 77 rtems_test_assert(len==statbuf.st_size); 78 #endif 79 80 puts("rmdir the dir"); 81 status=rmdir(name0); 82 rtems_test_assert(status==0); 83 84 85 status=lstat(name1,&statbuf); 86 rtems_test_assert(status==0); 87 rtems_test_assert(S_ISLNK(statbuf.st_mode)); 88 89 status=unlink(name1); 119 status=unlink(symlink_file01); 90 120 rtems_test_assert(status==0); 91 121 92 122 } 93 123 /* 94 * symlink loop test124 * symlink loop error test 95 125 */ 96 void symlink_ test02()126 void symlink_loop_error_test(void ) 97 127 { 128 char* file01="file01"; 129 char* file02="file02"; 98 130 99 char* name0="symlink0"; 100 char* name1="symlink1"; 131 char* file04="file04"; 132 char* path="file01/t"; 133 101 134 int status; 102 135 136 mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; 103 137 104 puts("symlink loop test"); 105 status=symlink(name0,name1); 138 puts("symlink loop erro test"); 139 140 status=symlink(file01,file02); 106 141 rtems_test_assert(status==0); 107 status=symlink( name1,name0);142 status=symlink(file02,file01); 108 143 rtems_test_assert(status==0); 144 109 145 110 111 puts("create a file Should fail with ELOOP"); 112 status=creat(name0,0777); 113 rtems_test_assert(status!=0); 114 #if !defined(MRFS_TEST) 115 rtems_test_assert(errno==ELOOP); 116 #endif 117 puts("truncate a file Should with ELOOP"); 118 status=truncate(name0,0777); 119 rtems_test_assert(status!=0); 120 #if !defined(MRFS_TEST) 121 rtems_test_assert(errno==ELOOP); 122 #endif 146 EXPECT_ERROR(ELOOP,creat,path,mode); 147 EXPECT_ERROR(ELOOP,open,path,O_CREAT|O_WRONLY,mode); 148 EXPECT_ERROR(ELOOP,truncate,path,0); 149 EXPECT_ERROR(ELOOP,rename,path,file04); 150 EXPECT_ERROR(ELOOP,unlink,path); 151 EXPECT_ERROR(ELOOP,mkdir,path,mode); 152 EXPECT_ERROR(ELOOP,rmdir,path); 123 153 } 124 154 125 void test( )155 void test(void ) 126 156 { 127 157 128 158 puts( "\n\n*** SYMLINK TEST ***" ); 129 #if defined(MDOSFS_TEST)130 #else131 159 symlink_test01(); 132 symlink_test02(); 133 #endif 134 160 symlink_loop_error_test(); 135 161 puts( "*** END OF SYMLINK TEST ***" ); 136 162 -
testsuites/fstests/imfs_support/fs_config.h
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 11 #ifndef __IMFS_SUPPORT_h … … 8 15 9 16 #define FILESYSTEM "IMFS" 10 #define BASE_FOR_TEST "/mnt/"11 12 #ifdef __cplusplus13 extern "C" {14 #endif15 16 extern void test_initialize_filesystem(void);17 18 extern void test_shutdown_filesystem(void);19 20 #ifdef __cplusplus21 };22 #endif23 17 24 18 #endif -
testsuites/fstests/imfs_support/fs_support.c
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 5 11 #ifdef HAVE_CONFIG_H 6 12 #include "config.h" … … 8 14 #include "pmacros.h" 9 15 10 #include "fs_config.h"16 #include <sys/stat.h> 11 17 12 void test_initialize_filesystem(void) 18 #include "fstest.h" 19 20 void 21 test_initialize_filesystem (void) 13 22 { 14 int rc =0;15 rc =mkdir(BASE_FOR_TEST,0777);16 rtems_test_assert (rc==0);23 int rc = 0; 24 rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); 25 rtems_test_assert (rc == 0); 17 26 } 18 27 19 void test_shutdown_filesystem(void) 28 void 29 test_shutdown_filesystem (void) 20 30 { 21 31 } 32 22 33 /* configuration information */ 23 34 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER … … 26 37 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 27 38 28 #define CONFIGURE_MAXIMUM_TASKS 139 #define CONFIGURE_MAXIMUM_TASKS 10 29 40 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 30 41 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 31 42 32 43 #define CONFIGURE_INIT 33 34 44 #include <rtems/confdefs.h> -
testsuites/fstests/mdosfs_support/fs_config.h
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 11 … … 10 17 #define FILESYSTEM "MOUNTED DOSFS" 11 18 #define BASE_FOR_TEST "/mnt/" 12 #ifdef __cplusplus13 extern "C" {14 #endif15 16 #ifdef __cplusplus17 };18 #endif19 19 20 20 #endif -
testsuites/fstests/mdosfs_support/fs_support.c
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 5 11 #ifdef HAVE_CONFIG_H 6 12 #include "config.h" … … 35 41 { 36 42 int rc=0; 37 rc =mkdir(BASE_FOR_TEST,0777);43 rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); 38 44 rtems_test_assert(rc==0); 39 45 … … 70 76 */ 71 77 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 72 #define CONFIGURE_MEMORY_OVERHEAD 51273 #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10)74 #define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10)75 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6)76 #define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4)77 #define CONFIGURE_MAXIMUM_TIMERS 1078 78 79 #define CONFIGURE_MAXIMUM_TASKS 10 80 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 81 #define CONFIGURE_MAXIMUM_DRIVERS 10 82 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 79 83 80 /**81 * Configure file system and libblock.82 */83 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM84 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 10085 #define CONFIGURE_MAXIMUM_DRIVERS 10086 84 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK 87 85 -
testsuites/fstests/mimfs_fslink/Makefile.am
r32eba74 r858e013f 6 6 7 7 rtems_tests_PROGRAMS = mimfs_fslink 8 mimfs_fslink_SOURCES = ../fslink/test.c ../support/ ramdisk_support.c\9 ../support/fstest_support. c ../support/fstest_support.h\10 ../support/ramdisk_support.h ../support/fstest.h../../psxtests/include/pmacros.h \8 mimfs_fslink_SOURCES = ../fslink/test.c ../support/fstest_support.c\ 9 ../support/fstest_support.h ../support/fstest.h \ 10 ../../psxtests/include/pmacros.h \ 11 11 ../mimfs_support/fs_support.c ../mimfs_support/fs_config.h 12 12 -
testsuites/fstests/mimfs_fssymlink/Makefile.am
r32eba74 r858e013f 6 6 7 7 rtems_tests_PROGRAMS = mimfs_fssymlink 8 mimfs_fssymlink_SOURCES = ../fssymlink/test.c ../support/ramdisk_support.c\ 9 ../support/fstest_support.c ../support/fstest_support.h\ 10 ../support/ramdisk_support.h ../support/fstest.h ../../psxtests/include/pmacros.h \ 8 mimfs_fssymlink_SOURCES = ../fssymlink/test.c ../support/fstest_support.c\ 9 ../support/fstest_support.h ../support/fstest.h ../../psxtests/include/pmacros.h \ 11 10 ../mimfs_support/fs_support.c ../mimfs_support/fs_config.h 12 11 -
testsuites/fstests/mimfs_support/fs_config.h
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 11 … … 9 16 10 17 #define FILESYSTEM "MOUNTED IMFS" 11 #define BASE_FOR_TEST "/mnt/"12 #ifdef __cplusplus13 extern "C" {14 #endif15 16 #ifdef __cplusplus17 };18 #endif19 18 20 19 #endif -
testsuites/fstests/mimfs_support/fs_support.c
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 11 … … 8 15 #include "pmacros.h" 9 16 10 #include "fs_config.h"11 12 17 #include <sys/stat.h> 13 #include <sys/types.h>14 15 18 #include <rtems/libio.h> 16 19 20 #include "fstest.h" 17 21 22 void 23 test_initialize_filesystem (void) 24 { 25 int rc = 0; 26 rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); 27 rtems_test_assert (rc == 0); 18 28 19 void test_initialize_filesystem(void) 20 { 21 int rc=0; 22 rc=mkdir(BASE_FOR_TEST,0777); 23 rtems_test_assert(rc==0); 24 25 26 rc=mount(NULL, 27 BASE_FOR_TEST, 28 "imfs", 29 RTEMS_FILESYSTEM_READ_WRITE, 30 NULL); 31 rtems_test_assert(rc==0); 29 rc = mount (NULL, BASE_FOR_TEST, "imfs", RTEMS_FILESYSTEM_READ_WRITE, NULL); 30 rtems_test_assert (rc == 0); 32 31 } 33 32 34 33 35 void test_shutdown_filesystem(void) 34 void 35 test_shutdown_filesystem (void) 36 36 { 37 int rc =0;38 rc =unmount(BASE_FOR_TEST);39 rtems_test_assert (rc==0);37 int rc = 0; 38 rc = unmount (BASE_FOR_TEST); 39 rtems_test_assert (rc == 0); 40 40 } 41 41 … … 50 50 */ 51 51 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 52 #define CONFIGURE_MEMORY_OVERHEAD 51253 #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10)54 #define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10)55 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6)56 #define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4)57 #define CONFIGURE_MAXIMUM_TIMERS 1058 52 59 53 60 /** 61 * Configure file system and libblock. 62 */ 54 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 55 56 #define CONFIGURE_MAXIMUM_TASKS 10 63 57 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 64 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 65 #define CONFIGURE_MAXIMUM_DRIVERS 100 66 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK 67 58 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 68 59 69 60 #define CONFIGURE_INIT 70 61 #include <rtems/confdefs.h> 71 -
testsuites/fstests/mrfs_support/fs_config.h
r32eba74 r858e013f 9 9 10 10 #define FILESYSTEM "MOUNTED RFS" 11 #define BASE_FOR_TEST "/mnt/"12 #ifdef __cplusplus13 extern "C" {14 #endif15 16 17 #ifdef __cplusplus18 };19 #endif20 11 21 12 #endif -
testsuites/fstests/mrfs_support/fs_support.c
r32eba74 r858e013f 1 1 /* 2 * $Id$ 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 3 10 */ 4 11 … … 8 15 #include "pmacros.h" 9 16 10 #include "fs_config.h"11 12 17 #include <sys/stat.h> 13 18 #include <sys/types.h> … … 15 20 #include <rtems/libio.h> 16 21 #include <rtems/rtems-rfs-format.h> 22 17 23 #include "ramdisk_support.h" 24 25 #include "fstest.h" 18 26 19 27 #define BLOCK_SIZE (512) 20 28 21 rtems_rfs_format_config config= 22 { 29 rtems_rfs_format_config config = { 23 30 block_size:BLOCK_SIZE 24 31 }; 25 32 26 33 27 void test_initialize_filesystem(void) 34 void 35 test_initialize_filesystem (void) 28 36 { 29 int rc =0;30 rc =mkdir(BASE_FOR_TEST,0777);31 rtems_test_assert (rc==0);37 int rc = 0; 38 rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO); 39 rtems_test_assert (rc == 0); 32 40 33 init_ramdisk ();41 init_ramdisk (); 34 42 35 rc =rtems_rfs_format(RAMDISK_PATH,&config);36 rtems_test_assert (rc==0);43 rc = rtems_rfs_format (RAMDISK_PATH, &config); 44 rtems_test_assert (rc == 0); 37 45 38 rc=mount(RAMDISK_PATH, 39 BASE_FOR_TEST, 40 "rfs", 41 RTEMS_FILESYSTEM_READ_WRITE, 42 NULL); 43 rtems_test_assert(rc==0); 46 rc = mount (RAMDISK_PATH, 47 BASE_FOR_TEST, "rfs", RTEMS_FILESYSTEM_READ_WRITE, NULL); 48 rtems_test_assert (rc == 0); 44 49 } 45 50 46 51 47 void test_shutdown_filesystem(void) 52 void 53 test_shutdown_filesystem (void) 48 54 { 49 int rc =0;50 rc =unmount(BASE_FOR_TEST);51 rtems_test_assert (rc==0);52 del_ramdisk ();55 int rc = 0; 56 rc = unmount (BASE_FOR_TEST); 57 rtems_test_assert (rc == 0); 58 del_ramdisk (); 53 59 } 54 60 55 61 /* configuration information */ 56 57 /* drivers */58 62 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 59 63 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 60 64 61 /**62 * Configure base RTEMS resources.63 */64 65 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 65 #define CONFIGURE_MEMORY_OVERHEAD 51266 #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited (10)67 #define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited (10)68 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited (6)69 #define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited (4)70 #define CONFIGURE_MAXIMUM_TIMERS 1071 66 67 #define CONFIGURE_MAXIMUM_TASKS 10 68 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 69 #define CONFIGURE_MAXIMUM_DRIVERS 10 70 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 72 71 73 /**74 * Configure file system and libblock.75 */76 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM77 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 10078 #define CONFIGURE_MAXIMUM_DRIVERS 10079 72 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK 80 73 … … 83 76 #define CONFIGURE_INIT 84 77 #include <rtems/confdefs.h> 85 -
testsuites/fstests/support/fstest.h
r32eba74 r858e013f 1 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 2 4 * 3 * $Id$ 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 4 10 */ 5 11 … … 10 16 #include "config.h" 11 17 #endif 12 13 18 #include <pmacros.h> 14 19 15 #include "fs_config.h" 20 #define TIME_PRECISION (2) 21 #define TIME_EQUAL(x,y) (abs((x)-(y))<TIME_PRECISION) 16 22 17 #define TIME_PRECISION (2) 18 #define time_equal(x,y) (abs((x)-(y))<TIME_PRECISION) 19 #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) 23 24 #define FS_PASS() do {puts("PASS");} while (0) 25 #define FS_FAIL() do {printf( "FAIL %s: %d \n", __FILE__, __LINE__ ); } while (0) 26 27 28 #define SHOW_MESSAGE(e, func, ...) printf(\ 29 "Testing %-10s with arguments: %-20s EXPECT %s\n",\ 30 #func,#__VA_ARGS__,#e) 31 32 #define EXPECT_EQUAL(expect, function, ...) do { \ 33 SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ 34 if (expect==function(__VA_ARGS__)) \ 35 FS_PASS();\ 36 else \ 37 FS_FAIL();\ 38 } while (0) 39 40 #define EXPECT_UNEQUAL(expect, function, ...) do { \ 41 SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ 42 if (expect!=function(__VA_ARGS__)) \ 43 FS_PASS();\ 44 else\ 45 FS_FAIL();\ 46 } while (0) 47 48 #define EXPECT_ERROR(ERROR, function, ...) do { \ 49 SHOW_MESSAGE(#ERROR,function,#__VA_ARGS__);\ 50 if ((-1==function(__VA_ARGS__)) && (errno==ERROR)) \ 51 FS_PASS();\ 52 else \ 53 FS_FAIL();\ 54 } while (0) 55 56 57 #define BASE_FOR_TEST "/mnt" 20 58 #endif 21 59 22 60 23 -
testsuites/fstests/support/fstest_support.c
r32eba74 r858e013f 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 10 */ 11 1 12 #include <stdio.h> 2 13 #include <errno.h> … … 12 23 #include "fs_config.h" 13 24 25 #include "fstest.h" 26 14 27 #define TEMP_DIR "waterbuffalo" 15 28 … … 19 32 { 20 33 21 int x; /* Used to move up a directory tree */22 int done=0; /* Are we done yet ? */23 34 int dir_fd; /* File descriptor to directory */ 24 35 struct stat sbuf; /* The stat() buffer */ … … 88 99 chdir("/"); 89 100 90 91 101 puts( "\n\nShutting down filesystem " FILESYSTEM ); 92 102 test_shutdown_filesystem(); … … 96 106 97 107 } 98 -
testsuites/fstests/support/fstest_support.h
r32eba74 r858e013f 1 2 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 3 4 * 4 * $Id$ 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 5 10 */ 6 11 #ifndef __FSTEST_SUPPORT_H 7 12 #define __FSTEST_SUPPORT_H 8 13 9 #ifdef HAVE_CONFIG_H10 #include "config.h"11 #endif12 #include "pmacros.h"13 14 #include "rtems.h"15 14 16 15 #ifdef __cplusplus … … 31 30 #endif 32 31 32 33 33 #endif -
testsuites/fstests/support/ramdisk_support.c
r32eba74 r858e013f 1 2 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 3 4 * 4 * $Id$ 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 5 10 */ 6 11 #include <rtems/ramdisk.h> … … 9 14 10 15 #include "ramdisk_support.h" 16 #include "fstest.h" 11 17 /* 12 18 * Ramdisk information … … 26 32 27 33 } 34 28 35 void del_ramdisk(void ) 29 36 { … … 36 43 37 44 rtems_filesystem_split_dev_t(dev,major,minor); 38 45 46 rtems_test_assert(major>=0); 47 rtems_test_assert(minor>=0); 48 39 49 rc=rtems_io_unregister_driver(major); 40 50 rtems_test_assert( rc == 0 ); … … 42 52 rc=rtems_disk_io_done(); 43 53 rtems_test_assert( rc == 0 ); 54 44 55 } 45 56 46 -
testsuites/fstests/support/ramdisk_support.h
r32eba74 r858e013f 1 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 2 4 * 3 * $Id$ 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id Exp $ 4 10 */ 5 11 #ifndef __RAMDISK_SUPPORT_H … … 9 15 #include "config.h" 10 16 #endif 11 12 #include "fstest_support.h"13 17 14 18 #define RAMDISK_BLOCK_SIZE (512)
Note: See TracChangeset
for help on using the changeset viewer.