Tweaks to nor stress simulation. Save random seed so that we can do better debugging
authorcharles <charles>
Fri, 21 Nov 2008 02:19:30 +0000 (02:19 +0000)
committercharles <charles>
Fri, 21 Nov 2008 02:19:30 +0000 (02:19 +0000)
direct/Makefile
direct/dtest.c
direct/nor_stress.c
direct/run_fw_update_test.sh
direct/yaffs_test.c
direct/ynorsim.c

index bfd98be92606ea00c4336cda0bf454822a97e78f..ff9f2e337c40f3e9413db2cbe2334f7c5053fc8f 100644 (file)
@@ -14,7 +14,7 @@
 #
 # NB Warning this Makefile does not include header dependencies.
 #
-# $Id: Makefile,v 1.20 2008-11-11 01:48:47 charles Exp $
+# $Id: Makefile,v 1.21 2008-11-21 02:19:30 charles Exp $
 
 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
 
@@ -22,7 +22,7 @@ CFLAGS =      -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_Y
 CFLAGS +=     -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE
 CFLAGS +=    -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing 
 #CFLAGS +=    -fno-strict-aliasing
-CFLAGS +=    -O3
+CFLAGS +=    -O0
 #CFLAGS +=    -DVALGRIND_TEST
 
 #CFLAGS+=   -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
index fd4f9666dd4fb6adb44754da61dc9743dbd77568..4478cdc9c515a588d5a26635d23db6515d84810c 100644 (file)
@@ -2283,10 +2283,11 @@ void random_small_file_test(const char *mountpt,int iterations)
 }
        
 
+int random_seed;
 
 int main(int argc, char *argv[])
 {
-
+       random_seed = time(NULL);
        //return long_test(argc,argv);
        
        //return cache_read_test();
index 4ac10b1c6186f929b0e1ea9f00aca7c353d679f3..b3704583a184ffc7f4f5b03f0285ee48783acd82 100644 (file)
@@ -290,10 +290,11 @@ static int yVerifyFile(const char *fName)
        return retval;
 }
 
-static unsigned long next = 1;
+extern int random_seed;
+
 int myrand(void) {
-  next = next * 1103515245 + 12345;
-  return((unsigned)(next/65536) % 32768);
+  random_seed = random_seed * 1103515245 + 12345;
+  return((unsigned)(random_seed/65536) % 32768);
 }
 
 static void DoUpdateMainFile(void)
@@ -344,13 +345,16 @@ void NorStressTestRun(const char *prefix)
   dump_directory_tree(fullPathName);
   
   UpdateCounter(fullPowerUpName,&powerUps,0);
+  dump_directory_tree(fullPathName);
   
   while(1){
     UpdateCounter(fullStartName, &cycleStarts,0);
+    dump_directory_tree(fullPathName);
     DoVerifyMainFile();
     DoUpdateMainFile();
     dump_directory_tree(fullPathName);
   
     UpdateCounter(fullEndName,&cycleEnds,0);
+    dump_directory_tree(fullPathName);
   }
 }
index b08fa84d1a57a757dca737df294fecc9702ef2ee..8ba15306c644bd60eb0717dc4af95c6489fffa64 100755 (executable)
@@ -3,10 +3,13 @@
 
 for ((i=0; i < 100000; i++))  
 do
-   echo $i > cycle.count
+
+   seed=$RANDOM   
    j=$(( $i % 10 ))
-   
+   rm seed*$j
+   echo $seed>seed$i
    rm data*$j
    cp ynorsimdata data$i
-   ./yaffs_test /M18-1 fw_update
+   echo "######### Run $i with seed $seed"
+   ./yaffs_test /M18-1 fw_update $seed
 done
index 381df44052c13b8766491f41e2cbd191fbb9471a..04e3b2ae40e93e1fbf5f489dbe8542be49316719 100644 (file)
 
 
 
+int random_seed;
+
 void BadUsage(void)
 {
-       printf("usage root_dir test_id\n");
+       printf("usage root_dir test_id seed \n");
        printf(" test_id: fw_update fw_update_init\n");
        exit(2);
 }
 int main(int argc, const char *argv[])
 {
        yaffs_StartUp();
-       if(argc == 3) {
+       if(argc == 4) {
+               random_seed = atoi(argv[3]);
+               if(random_seed <= 0)
+                       BadUsage();
+                       
                if(!strcmp(argv[2],"fw_update_init")){
                        NorStressTestInitialise(argv[1]);
                }
                else if(!strcmp(argv[2],"fw_update")){
+                       printf("Running stress on %s with seed %d\n",argv[1],random_seed);
                        NorStressTestRun(argv[1]);
                }
                else 
index 3281a2f374c3b78f05ec82572d974d4f2956e246..6936a9c874e2c9bffb4d995e8ab4d8e870c8fda6 100644 (file)
@@ -39,6 +39,7 @@
 
 static __u32 word[YNORSIM_DEV_SIZE_U32];
 
+extern int random_seed;
 
 static void NorError(void)
 {
@@ -89,7 +90,7 @@ static void ynorsim_Ready(void)
 {
   if(initialised) 
     return;
-  srand(time(NULL));
+  srand(random_seed);
   remaining_ops = 1000000000;
   remaining_ops = (rand() % 10000) * 3000 * YNORSIM_BIT_CHANGES;
   ynorsim_RestoreImage();