projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More test tweaks
[yaffs2.git]
/
direct
/
tests
/
nor_stress.c
diff --git
a/direct/tests/nor_stress.c
b/direct/tests/nor_stress.c
index 51a6bdd25ee8518388d86a2eb69a538da0302f44..f84e1470ad8c6698e6395fb412626a533becd008 100644
(file)
--- a/
direct/tests/nor_stress.c
+++ b/
direct/tests/nor_stress.c
@@
-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;
@@
-68,10
+70,19
@@
void MakeFullNames(const char *prefix)
MakeName(fullTempMainName,prefix,"tmp-main");
}
MakeName(fullTempMainName,prefix,"tmp-main");
}
-static void FatalError(void)
+static void FatalError(int lineNo)
+{
+ printf("Integrity error %d\n",lineNo);
+ if(ext_fatal)
+ ext_fatal();
+
+ while(1){
+ sleep(1);
+ }
+}
+void print_stat(const char *str, struct yaffs_stat *st)
{
{
- printf("Integrity error\n");
- while(1){}
+ printf("%s inode %d\n",str,st->st_ino);
}
static void UpdateCounter(const char *name, unsigned *val, int initialise)
}
static void UpdateCounter(const char *name, unsigned *val, int initialise)
@@
-98,7
+109,7
@@
static void UpdateCounter(const char *name, unsigned *val, int initialise)
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());
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();
+ FatalError(
__LINE__
);
}
x[0]++;
}
x[0]++;
@@
-108,11
+119,20
@@
static void UpdateCounter(const char *name, unsigned *val, int initialise)
FSX();
outh = yaffs_open(fullTempCounterName, O_RDWR | O_TRUNC | O_CREAT, S_IREAD | S_IWRITE);
if(outh >= 0){
FSX();
outh = yaffs_open(fullTempCounterName, O_RDWR | O_TRUNC | O_CREAT, S_IREAD | S_IWRITE);
if(outh >= 0){
+ struct yaffs_stat tmpstat, oldstat, tmpfstat;
FSX();
nwritten = yaffs_write(outh,x,sizeof(x));
FSX();
FSX();
nwritten = yaffs_write(outh,x,sizeof(x));
FSX();
+ yaffs_fstat(outh,&tmpfstat);
yaffs_close(outh);
FSX();
yaffs_close(outh);
FSX();
+
+ printf("About to rename %s to %s\n",fullTempCounterName,name);
+ yaffs_stat(fullTempCounterName,&tmpstat);
+ yaffs_stat(name,&oldstat);
+ print_stat("old stat",&oldstat);
+ print_stat("new stat",&tmpstat);
+ print_stat("new fstat",&tmpfstat);
yaffs_rename(fullTempCounterName,name);
FSX();
}
yaffs_rename(fullTempCounterName,name);
FSX();
}
@@
-120,7
+140,7
@@
static void UpdateCounter(const char *name, unsigned *val, int initialise)
if(nwritten != sizeof(x)){
printf("Error writing counter %s handle %d, x[0] %u x[1] %u\n",
name, inh, x[0], x[1]);
if(nwritten != sizeof(x)){
printf("Error writing counter %s handle %d, x[0] %u x[1] %u\n",
name, inh, x[0], x[1]);
- FatalError();
+ FatalError(
__LINE__
);
}
*val = x[0];
}
*val = x[0];
@@
-154,7
+174,12
@@
static void dump_directory_tree_worker(const char *dname,int recursive)
yaffs_lstat(str,&s);
yaffs_lstat(str,&s);
- printf("%s inode %d obj %x length %d mode %X ",str,s.st_ino,de->d_dont_use,(int)s.st_size,s.st_mode);
+ printf("%s inode %ld %d obj %x length %d mode %X ",str, de->d_ino, s.st_ino,de->d_dont_use,(int)s.st_size,s.st_mode);\
+ if(de->d_ino != s.st_ino){
+ printf(" \n\n!!!! HEY inode mismatch\n\n");
+ FatalError(__LINE__);
+ }
+
switch(s.st_mode & S_IFMT)
{
case S_IFREG: printf("data file"); break;
switch(s.st_mode & S_IFMT)
{
case S_IFREG: printf("data file"); break;
@@
-174,7
+199,7
@@
static void dump_directory_tree_worker(const char *dname,int recursive)
dump_directory_tree_worker(str,1);
if(s.st_ino > 10000)
dump_directory_tree_worker(str,1);
if(s.st_ino > 10000)
- FatalError();
+ FatalError(
__LINE__
);
}
}
@@
-202,12
+227,15
@@
static int yWriteFile(const char *fname, unsigned sz32)
int h;
int r;
int i;
int h;
int r;
int i;
+ struct yaffs_stat st;
unsigned checksum = 0;
unsigned checksum = 0;
- printf("Writing file %s\n",fname);
FSX();
h = yaffs_open(fname,O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
FSX();
h = yaffs_open(fname,O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
+ yaffs_fstat(h,&st);
+ printf("Writing file %s inode %d\n",fname, st.st_ino);
+
FSX();
if(h < 0){
FSX();
if(h < 0){
@@
-336,7
+364,7
@@
static void DoUpdateMainFile(void)
result = yWriteFile(fullTempMainName,sz32);
FSX();
if(result)
result = yWriteFile(fullTempMainName,sz32);
FSX();
if(result)
- FatalError();
+ FatalError(
__LINE__
);
yaffs_rename(fullTempMainName,fullMainName);
FSX();
}
yaffs_rename(fullTempMainName,fullMainName);
FSX();
}
@@
-346,7
+374,7
@@
static void DoVerifyMainFile(void)
int result;
result = yVerifyFile(fullMainName);
if(result)
int result;
result = yVerifyFile(fullMainName);
if(result)
- FatalError();
+ FatalError(
__LINE__
);
}
}