2 * Test code for the "direct" interface.
13 void dumpDir(const char *dname);
17 void copy_in_a_file(char *yaffsName,char *inName)
20 unsigned char buffer[100];
22 inh = open(inName,O_RDONLY);
23 outh = yaffs_open(yaffsName, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
25 while((ni = read(inh,buffer,100)) > 0)
27 no = yaffs_write(outh,buffer,ni);
30 printf("problem writing yaffs file\n");
39 void make_a_file(char *yaffsName,char bval,int sizeOfFile)
43 unsigned char buffer[100];
45 outh = yaffs_open(yaffsName, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
47 memset(buffer,bval,100);
54 yaffs_write(outh,buffer,i);
56 } while (sizeOfFile > 0);
63 void make_pattern_file(char *fn,int size)
68 outh = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
69 yaffs_lseek(outh,size-1,SEEK_SET);
70 yaffs_write(outh,"A",1);
72 for(i = 0; i < size; i+=256)
75 yaffs_lseek(outh,i,SEEK_SET);
76 yaffs_write(outh,&marker,sizeof(marker));
82 int check_pattern_file(char *fn)
90 h = yaffs_open(fn, O_RDWR,0);
91 size = yaffs_lseek(h,0,SEEK_END);
93 for(i = 0; i < size; i+=256)
95 yaffs_lseek(h,i,SEEK_SET);
96 yaffs_read(h,&marker,sizeof(marker));
100 printf("pattern check failed on file %s, size %d at position %d. Got %x instead of %x\n",
101 fn,size,i,marker,~i);
112 int dump_file_data(char *fn)
121 h = yaffs_open(fn, O_RDWR,0);
125 while(yaffs_read(h,&b,1)> 0)
142 void dump_file(const char *fn)
148 h = yaffs_open(fn,O_RDONLY,0);
151 printf("*****\nDump file %s does not exist\n",fn);
155 size = yaffs_lseek(h,0,SEEK_SET);
156 printf("*****\nDump file %s size %d\n",fn,size);
157 for(i = 0; i < size; i++)
164 void create_file_of_size(const char *fn,int syze)
170 int iterations = (syze + strlen(fn) -1)/ strlen(fn);
172 h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
174 while (iterations > 0)
176 yaffs_write(h,fn,strlen(fn));
182 void create_resized_file_of_size(const char *fn,int syze1,int reSyze, int syze2)
190 h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
192 iterations = (syze1 + strlen(fn) -1)/ strlen(fn);
193 while (iterations > 0)
195 yaffs_write(h,fn,strlen(fn));
199 yaffs_truncate(h,reSyze);
201 yaffs_lseek(h,0,SEEK_SET);
202 iterations = (syze2 + strlen(fn) -1)/ strlen(fn);
203 while (iterations > 0)
205 yaffs_write(h,fn,strlen(fn));
213 void do_some_file_stuff(const char *path)
218 sprintf(fn,"%s/%s",path,"f1");
219 create_file_of_size(fn,10000);
221 sprintf(fn,"%s/%s",path,"fdel");
222 create_file_of_size(fn,10000);
225 sprintf(fn,"%s/%s",path,"f2");
227 create_resized_file_of_size(fn,10000,3000,4000);
230 void yaffs_backward_scan_test(const char *path)
238 do_some_file_stuff(path);
240 sprintf(fn,"%s/ddd",path);
244 do_some_file_stuff(fn);
253 void short_scan_test(const char *path, int fsize, int niterations)
258 sprintf(fn,"%s/%s",path,"f1");
261 for(i = 0; i < niterations; i++)
263 printf("\n*****************\nIteration %d\n",i);
265 printf("\nmount: Directory look-up of %s\n",path);
267 make_a_file(fn,1,fsize);
274 void scan_pattern_test(const char *path, int fsize, int niterations)
281 sprintf(fn[0],"%s/%s",path,"f0");
282 sprintf(fn[1],"%s/%s",path,"f1");
283 sprintf(fn[2],"%s/%s",path,"f2");
287 for(i = 0; i < niterations; i++)
289 printf("\n*****************\nIteration %d\n",i);
291 printf("\nmount: Directory look-up of %s\n",path);
293 for(j = 0; j < 3; j++)
295 result = dump_file_data(fn[j]);
296 result = check_pattern_file(fn[j]);
297 make_pattern_file(fn[j],fsize);
298 result = dump_file_data(fn[j]);
299 result = check_pattern_file(fn[j]);
305 void fill_disk(char *path,int nfiles)
314 for(n = 0; n < nfiles; n++)
316 sprintf(str,"%s/%d",path,n);
318 h = yaffs_open(str, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
320 printf("writing file %s handle %d ",str, h);
322 while ((result = yaffs_write(h,xx,600)) == 600)
324 f = yaffs_freespace(path);
326 result = yaffs_close(h);
327 printf(" close %d\n",result);
331 void fill_disk_and_delete(char *path, int nfiles, int ncycles)
337 for(i = 0; i < ncycles; i++)
339 printf("@@@@@@@@@@@@@@ cycle %d\n",i);
340 fill_disk(path,nfiles);
342 for(j = 0; j < nfiles; j++)
344 sprintf(str,"%s/%d",path,j);
345 result = yaffs_unlink(str);
346 printf("unlinking file %s, result %d\n",str,result);
352 void fill_files(char *path,int flags, int maxIterations,int siz)
362 sprintf(str,"%s/%d",path,i);
363 h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE);
368 for(j = 0; j < siz; j++)
370 yaffs_write(h,str,1);
379 } while(h >= 0 && i < maxIterations);
385 sprintf(str,"%s/%d",path,i);
386 printf("unlink %s\n",str);
388 } while(yaffs_unlink(str) >= 0);
392 void leave_unlinked_file(char *path,int maxIterations,int siz)
401 sprintf(str,"%s/%d",path,i);
402 printf("create %s\n",str);
403 h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE);
409 } while(h < 0 && i < maxIterations);
413 for(i = 0; i < siz; i++)
415 yaffs_write(h,str,1);
419 printf("Leaving file %s open\n",str);
423 void dumpDirFollow(const char *dname)
430 d = yaffs_opendir(dname);
434 printf("opendir failed\n");
438 while((de = yaffs_readdir(d)) != NULL)
440 sprintf(str,"%s/%s",dname,de->d_name);
444 printf("%s length %d mode %X ",de->d_name,(int)s.st_size,s.st_mode);
445 switch(s.st_mode & S_IFMT)
447 case S_IFREG: printf("data file"); break;
448 case S_IFDIR: printf("directory"); break;
449 case S_IFLNK: printf("symlink -->");
450 if(yaffs_readlink(str,str,100) < 0)
453 printf("\"%s\"",str);
455 default: printf("unknown"); break;
465 printf("Free space in %s is %d\n\n",dname,(int)yaffs_freespace(dname));
470 void dumpDir(const char *dname)
477 d = yaffs_opendir(dname);
481 printf("opendir failed\n");
485 while((de = yaffs_readdir(d)) != NULL)
487 sprintf(str,"%s/%s",dname,de->d_name);
491 printf("%s length %d mode %X ",de->d_name,(int)s.st_size,s.st_mode);
492 switch(s.st_mode & S_IFMT)
494 case S_IFREG: printf("data file"); break;
495 case S_IFDIR: printf("directory"); break;
496 case S_IFLNK: printf("symlink -->");
497 if(yaffs_readlink(str,str,100) < 0)
500 printf("\"%s\"",str);
502 default: printf("unknown"); break;
512 printf("Free space in %s is %d\n\n",dname,(int)yaffs_freespace(dname));
517 static void PermissionsCheck(const char *path, mode_t tmode, int tflags,int expectedResult)
521 if(yaffs_chmod(path,tmode)< 0) printf("chmod failed\n");
523 fd = yaffs_open(path,tflags,0);
525 if((fd >= 0) != (expectedResult > 0))
527 printf("Permissions check %x %x %d failed\n",tmode,tflags,expectedResult);
531 printf("Permissions check %x %x %d OK\n",tmode,tflags,expectedResult);
540 int long_test(int argc, char *argv[])
551 struct yaffs_stat ystat;
555 yaffs_mount("/boot");
556 yaffs_mount("/data");
557 yaffs_mount("/flash");
560 printf("\nDirectory look-up of /boot\n");
562 printf("\nDirectory look-up of /data\n");
564 printf("\nDirectory look-up of /flash\n");
567 //leave_unlinked_file("/flash",20000,0);
568 //leave_unlinked_file("/data",20000,0);
570 leave_unlinked_file("/ram",20,0);
573 f = yaffs_open("/boot/b1", O_RDONLY,0);
575 printf("open /boot/b1 readonly, f=%d\n",f);
577 f = yaffs_open("/boot/b1", O_CREAT,S_IREAD | S_IWRITE);
579 printf("open /boot/b1 O_CREAT, f=%d\n",f);
582 r = yaffs_write(f,"hello",1);
583 printf("write %d attempted to write to a read-only file\n",r);
587 printf("close %d\n",r);
589 f = yaffs_open("/boot/b1", O_RDWR,0);
591 printf("open /boot/b1 O_RDWR,f=%d\n",f);
594 r = yaffs_write(f,"hello",2);
595 printf("write %d attempted to write to a writeable file\n",r);
596 r = yaffs_write(f,"world",3);
597 printf("write %d attempted to write to a writeable file\n",r);
599 r= yaffs_lseek(f,0,SEEK_END);
600 printf("seek end %d\n",r);
602 r = yaffs_read(f,buffer,10);
603 printf("read %d \"%s\"\n",r,buffer);
604 r= yaffs_lseek(f,0,SEEK_SET);
605 printf("seek set %d\n",r);
607 r = yaffs_read(f,buffer,10);
608 printf("read %d \"%s\"\n",r,buffer);
610 r = yaffs_read(f,buffer,10);
611 printf("read %d \"%s\"\n",r,buffer);
613 // Check values reading at end.
614 // A read past end of file should return 0 for 0 bytes read.
616 r= yaffs_lseek(f,0,SEEK_END);
617 r = yaffs_read(f,buffer,10);
618 printf("read at end returned %d\n",r);
619 r= yaffs_lseek(f,500,SEEK_END);
620 r = yaffs_read(f,buffer,10);
621 printf("read past end returned %d\n",r);
625 printf("close %d\n",r);
627 copy_in_a_file("/boot/yyfile","xxx");
629 // Create a file with a long name
631 copy_in_a_file("/boot/file with a long name","xxx");
634 printf("\nDirectory look-up of /boot\n");
638 r = yaffs_stat("/boot/file with a long name",&ystat);
642 r = yaffs_rename("/boot/file with a long name","/boot/r1");
644 printf("\nDirectory look-up of /boot\n");
648 r = yaffs_unlink("/boot/r1");
650 printf("\nDirectory look-up of /boot\n");
655 r = yaffs_mkdir("/boot/directory1",0);
657 printf("\nDirectory look-up of /boot\n");
659 printf("\nDirectory look-up of /boot/directory1\n");
660 dumpDir("/boot/directory1");
662 // add a file to the directory
663 copy_in_a_file("/boot/directory1/file with a long name","xxx");
665 printf("\nDirectory look-up of /boot\n");
667 printf("\nDirectory look-up of /boot/directory1\n");
668 dumpDir("/boot/directory1");
670 // Attempt to delete directory (should fail)
672 r = yaffs_rmdir("/boot/directory1");
674 printf("\nDirectory look-up of /boot\n");
676 printf("\nDirectory look-up of /boot/directory1\n");
677 dumpDir("/boot/directory1");
679 // Delete file first, then rmdir should work
680 r = yaffs_unlink("/boot/directory1/file with a long name");
681 r = yaffs_rmdir("/boot/directory1");
684 printf("\nDirectory look-up of /boot\n");
686 printf("\nDirectory look-up of /boot/directory1\n");
687 dumpDir("/boot/directory1");
690 fill_disk_and_delete("/boot",20,20);
692 printf("\nDirectory look-up of /boot\n");
696 yaffs_symlink("yyfile","/boot/slink");
698 yaffs_readlink("/boot/slink",str,100);
699 printf("symlink alias is %s\n",str);
704 printf("\nDirectory look-up of /boot\n");
706 printf("\nDirectory look-up of /boot (using stat instead of lstat)\n");
707 dumpDirFollow("/boot");
708 printf("\nDirectory look-up of /boot/directory1\n");
709 dumpDir("/boot/directory1");
711 h = yaffs_open("/boot/slink",O_RDWR,0);
713 printf("file length is %d\n",(int)yaffs_lseek(h,0,SEEK_END));
717 yaffs_unlink("/boot/slink");
720 printf("\nDirectory look-up of /boot\n");
725 yaffs_stat("/boot/yyfile",&ystat);
726 temp_mode = ystat.st_mode;
728 yaffs_chmod("/boot/yyfile",0x55555);
729 printf("\nDirectory look-up of /boot\n");
732 yaffs_chmod("/boot/yyfile",temp_mode);
733 printf("\nDirectory look-up of /boot\n");
736 // Permission checks...
737 PermissionsCheck("/boot/yyfile",0, O_WRONLY,0);
738 PermissionsCheck("/boot/yyfile",0, O_RDONLY,0);
739 PermissionsCheck("/boot/yyfile",0, O_RDWR,0);
741 PermissionsCheck("/boot/yyfile",S_IREAD, O_WRONLY,0);
742 PermissionsCheck("/boot/yyfile",S_IREAD, O_RDONLY,1);
743 PermissionsCheck("/boot/yyfile",S_IREAD, O_RDWR,0);
745 PermissionsCheck("/boot/yyfile",S_IWRITE, O_WRONLY,1);
746 PermissionsCheck("/boot/yyfile",S_IWRITE, O_RDONLY,0);
747 PermissionsCheck("/boot/yyfile",S_IWRITE, O_RDWR,0);
749 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_WRONLY,1);
750 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_RDONLY,1);
751 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_RDWR,1);
753 yaffs_chmod("/boot/yyfile",temp_mode);
755 //create a zero-length file and unlink it (test for scan bug)
757 h = yaffs_open("/boot/zlf",O_CREAT | O_TRUNC | O_RDWR,0);
760 yaffs_unlink("/boot/zlf");
763 yaffs_DumpDevStruct("/boot");
765 fill_disk_and_delete("/boot",20,20);
767 yaffs_DumpDevStruct("/boot");
769 fill_files("/boot",1,10000,0);
770 fill_files("/boot",1,10000,5000);
771 fill_files("/boot",2,10000,0);
772 fill_files("/boot",2,10000,5000);
774 leave_unlinked_file("/data",20000,0);
775 leave_unlinked_file("/data",20000,5000);
776 leave_unlinked_file("/data",20000,5000);
777 leave_unlinked_file("/data",20000,5000);
778 leave_unlinked_file("/data",20000,5000);
779 leave_unlinked_file("/data",20000,5000);
781 yaffs_DumpDevStruct("/boot");
782 yaffs_DumpDevStruct("/data");
790 int huge_directory_test_on_path(char *path)
810 struct yaffs_stat ystat;
816 // Create a large number of files
818 for(i = 0; i < 2000; i++)
820 sprintf(str,"%s/%d",path,i);
822 f = yaffs_open(str,O_CREAT,S_IREAD | S_IWRITE);
828 d = yaffs_opendir(path);
831 while((de = yaffs_readdir(d)) != NULL) {
832 if (total >lastTotal+100*9*1024||(i & 1023)==0){
833 printf("files = %d, total = %d\n",i, total);
837 sprintf(str,"%s/%s",path,de->d_name);
839 switch(s.st_mode & S_IFMT){
841 //printf("data file");
853 int yaffs_scan_test(const char *path)
859 int resize_stress_test(const char *path)
874 sprintf(aname,"%s%s",path,"/a");
875 sprintf(bname,"%s%s",path,"/b");
877 memset(abuffer,'a',1000);
878 memset(bbuffer,'b',1000);
880 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
881 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
883 printf(" %s %d %s %d\n",aname,a,bname,b);
887 for(j = 0; j < 100; j++)
889 yaffs_lseek(a,0,SEEK_END);
892 for(i = 0; i <20000; i++)
894 //r = yaffs_lseek(b,i,SEEK_SET);
895 //r = yaffs_write(b,bbuffer,1000);
900 int syz = yaffs_lseek(a,0,SEEK_END);
904 yaffs_truncate(a,syz);
910 r = yaffs_lseek(a,i * 500,SEEK_SET);
911 r = yaffs_write(a,abuffer,1000);
923 int resize_stress_test_no_grow_complex(const char *path,int iters)
938 sprintf(aname,"%s%s",path,"/a");
939 sprintf(bname,"%s%s",path,"/b");
941 memset(abuffer,'a',1000);
942 memset(bbuffer,'b',1000);
944 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
945 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
947 printf(" %s %d %s %d\n",aname,a,bname,b);
951 for(j = 0; j < iters; j++)
953 yaffs_lseek(a,0,SEEK_END);
956 for(i = 0; i <20000; i++)
958 //r = yaffs_lseek(b,i,SEEK_SET);
959 //r = yaffs_write(b,bbuffer,1000);
964 int syz = yaffs_lseek(a,0,SEEK_END);
971 yaffs_truncate(a,syz);
972 syz = yaffs_lseek(a,0,SEEK_END);
973 printf("shrink to %d\n",syz);
981 r = yaffs_lseek(a,500,SEEK_END);
982 r = yaffs_write(a,abuffer,1000);
988 printf("file size is %d\n",yaffs_lseek(a,0,SEEK_END));
996 int resize_stress_test_no_grow(const char *path,int iters)
1011 sprintf(aname,"%s%s",path,"/a");
1012 sprintf(bname,"%s%s",path,"/b");
1014 memset(abuffer,'a',1000);
1015 memset(bbuffer,'b',1000);
1017 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
1018 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
1020 printf(" %s %d %s %d\n",aname,a,bname,b);
1024 for(j = 0; j < iters; j++)
1026 yaffs_lseek(a,0,SEEK_END);
1029 for(i = 0; i <20000; i++)
1031 //r = yaffs_lseek(b,i,SEEK_SET);
1032 //r = yaffs_write(b,bbuffer,1000);
1037 int syz = yaffs_lseek(a,0,SEEK_END);
1043 if(syz < 0) syz = 0;
1044 yaffs_truncate(a,syz);
1045 syz = yaffs_lseek(a,0,SEEK_END);
1046 printf("shrink to %d\n",syz);
1054 r = yaffs_lseek(a,-500,SEEK_END);
1055 r = yaffs_write(a,abuffer,1000);
1061 printf("file size is %d\n",yaffs_lseek(a,0,SEEK_END));
1069 int directory_rename_test(void)
1074 yaffs_mount("/ram");
1075 yaffs_mkdir("/ram/a",0);
1076 yaffs_mkdir("/ram/a/b",0);
1077 yaffs_mkdir("/ram/c",0);
1079 printf("\nDirectory look-up of /ram\n");
1082 dumpDir("/ram/a/b");
1084 printf("Do rename (should fail)\n");
1086 r = yaffs_rename("/ram/a","/ram/a/b/d");
1087 printf("\nDirectory look-up of /ram\n");
1090 dumpDir("/ram/a/b");
1092 printf("Do rename (should not fail)\n");
1094 r = yaffs_rename("/ram/c","/ram/a/b/d");
1095 printf("\nDirectory look-up of /ram\n");
1098 dumpDir("/ram/a/b");
1105 int cache_read_test(void)
1109 int sizeOfFiles = 500000;
1114 yaffs_mount("/boot");
1116 make_a_file("/boot/a",'a',sizeOfFiles);
1117 make_a_file("/boot/b",'b',sizeOfFiles);
1119 a = yaffs_open("/boot/a",O_RDONLY,0);
1120 b = yaffs_open("/boot/b",O_RDONLY,0);
1121 c = yaffs_open("/boot/c", O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
1125 if (i > 100) i = 100;
1127 yaffs_read(a,buffer,i);
1128 yaffs_read(b,buffer,i);
1129 yaffs_write(c,buffer,i);
1130 } while(sizeOfFiles > 0);
1138 int cache_bypass_bug_test(void)
1140 // This test reporoduces a bug whereby YAFFS caching *was* buypassed
1141 // resulting in erroneous reads after writes.
1142 // This bug has been fixed.
1149 memset(buffer1,0,sizeof(buffer1));
1150 memset(buffer2,0,sizeof(buffer2));
1154 yaffs_mount("/boot");
1156 // Create a file of 2000 bytes.
1157 make_a_file("/boot/a",'X',2000);
1159 a = yaffs_open("/boot/a",O_RDWR, S_IREAD | S_IWRITE);
1161 // Write a short sequence to the file.
1162 // This will go into the cache.
1163 yaffs_lseek(a,0,SEEK_SET);
1164 yaffs_write(a,"abcdefghijklmnopqrstuvwxyz",20);
1166 // Read a short sequence from the file.
1167 // This will come from the cache.
1168 yaffs_lseek(a,0,SEEK_SET);
1169 yaffs_read(a,buffer1,30);
1171 // Read a page size sequence from the file.
1172 yaffs_lseek(a,0,SEEK_SET);
1173 yaffs_read(a,buffer2,512);
1175 printf("buffer 1 %s\n",buffer1);
1176 printf("buffer 2 %s\n",buffer2);
1178 if(strncmp(buffer1,buffer2,20))
1180 printf("Cache bypass bug detected!!!!!\n");
1188 int free_space_check(void)
1193 yaffs_mount("/boot");
1194 fill_disk("/boot/",2);
1195 f = yaffs_freespace("/boot");
1197 printf("%d free when disk full\n",f);
1201 int truncate_test(void)
1211 yaffs_mount("/boot");
1213 yaffs_unlink("/boot/trunctest");
1215 a = yaffs_open("/boot/trunctest", O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
1217 yaffs_write(a,"abcdefghijklmnopqrstuvwzyz",26);
1219 yaffs_truncate(a,3);
1220 l= yaffs_lseek(a,0,SEEK_END);
1222 printf("truncated length is %d\n",l);
1224 yaffs_lseek(a,5,SEEK_SET);
1225 yaffs_write(a,"1",1);
1227 yaffs_lseek(a,0,SEEK_SET);
1229 r = yaffs_read(a,y,10);
1231 printf("read %d bytes:",r);
1233 for(i = 0; i < r; i++) printf("[%02X]",y[i]);
1245 void fill_disk_test(const char *mountpt)
1250 for(i = 0; i < 5; i++)
1252 yaffs_mount(mountpt);
1253 fill_disk_and_delete(mountpt,100,i+1);
1254 yaffs_unmount(mountpt);
1258 void scan_deleted_files_test(const char *mountpt)
1270 sprintf(sub,"%s/sdir",mountpt);
1273 for(j = 0; j < 10; j++)
1275 printf("\n\n>>>>>>> Run %d <<<<<<<<<<<<<\n\n",j);
1276 yaffs_mount(mountpt);
1280 p = (j & 0) ? mountpt: sub;
1282 for(i = 0; i < 100; i++)
1284 sprintf(fn,"%s/%d",p,i);
1288 h = yaffs_open(fn,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
1289 for(k = 0; k < 1000; k++)
1290 yaffs_write(h,fn,100);
1297 for(i = 0; i < 10; i++)
1299 sprintf(fn,"%s/%d",p,i);
1307 yaffs_unmount(mountpt);
1315 int main(int argc, char *argv[])
1317 //return long_test(argc,argv);
1319 //return cache_read_test();
1321 //resize_stress_test_no_grow("/flash",2);
1323 //huge_directory_test_on_path("/ram2k");
1325 //yaffs_backward_scan_test("/flash") ;
1327 //scan_pattern_test("/flash",10000,10);
1328 //short_scan_test("/flash",40000,200);
1331 //long_test_on_path("/ram2k");
1332 //long_test_on_path("/flash");
1333 fill_disk_test("/flash");
1337 // cache_bypass_bug_test();
1339 //free_space_check();