Fix some checkpoint stuff, add qsort
[yaffs2.git] / direct / dtest.c
index 13e55c7196786fb022df7b6f1e6fcf66af21717f..ed552e75d5232b1e496135d4ba80a0d5b36d2f71 100644 (file)
@@ -1723,7 +1723,7 @@ void multi_mount_test(const char *mountpt,int nmounts)
 
                write_200k_file(b,"","");
                
-               printf("######## Iteration %d   Start\n",i);
+               printf("######## Iteration %d   End\n",i);
                dump_directory_tree(mountpt);
                
                yaffs_unmount(mountpt);
@@ -1731,6 +1731,58 @@ void multi_mount_test(const char *mountpt,int nmounts)
 }
 
 
+void yaffs_touch(const char *fn)
+{
+       yaffs_chmod(fn, S_IREAD | S_IWRITE);
+}
+
+void checkpoint_fill_test(const char *mountpt,int nmounts)
+{
+
+       char a[50];
+       char b[50];
+       char c[50];
+       
+       int i;
+       int j;
+       int h;
+       
+       sprintf(a,"%s/a",mountpt);
+       
+
+       
+       
+       yaffs_StartUp();
+       
+       for(i = 0; i < nmounts; i++){
+               printf("############### Iteration %d   Start\n",i);
+               yaffs_mount(mountpt);
+               dump_directory_tree(mountpt);
+               yaffs_mkdir(a,0);
+               
+               sprintf(b,"%s/zz",a);
+               
+               h = yaffs_open(b,O_CREAT | O_RDWR,S_IREAD |S_IWRITE);
+               
+               
+               while(yaffs_write(h,c,50) == 50){}
+               
+               yaffs_close(h);
+               
+               for(j = 0; j < 100; j++){
+                       printf("touch %d\n",j);
+                       yaffs_touch(b);
+                       yaffs_unmount(mountpt);
+                       yaffs_mount(mountpt);
+               }
+
+               dump_directory_tree(mountpt);           
+               yaffs_unmount(mountpt);
+       }
+}
+
+
+
 int main(int argc, char *argv[])
 {
        //return long_test(argc,argv);
@@ -1747,7 +1799,8 @@ int main(int argc, char *argv[])
         
         //scan_pattern_test("/flash",10000,10);
        //short_scan_test("/flash/flash",40000,200);
-        multi_mount_test("/flash/flash",20);
+        //multi_mount_test("/flash/flash",20);
+        checkpoint_fill_test("/flash/flash",20);