changeset 245:87755cd7272a

Some test case changes
author charles
date Wed, 26 Nov 2008 20:49:36 +0000
parents 9fd436f3a10b
children 8a37f364d258
files direct/dtest.c direct/fsx_test/yaffs_fsx.c direct/yaffs_test.c direct/ynorsim.c
diffstat 4 files changed, 29 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/direct/dtest.c
+++ b/direct/dtest.c
@@ -2281,9 +2281,25 @@ void random_small_file_test(const char *
 		
 	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);
--- 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)
--- 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 
--- 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();
 }