X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fdtest.c;h=06a190ec2f77c6fd7013377129605fb6aa7a82b2;hp=36152cbb88e56fe669baca5de82d0c7173589401;hb=870a75229102c3d8922a465f0edcbb20ea4e996e;hpb=df75ece25ca709af96fcc2abe0fa1fc4ccc24cba diff --git a/direct/dtest.c b/direct/dtest.c index 36152cb..06a190e 100644 --- a/direct/dtest.c +++ b/direct/dtest.c @@ -434,7 +434,6 @@ void fill_files(char *path,int flags, int maxIterations,int siz) do{ sprintf(str,"%s/%d",path,i); h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE); - yaffs_close(h); if(h >= 0) { @@ -1398,6 +1397,50 @@ void fill_disk_test(const char *mountpt) } +void fill_files_test(const char *mountpt) +{ + int i; + yaffs_StartUp(); + + for(i = 0; i < 5; i++) + { + yaffs_mount(mountpt); + fill_files(mountpt,2,3,100); + yaffs_unmount(mountpt); + } + +} + +void fill_empty_files_test(const char *mountpt) +{ + int i; + yaffs_StartUp(); + char name[100]; + int result = 0; + + int d,f; + + for(i = 0; i < 5; i++) + { + yaffs_mount(mountpt); + for(d = 0; result >= 0 && d < 1000; d++){ + sprintf(name,"%s/%d",mountpt,d); + result= yaffs_mkdir(name,0); + printf("creating directory %s result %d\n",name,result); + + for(f = 0; result >= 0 && f < 100; f++){ + sprintf(name,"%s/%d/%d",mountpt,d,f); + result= yaffs_open(name,O_CREAT, 0); + yaffs_close(result); + printf("creating file %s result %d\n",name,result); + } + } + yaffs_unmount(mountpt); + } + +} + + void lookup_test(const char *mountpt) { @@ -2317,7 +2360,7 @@ int main(int argc, char *argv[]) //rename_over_test("//////////////////flash///////////////////yaffs1///////////"); - rmdir_test("/M18-1"); + fill_empty_files_test("/yaffs2/"); //scan_pattern_test("/flash",10000,10); //short_scan_test("/flash/flash",40000,200);