More test tweaks
authorcharles <charles>
Sat, 7 Nov 2009 22:35:15 +0000 (22:35 +0000)
committercharles <charles>
Sat, 7 Nov 2009 22:35:15 +0000 (22:35 +0000)
direct/tests/nor_stress.c
direct/tests/run_fw_update_test_nand.sh
direct/tests/yaffs_test.c
direct/yaffs_fileem2k.c

index 033700ddeea3177d56a3d2f9066f8d7bf343dc77..f84e1470ad8c6698e6395fb412626a533becd008 100644 (file)
@@ -27,6 +27,8 @@ do { \
 #endif
 
 
 #endif
 
 
+void (*ext_fatal)(void) = NULL;
+
 static unsigned powerUps;
 static unsigned cycleStarts;
 static unsigned cycleEnds;
 static unsigned powerUps;
 static unsigned cycleStarts;
 static unsigned cycleEnds;
@@ -71,6 +73,9 @@ void MakeFullNames(const char *prefix)
 static void FatalError(int lineNo)
 {
   printf("Integrity error %d\n",lineNo);
 static void FatalError(int lineNo)
 {
   printf("Integrity error %d\n",lineNo);
+  if(ext_fatal)
+       ext_fatal();
+       
   while(1){
    sleep(1);
   }
   while(1){
    sleep(1);
   }
index e5ce2d7600045c67d71e904c25aae66910fc76d9..5a26bab05ef85d4b7f7f944d4046506c6f098069 100755 (executable)
@@ -1,7 +1,17 @@
 #!/bin/bash
 
 #!/bin/bash
 
+iterations=100000
 
 
-for ((i=0; i < 100000; i++))  
+[ -z $1 ]  || iterations=$1
+
+
+rm iteration-max-*
+touch iteration-max-$iterations
+
+echo " Running $iterations iterations"
+sleep 2
+
+for ((i=0; i < $iterations; i++))  
 do
 
    seed=$RANDOM   
 do
 
    seed=$RANDOM   
@@ -10,8 +20,12 @@ do
    echo $seed>seed-nand-for-run-$i
    rm emfile-2k-0-*$j
    cp emfile-2k-0 emfile-2k-0-$i
    echo $seed>seed-nand-for-run-$i
    rm emfile-2k-0-*$j
    cp emfile-2k-0 emfile-2k-0-$i
-   echo
-   echo
-   echo "######### Run $i with seed $seed"
+   echo "#########"
+   echo "#########"
+   echo "#########"
+   echo "######### Run $i of $iterations with seed $seed"
+   echo "#########"
+   echo "#########"
+   echo "#########"
    ./yaffs_test -u -f -p -s$seed yaffs2
 done
    ./yaffs_test -u -f -p -s$seed yaffs2
 done
index 3b0e62a9ba50dde7e82cc09c12005392fa3d761e..f9fd564bcce9e13ea76b0c78dc35a31c16488352 100644 (file)
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <signal.h>
 
 #include "yaffsfs.h"
 
 #include "nor_stress.h"
 #include "yaffs_fsx.h"
 
 
 #include "yaffsfs.h"
 
 #include "nor_stress.h"
 #include "yaffs_fsx.h"
 
-
+void (*ext_fatal)(void);
 
 
 int random_seed;
 
 
 int random_seed;
@@ -55,11 +56,28 @@ void BadUsage(void)
        exit(2);
 }
 
        exit(2);
 }
 
+void test_fatal(void)
+{
+       printf("fatal yaffs test pid %d sleeping\n",getpid());
+       while(1)
+               sleep(1);
+       
+}
+
+void bad_ptr_handler(int sig)
+{
+       printf("signal %d received\n",sig);
+       test_fatal();
+}
 int main(int argc, char **argv)
 {
        int ch;
        
 int main(int argc, char **argv)
 {
        int ch;
        
-
+       ext_fatal = test_fatal;
+       signal(SIGSEGV,bad_ptr_handler);
+       signal(SIGBUS,bad_ptr_handler);
+       signal(SIGABRT,bad_ptr_handler);
+       
        while ((ch = getopt(argc,argv, "filn:ps:u"))
               != EOF)
                switch (ch) {
        while ((ch = getopt(argc,argv, "filn:ps:u"))
               != EOF)
                switch (ch) {
index 398cc0868a65ed5f041523b6700de52ec5ffb183..9ef488e3918ff4eee3b1dc34c3f85a9165f3ac6d 100644 (file)
@@ -16,7 +16,7 @@
  * This is only intended as test code to test persistence etc.
  */
 
  * This is only intended as test code to test persistence etc.
  */
 
-const char *yaffs_flashif2_c_version = "$Id: yaffs_fileem2k.c,v 1.20 2009-10-15 00:45:46 charles Exp $";
+const char *yaffs_flashif2_c_version = "$Id: yaffs_fileem2k.c,v 1.21 2009-11-07 22:35:15 charles Exp $";
 
 
 #include "yportenv.h"
 
 
 #include "yportenv.h"
@@ -82,7 +82,7 @@ static void yflash2_MaybePowerFail(unsigned int chunkInNAND, int failPoint)
    if(simulate_power_failure &&
       remaining_ops < 1){
        printf("Simulated power failure after %d operations\n",nops_so_far);
    if(simulate_power_failure &&
       remaining_ops < 1){
        printf("Simulated power failure after %d operations\n",nops_so_far);
-       printf("  Fail simulated on chunkInNAND %d, at fail point %d\n",
+       printf("  power failed on chunkInNAND %d, at fail point %d\n",
                                chunkInNAND, failPoint);
        exit(0);
   }
                                chunkInNAND, failPoint);
        exit(0);
   }