More changes to test harness
authorcharles <charles>
Wed, 8 Nov 2006 09:49:47 +0000 (09:49 +0000)
committercharles <charles>
Wed, 8 Nov 2006 09:49:47 +0000 (09:49 +0000)
direct/dtest.c
direct/yaffs_fileem2k.c
direct/yaffscfg2k.c

index be4ed54..4f7b9b9 100644 (file)
@@ -1741,6 +1741,9 @@ void multi_mount_test(const char *mountpt,int nmounts)
        for(i = 0; i < nmounts; i++){
                int h0;
                int h1;
+               int len0;
+               int len1;
+               
                static char xx[1000];
                
                printf("############### Iteration %d   Start\n",i);
@@ -1762,6 +1765,19 @@ void multi_mount_test(const char *mountpt,int nmounts)
                   yaffs_write(h0,xx,1000);
                   yaffs_write(h1,xx,1000);
                }
+               
+               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_truncate(h0,0);
                yaffs_close(h0);
                yaffs_close(h1);
@@ -1980,7 +1996,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",20);
+         multi_mount_test("/flash/flash",1000);
         //checkpoint_fill_test("/flash/flash",20);
         //checkpoint_upgrade_test("/flash/flash",20);
         // huge_array_test("/flash/flash",10);
index 8b4b461..47437d5 100644 (file)
@@ -15,7 +15,7 @@
 // This provides a YAFFS nand emulation on a file for emulating 2kB pages.
 // THis is only intended as test code to test persistence etc.
 
-const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.8 2006-11-07 23:37:43 charles Exp $";
+const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.9 2006-11-08 09:49:47 charles Exp $";
 
 
 #include "yportenv.h"
@@ -32,7 +32,7 @@ const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.8 2006-11-07 23
 #include "yaffs_fileem2k.h"
 #include "yaffs_packedtags2.h"
 
-//#define SIMULATE_FAILURES
+#define SIMULATE_FAILURES
 
 typedef struct 
 {
@@ -164,6 +164,15 @@ int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8
                        exit(1);
                }
                
+#ifdef SIMULATE_FAILURES
+                       if((chunkInNAND >> 6) == 100) 
+                         written = 0;
+
+                       if((chunkInNAND >> 6) == 110) 
+                         written = 0;
+#endif
+
+
                if(written != dev->nDataBytesPerChunk) return YAFFS_FAIL;
        }
        
@@ -257,14 +266,14 @@ int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *da
                        nread= read(h,&pt,sizeof(pt));
                        yaffs_UnpackTags2(tags,&pt);
 #ifdef SIMULATE_FAILURES
-                       if((chunkInNAND >> 6) == 300) {
+                       if((chunkInNAND >> 6) == 100) {
                            if(fail300 && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR){
                               tags->eccResult = YAFFS_ECC_RESULT_FIXED;
                               fail300 = 0;
                            }
                            
                        }
-                       if((chunkInNAND >> 6) == 320) {
+                       if((chunkInNAND >> 6) == 110) {
                            if(fail320 && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR){
                               tags->eccResult = YAFFS_ECC_RESULT_FIXED;
                               fail320 = 0;
index cb960bc..fee6175 100644 (file)
 
 #include <errno.h>
 
-unsigned yaffs_traceMask = YAFFS_TRACE_SCAN |  YAFFS_TRACE_GC /*| YAFFS_TRACE_GC_DETAIL | YAFFS_TRACE_WRITE */ | YAFFS_TRACE_ERASE | YAFFS_TRACE_TRACING | YAFFS_TRACE_ALLOCATE | YAFFS_TRACE_CHECKPOINT;
-//unsigned yaffs_traceMask = ~0;
+unsigned yaffs_traceMask = 
+
+       YAFFS_TRACE_SCAN |  
+       YAFFS_TRACE_GC | YAFFS_TRACE_GC_DETAIL | 
+       YAFFS_TRACE_WRITE  | YAFFS_TRACE_ERASE | 
+       YAFFS_TRACE_TRACING | 
+       YAFFS_TRACE_ALLOCATE | 
+       YAFFS_TRACE_CHECKPOINT |
+       YAFFS_TRACE_BAD_BLOCKS |
+//     (~0) |
+       
+       0;
+        
 
 
 void yaffsfs_SetError(int err)
@@ -129,9 +140,9 @@ int yaffs_StartUp(void)
        flashDev.nCheckpointReservedBlocks = 5;
        //flashDev.checkpointStartBlock = 1;
        //flashDev.checkpointEndBlock = 20;
-       flashDev.startBlock = 20; 
-       //flashDev.endBlock = 127; // Make it smaller
-       flashDev.endBlock = yflash_GetNumberOfBlocks()-1;
+       flashDev.startBlock = 0;
+       flashDev.endBlock = 200; // Make it smaller
+       //flashDev.endBlock = yflash_GetNumberOfBlocks()-1;
        flashDev.isYaffs2 = 1;
        flashDev.wideTnodesDisabled=0;
        flashDev.nShortOpCaches = 10; // Use caches