Have updated yaffs direct tests and added README files to the tests.
[yaffs2.git] / direct / tests / nor_stress.c
index 3802837130d997e1f34840ddcdc2b3c470fb9094..e62095d785e59e71dd1ac07d157a6aa7be13d3a5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet another FFS. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
@@ -87,9 +87,9 @@ 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;
@@ -182,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);
        
@@ -191,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);
                        
@@ -224,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);
                
@@ -250,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;
@@ -309,7 +317,7 @@ WRITE_ERROR:
        
 }
 
-static int yVerifyFile(const char *fName)
+static int y_verify_file(const char *fName)
 {
        unsigned checksum = 0;
        unsigned totalSize;
@@ -392,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__);
@@ -406,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__);