X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fdtest.c;h=8ccadbb4920dad78dd18b3ac08842114f8e3db83;hp=4f7b9b9b19bb1428be149a93b12131237305c84f;hb=3c86d69aed35d33bd7b348fbbf9810419395eacc;hpb=c0d545a4291efbb95831518929a87f07aa3c1eb9 diff --git a/direct/dtest.c b/direct/dtest.c index 4f7b9b9..8ccadbb 100644 --- a/direct/dtest.c +++ b/direct/dtest.c @@ -1791,6 +1791,81 @@ void multi_mount_test(const char *mountpt,int nmounts) } +void small_mount_test(const char *mountpt,int nmounts) +{ + + char a[30]; + char b[30]; + char c[30]; + + int i; + int j; + + int h0; + int h1; + int len0; + int len1; + int nread; + + sprintf(a,"%s/a",mountpt); + + yaffs_StartUp(); + + + + for(i = 0; i < nmounts; i++){ + + static char xx[1000]; + + printf("############### Iteration %d Start\n",i); + if(1 || i == 0 || i == 5) + yaffs_mount(mountpt); + + dump_directory_tree(mountpt); + + yaffs_mkdir(a,0); + + sprintf(xx,"%s/0",a); + if(i ==0){ + + h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); + for(j = 0; j < 130; j++) + yaffs_write(h0,xx,1000); + yaffs_close(h0); + } + + h0 = yaffs_open(xx,O_RDONLY,0); + + sprintf(xx,"%s/1",a); + h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); + + while((nread = yaffs_read(h0,xx,1000)) > 0) + yaffs_write(h1,xx,nread); + + + len0 = yaffs_lseek(h0,0,SEEK_END); + len1 = yaffs_lseek(h1,0,SEEK_END); + + yaffs_lseek(h0,0,SEEK_SET); + yaffs_lseek(h1,0,SEEK_SET); + + for(j = 0; j < 200; j++){ + yaffs_read(h0,xx,1000); + yaffs_read(h1,xx,1000); + } + + yaffs_close(h0); + yaffs_close(h1); + + printf("########### %d\n",i); + dump_directory_tree(mountpt); + + if(1 || i == 4 || i == nmounts -1) + yaffs_unmount(mountpt); + } +} + + void yaffs_touch(const char *fn) { yaffs_chmod(fn, S_IREAD | S_IWRITE); @@ -1996,7 +2071,7 @@ int main(int argc, char *argv[]) //scan_pattern_test("/flash",10000,10); //short_scan_test("/flash/flash",40000,200); - multi_mount_test("/flash/flash",1000); + small_mount_test("/flash/flash",1000); //checkpoint_fill_test("/flash/flash",20); //checkpoint_upgrade_test("/flash/flash",20); // huge_array_test("/flash/flash",10);