From 3797c6edfef9bef80f70001b14ee636b0309895a Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 26 Nov 2008 20:49:36 +0000 Subject: [PATCH] Some test case changes --- direct/dtest.c | 20 +++++++++++++++++++- direct/fsx_test/yaffs_fsx.c | 5 ++++- direct/yaffs_test.c | 2 ++ direct/ynorsim.c | 6 ++++-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/direct/dtest.c b/direct/dtest.c index 4478cdc..5b4d6a6 100644 --- a/direct/dtest.c +++ b/direct/dtest.c @@ -2281,9 +2281,25 @@ void random_small_file_test(const char *mountpt,int iterations) yaffs_unmount(mountpt); } + +void rmdir_test(const char *mountpt) +{ + char name[100]; + yaffs_StartUp(); + + yaffs_mount(mountpt); + + strcpy(name,mountpt); + strcat(name,"/"); + strcat(name,"hello"); + yaffs_mkdir(name,0666); + yaffs_rmdir(name); + yaffs_unmount(mountpt); +} int random_seed; +int simulate_power_failure; int main(int argc, char *argv[]) { @@ -2300,7 +2316,9 @@ int main(int argc, char *argv[]) //yaffs_backward_scan_test("/flash/flash"); // yaffs_device_flush_test("/flash/flash"); - rename_over_test("//////////////////flash///////////////////yaffs1///////////"); + //rename_over_test("//////////////////flash///////////////////yaffs1///////////"); + + rmdir_test("M18-1"); //scan_pattern_test("/flash",10000,10); //short_scan_test("/flash/flash",40000,200); diff --git a/direct/fsx_test/yaffs_fsx.c b/direct/fsx_test/yaffs_fsx.c index 31b0751..484241b 100644 --- a/direct/fsx_test/yaffs_fsx.c +++ b/direct/fsx_test/yaffs_fsx.c @@ -774,7 +774,10 @@ getnum(char *s, char **e) } -#define BASE_NAME "/flash/yaffs1" +#define BASE_NAME "/M18-1" + +int random_seed = 999; +int simulate_power_failure = 0; int main(int argc, char **argv) diff --git a/direct/yaffs_test.c b/direct/yaffs_test.c index 04e3b2a..2a17f75 100644 --- a/direct/yaffs_test.c +++ b/direct/yaffs_test.c @@ -27,6 +27,7 @@ int random_seed; +int simulate_power_failure = 0; void BadUsage(void) { @@ -47,6 +48,7 @@ int main(int argc, const char *argv[]) } else if(!strcmp(argv[2],"fw_update")){ printf("Running stress on %s with seed %d\n",argv[1],random_seed); + simulate_power_failure = 1; NorStressTestRun(argv[1]); } else diff --git a/direct/ynorsim.c b/direct/ynorsim.c index 6936a9c..723b72b 100644 --- a/direct/ynorsim.c +++ b/direct/ynorsim.c @@ -40,6 +40,7 @@ static __u32 word[YNORSIM_DEV_SIZE_U32]; extern int random_seed; +extern int simulate_power_failure; static void NorError(void) { @@ -80,7 +81,8 @@ static void ynorsim_MaybePowerFail(void) remaining_ops--; - if(remaining_ops < 1){ + if(simulate_power_failure && + remaining_ops < 1){ printf("Simulated power failure after %d operations\n",nops_so_far); ynorsim_PowerFail(); } @@ -92,7 +94,7 @@ static void ynorsim_Ready(void) return; srand(random_seed); remaining_ops = 1000000000; - remaining_ops = (rand() % 10000) * 3000 * YNORSIM_BIT_CHANGES; + remaining_ops = (rand() % 10000) * 300 * YNORSIM_BIT_CHANGES; ynorsim_RestoreImage(); } -- 2.30.2