static int interleave_fsx;
+static int no_verification;
+
char fullPathName[100];
char fullPowerUpName[100];
char fullStartName[100];
yaffs_close(inh);
}
- if(nread != sizeof(x) ||
- x[0] + 1 != x[1]){
+ if(!no_verification &&
+ (nread != sizeof(x) ||
+ x[0] + 1 != x[1])){
printf("Error reading counter %s handle %d, x[0] %u x[1] %u last error %d\n",
name, inh, x[0], x[1],yaffsfs_GetLastError());
FatalError(__LINE__);
}
- if(error_line)
+ if(error_line && !no_verification)
FatalError(error_line);
yaffs_closedir(d);
int i;
int retval = 0;
+ if(no_verification)
+ return 0;
printf("Verifying file %s\n",fName);
result = yWriteFile(fullTempMainName,sz32);
FSX();
- if(result)
+ if(!no_verification && result)
FatalError(__LINE__);
printf("Raname file %s to %s\n",fullTempMainName,fullMainName);
yaffs_rename(fullTempMainName,fullMainName);
static void DoVerifyMainFile(void)
{
int result;
+ if(no_verification)
+ return;
result = yVerifyFile(fullMainName);
if(result)
FatalError(__LINE__);
}
-void NorStressTestRun(const char *prefix, int n_cycles, int do_fsx)
+void NorStressTestRun(const char *prefix, int n_cycles, int do_fsx, int skip_verification)
{
interleave_fsx = do_fsx;
+ no_verification = skip_verification;
+
MakeFullNames(prefix);
dump_directory_tree(fullPathName);
FSX_INIT(prefix);
--- /dev/null
+#!/bin/bash
+
+iterations=100000
+
+[ -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
+ j=$(( $i % 10 ))
+
+ rm -f log-nand-*$j
+ rm -f seed-nand-*$j
+ echo $seed>seed-nand-for-run-$i
+
+ rm -f emfile-2k-0-*$j
+ rm -f emfile-2k-1-*$j
+ rm -f emfile-2k-2-*$j
+ rm -f emfile-2k-3-*$j
+
+ echo "fuzz"
+
+ [ -e emfile-2k-0 ] && ./fuzzer -p 10000 emfile-2k-0
+ [ -e emfile-2k-1 ] && ./fuzzer -p 10000 emfile-2k-1
+ [ -e emfile-2k-2 ] && ./fuzzer -p 10000 emfile-2k-2
+ [ -e emfile-2k-3 ] && ./fuzzer -p 10000 emfile-2k-3
+
+ cp emfile-2k-0 emfile-2k-0-$i
+ cp emfile-2k-1 emfile-2k-1-$i
+ cp emfile-2k-2 emfile-2k-2-$i
+ cp emfile-2k-3 emfile-2k-3-$i
+
+ echo "#########"
+ echo "#########"
+ echo "#########"
+ echo "######### Run $i of $iterations with seed $seed"
+ echo "#########"
+ echo "#########"
+ echo "#########"
+ ./yaffs_test -u -p -s$seed -t 8 -z yaffs2
+ # >log-nand-$i
+done
int init_test;
int do_upgrade;
int n_cycles = -1;
+int fuzz_test=0;
+
+
int yaffs_test_maxMallocs;
extern int ops_multiplier;
while(n_cycles){
if(cycle % 100 == 0){
printf("CYCLE %8d mo %2d inodes %d space %d ",cycle,op_max,
- yaffs_inodecount(mountpt),yaffs_freespace(mountpt));
+ yaffs_inodecount(mountpt),(int)yaffs_freespace(mountpt));
for(i = 0; i < BASH_HANDLES; i++)
printf("%2d ",h[i]);
printf("\n");
printf(" s sss: set seed\n");
printf(" u: do upgrade test\n");
printf(" b: bash-about test\n");
+ printf(" z: fuzz test - ignore verification errors\n");
exit(2);
}
signal(SIGBUS,bad_ptr_handler);
signal(SIGABRT,bad_ptr_handler);
#endif
- while ((ch = getopt(argc,argv, "bfilmn:ps:t:u"))
+ while ((ch = getopt(argc,argv, "bfilmn:ps:t:uz"))
!= EOF)
switch (ch) {
case 's':
case 't':
yaffs_traceMask = strtol(optarg,NULL,0);
break;
+ case 'z':fuzz_test=1;
+ break;
default:
BadUsage();
/* NOTREACHED */
}
if(argc == 1) {
+ int result;
+
strcpy(mount_point,argv[0]);
if(simulate_power_failure)
n_cycles = -1;
- printf("Running test %s %s %s %s seed %d cycles %d\n",
+ printf("Running test %s %s %s %s %s seed %d cycles %d\n",
do_upgrade ? "fw_upgrade" : "",
init_test ? "initialise":"",
+ fuzz_test ? "fuzz-test" : "",
do_fsx ? "fsx" :"",
simulate_power_failure ? "power_fail" : "",
random_seed, n_cycles);
yaffs_StartUp();
- yaffs_mount(mount_point);
+ result = yaffs_mount(mount_point);
+ if(result < 0){
+ printf("Mount of %s failed\n",mount_point);
+ printf("pid %d sleeping\n",getpid());
+
+ while(!sleep_exit){
+ sleep(1);
+ sleep_time++;
+ }
+ }
printf("Mount complete\n");
if(do_upgrade && init_test){
NorStressTestInitialise(mount_point);
} else if(do_upgrade){
printf("Running stress on %s with seed %d\n",mount_point,random_seed);
- NorStressTestRun(mount_point,n_cycles,do_fsx);
+ NorStressTestRun(mount_point,n_cycles,do_fsx,fuzz_test);
} else if(do_fsx){
yaffs_fsx_main(mount_point,n_cycles);
} else if(do_bash_around){