yaffs Yet more tests for quick tests.
[yaffs2.git] / direct / tests / nor_stress.c
index bb614d8481363b380a48850aefee081908f01269..730bd4353c088255a8443867c53bc17bbc37fbff 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 
 
+extern int fuzz_test;
 
 #if 1
 #define FSX_INIT(mount_pt) do{ if(interleave_fsx) yaffs_fsx_init(mount_pt); } while(0)
@@ -86,9 +87,13 @@ void MakeFullNames(const char *prefix)
   MakeName(fullTempMainName,prefix,"tmp-main");
 }
 
-static void FatalError(int lineNo)
+static void FatalError(int line_no)
 {
-  printf("Integrity error %d\n",lineNo);
+  printf("Integrity error %d\n",line_no);
+
+  if(fuzz_test)
+       return;
+
   if(ext_fatal)
        ext_fatal();
        
@@ -177,6 +182,7 @@ static void dump_directory_tree_worker(const char *dname,int recursive)
        struct yaffs_stat s;
        char str[1000];
        int error_line = 0;
+       int nentries;
                        
        d = yaffs_opendir(dname);
        
@@ -186,11 +192,13 @@ static void dump_directory_tree_worker(const char *dname,int recursive)
        }
        else
        {
+               nentries = 0;
                while((de = yaffs_readdir(d)) != NULL)
                {
                        strcpy(str,dname);
                        strcat(str,"/");
                        strcat(str,de->d_name);
+                       nentries++;
                        
                        yaffs_lstat(str,&s);
                        
@@ -219,10 +227,15 @@ static void dump_directory_tree_worker(const char *dname,int recursive)
                                dump_directory_tree_worker(str,1);
                                
                         if(s.st_ino > 10000)
-                          error_line = __LINE__;
+                               error_line = __LINE__;
                                                        
                }
                
+               if(strstr(dname,"lost+found") && nentries >0){
+                       printf("\n\n!!! HEY lost+found not empty, had %d entries\n\n\n",nentries);
+                       error_line = __LINE__;
+               }
+
                if(error_line && !no_verification)
                        FatalError(error_line);
                
@@ -245,7 +258,7 @@ static void dump_directory_tree(const char *dname)
 
 static unsigned xx[XX_SIZE];
 
-static int yWriteFile(const char *fname, unsigned sz32)
+static int y_wr_file(const char *fname, unsigned sz32)
 {
        int h;
        int r;
@@ -304,7 +317,7 @@ WRITE_ERROR:
        
 }
 
-static int yVerifyFile(const char *fName)
+static int y_verify_file(const char *fName)
 {
        unsigned checksum = 0;
        unsigned totalSize;
@@ -387,7 +400,7 @@ static void DoUpdateMainFile(void)
         int sz32;
         sz32 = (myrand() % 1000)   + 20;
         
-       result = yWriteFile(fullTempMainName,sz32);
+       result = y_wr_file(fullTempMainName,sz32);
        FSX();
        if(!no_verification && result)
            FatalError(__LINE__);
@@ -401,7 +414,7 @@ static void DoVerifyMainFile(void)
         int result;
        if(no_verification)
                return;
-       result = yVerifyFile(fullMainName);
+       result = y_verify_file(fullMainName);
        if(result)
            FatalError(__LINE__);