projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs Use file emulator for python test
[yaffs2.git]
/
direct
/
tests
/
yaffs_test.c
diff --git
a/direct/tests/yaffs_test.c
b/direct/tests/yaffs_test.c
index 9b36e08399120c9c44174b8ed322abd31906ca7e..825cf187d3ab7a0ae58a454e27ab8b2a7bee184b 100644
(file)
--- a/
direct/tests/yaffs_test.c
+++ b/
direct/tests/yaffs_test.c
@@
-1,7
+1,7
@@
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
*
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
*
- * Copyright (C) 2002 Aleph One Ltd.
+ * Copyright (C) 2002
-2010
Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
@@
-24,6
+24,8
@@
#include "yaffsfs.h"
#include "yaffsfs.h"
+#include "yaffs_trace.h"
+
#include "nor_stress.h"
#include "yaffs_fsx.h"
#include "nor_stress.h"
#include "yaffs_fsx.h"
@@
-40,6
+42,9
@@
int do_bash_around;
int init_test;
int do_upgrade;
int n_cycles = -1;
int init_test;
int do_upgrade;
int n_cycles = -1;
+int fuzz_test=0;
+
+
int yaffs_test_maxMallocs;
extern int ops_multiplier;
int yaffs_test_maxMallocs;
extern int ops_multiplier;
@@
-72,7
+77,7
@@
void yaffs_bash_around(const char *mountpt, int n_cycles)
while(n_cycles){
if(cycle % 100 == 0){
printf("CYCLE %8d mo %2d inodes %d space %d ",cycle,op_max,
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");
for(i = 0; i < BASH_HANDLES; i++)
printf("%2d ",h[i]);
printf("\n");
@@
-153,6
+158,7
@@
void BadUsage(void)
printf(" s sss: set seed\n");
printf(" u: do upgrade test\n");
printf(" b: bash-about test\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);
}
exit(2);
}
@@
-190,7
+196,7
@@
int main(int argc, char **argv)
signal(SIGBUS,bad_ptr_handler);
signal(SIGABRT,bad_ptr_handler);
#endif
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:u
z
"))
!= EOF)
switch (ch) {
case 's':
!= EOF)
switch (ch) {
case 's':
@@
-223,6
+229,8
@@
int main(int argc, char **argv)
case 't':
yaffs_traceMask = strtol(optarg,NULL,0);
break;
case 't':
yaffs_traceMask = strtol(optarg,NULL,0);
break;
+ case 'z':fuzz_test=1;
+ break;
default:
BadUsage();
/* NOTREACHED */
default:
BadUsage();
/* NOTREACHED */
@@
-235,19
+243,31
@@
int main(int argc, char **argv)
}
if(argc == 1) {
}
if(argc == 1) {
+ int result;
+
strcpy(mount_point,argv[0]);
if(simulate_power_failure)
n_cycles = -1;
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":"",
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();
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){
printf("Mount complete\n");
if(do_upgrade && init_test){
@@
-255,7
+275,7
@@
int main(int argc, char **argv)
NorStressTestInitialise(mount_point);
} else if(do_upgrade){
printf("Running stress on %s with seed %d\n",mount_point,random_seed);
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){
} else if(do_fsx){
yaffs_fsx_main(mount_point,n_cycles);
} else if(do_bash_around){