Mercurial > yaffs-ecoscentric
changeset 240:7fb6de310d02
Tweaks to nor stress simulation. Save random seed so that we can do better debugging
| author | charles |
|---|---|
| date | Fri, 21 Nov 2008 02:19:30 +0000 |
| parents | 9283fe91d449 |
| children | b2f3536010cf |
| files | direct/Makefile direct/dtest.c direct/nor_stress.c direct/run_fw_update_test.sh direct/yaffs_test.c direct/ynorsim.c |
| diffstat | 6 files changed, 27 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/direct/Makefile +++ b/direct/Makefile @@ -22,7 +22,7 @@ CFLAGS = -DCONFIG_YAFFS_DIRECT -DCO 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
--- a/direct/dtest.c +++ b/direct/dtest.c @@ -2283,10 +2283,11 @@ void random_small_file_test(const char * } +int random_seed; int main(int argc, char *argv[]) { - + random_seed = time(NULL); //return long_test(argc,argv); //return cache_read_test();
--- a/direct/nor_stress.c +++ b/direct/nor_stress.c @@ -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); } }
--- a/direct/run_fw_update_test.sh +++ b/direct/run_fw_update_test.sh @@ -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
--- a/direct/yaffs_test.c +++ b/direct/yaffs_test.c @@ -26,20 +26,27 @@ +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
--- a/direct/ynorsim.c +++ b/direct/ynorsim.c @@ -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();
